Skip to content

Commit c2b4814

Browse files
pdf enhancement
Signed-off-by: Laurent Martin <laurent.martin.l@gmail.com>
1 parent 8cf4440 commit c2b4814

12 files changed

Lines changed: 67 additions & 44 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5861/badge)](https://bestpractices.coreinfrastructure.org/projects/5861)
66
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
77

8+
![Hootput the Owl](docs/mascot.svg)
9+
810
**`ascli`** is the command-line interface for IBM Aspera products.
911
Use it from the terminal or in scripts to:
1012

build/doc/pandoc/defaults_pdf.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Pandoc options : see https://pandoc.org/MANUAL.html
22
to: pdf
33
pdf-engine: lualatex
4+
pdf-engine-opts:
5+
- "-shell-escape"
46
variables:
57
documentclass: report
68
mainfont: "IBM Plex Sans"

build/doc/pandoc/pdf_in_header.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
}
2020
% https://ctan.org/pkg/graphicx
2121
\usepackage{graphicx}
22+
\usepackage{svg}
2223
% https://ctan.org/pkg/eso-pic
2324
\usepackage{eso-pic}
2425
\AddToShipoutPictureBG*{

build/lib/pandoc.rb

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ def generate_gfx_paths_latex(paths)
6060
result
6161
end
6262

63+
def check_add_defaults_file(md, format, additional)
64+
add_defaults = Pathname.new(md).dirname / ".#{Pathname.new(md).basename}.#{format}.pandoc.yaml"
65+
log.info{"checking defaults: #{add_defaults}"}
66+
return unless add_defaults.exist?
67+
log.info{"Using default pandoc defaults: #{add_defaults}"}
68+
additional << add_defaults
69+
end
70+
6371
# Generate PDF from Markdown using pandoc templates
6472
def markdown_to_pdf(md:, pdf:)
6573
log.info{"Generating: #{pdf}"}
@@ -70,19 +78,25 @@ def markdown_to_pdf(md:, pdf:)
7078
Dir.chdir(File.dirname(md)) do
7179
md = File.basename(md)
7280
custom_defaults_file = extract_pandoc_defaults_file(md)
73-
gfx_paths_latex = generate_gfx_paths_latex([PATH_PANDOC_ROOT])
81+
gfx_paths_latex = generate_gfx_paths_latex([PATH_PANDOC_ROOT, '.'])
82+
defaults = [
83+
PATH_PANDOC_ROOT / 'defaults_common.yaml',
84+
PATH_PANDOC_ROOT / 'defaults_pdf.yaml',
85+
custom_defaults_file
86+
]
87+
check_add_defaults_file(md, 'pdf', defaults)
7488
run(
7589
'pandoc',
7690
"--include-in-header=#{gfx_paths_latex}",
7791
"--variable=date:#{get_change_date(md)}",
78-
"--defaults=#{PATH_PANDOC_ROOT / 'defaults_common.yaml'}",
79-
"--defaults=#{PATH_PANDOC_ROOT / 'defaults_pdf.yaml'}",
80-
"--defaults=#{custom_defaults_file}",
92+
*defaults.map{ |f| "--defaults=#{f}"},
8193
"--output=#{pdf}",
8294
md
8395
)
8496
custom_defaults_file.delete
8597
gfx_paths_latex.delete
98+
# temporary files
99+
FileUtils.rm_rf('svg-inkscape')
86100
end
87101
end
88102

build/lib/paths.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ module Paths
3636
TMPL_CONF_FILE = DOC / 'test_env.conf'
3737
TSPEC_JSON_SCHEMA = DOC / 'spec.schema.json'
3838
ASPERA_CONF_XSD = DOC / 'aspera.conf.xsd'
39-
UML_PNG = Paths::DOC / 'uml.png'
39+
UML_PNG = DOC / 'uml.png'
40+
MASCOT_SVG = DOC / 'mascot.svg'
41+
MASCOT_PDF = DOC / 'mascot.pdf'
4042
MD_MANUAL = DOC / 'README.md'
4143
MD_ERB = DOC / 'README.erb.md'
4244
TSPEC_YAML_SCHEMA = LIB / 'aspera/transfer/spec.schema.yaml'

docs/.README.md.pdf.pandoc.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include-before-body:
2+
- .README.md.pdf.tex

docs/.README.md.pdf.tex

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
\thispagestyle{empty}
2+
\vspace*{\fill}
3+
\begin{center}
4+
\includesvg[width=8cm,keepaspectratio]{mascot.svg}
5+
6+
\vspace{4cm}
7+
\large
8+
\itshape
9+
"Hey, I'm ascli - your data's personal courier.
10+
11+
I don't do flashy dashboards; I'm happiest in a terminal window.
12+
13+
Hand me a command, and I'll zip your files across the network faster than you thought possible.
14+
15+
Need to automate? I'm script-friendly.
16+
17+
Need to integrate? I've got APIs on speed-dial.
18+
19+
Need to debug? I'll show you what's going on under the hood.
20+
21+
Think of me as Aspera's command-line sidekick: quick, reliable, and a little no-nonsense.
22+
23+
You bring the files; I'll bring the horsepower."
24+
\normalsize
25+
\end{center}
26+
\vspace*{4cm}
27+
\newpage

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
svg-inkscape

docs/README.erb.md

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,15 @@ PANDOC_DEFAULTS_BEGIN
55
metadata:
66
subtitle: "<%=cmd%> <%=build_version%>"
77
author: "<%=gemspec.authors.join(', ')%>"
8-
variables:
9-
include-before:
10-
- ''
118
PANDOC_DEFAULTS_END
129
-->
1310

14-
<!-- NOTE CAUTION WARNING IMPORTANT TIP INFO -->
11+
<!-- Admonitions: NOTE CAUTION WARNING IMPORTANT TIP INFO -->
1512

1613
<!-- markdownlint-disable MD028 -->
1714
<!-- markdownlint-disable MD024 -->
1815
<!-- markdownlint-disable MD060 -->
1916

20-
![Hootput the Owl](<%=link_repo('docs/mascot.svg')%>)
21-
22-
"Hey, I’m <%=tool%> - your data’s personal courier.
23-
I don’t do flashy dashboards; I’m happiest in a terminal window.
24-
Hand me a command, and I’ll zip your files across the network faster than you thought possible.
25-
26-
Need to automate? I’m script-friendly.
27-
28-
Need to integrate? I’ve got APIs on speed-dial.
29-
30-
Need to debug? I’ll show you what’s going on under the hood.
31-
32-
Think of me as Aspera’s command-line sidekick: quick, reliable, and a little no-nonsense. You bring the files; I’ll bring the horsepower."
33-
3417
## Introduction
3518

3619
### Overview

docs/README.md

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,16 @@ PANDOC_DEFAULTS_BEGIN
55
metadata:
66
subtitle: "ascli 4.26.0.pre"
77
author: "Laurent Martin"
8-
variables:
9-
include-before:
10-
- ''
118
PANDOC_DEFAULTS_END
129
-->
1310
<!-- markdownlint-disable MD033 -->
1411

15-
<!-- NOTE CAUTION WARNING IMPORTANT TIP INFO -->
12+
<!-- Admonitions: NOTE CAUTION WARNING IMPORTANT TIP INFO -->
1613

1714
<!-- markdownlint-disable MD028 -->
1815
<!-- markdownlint-disable MD024 -->
1916
<!-- markdownlint-disable MD060 -->
2017

21-
![Hootput the Owl](mascot.svg)
22-
23-
"Hey, I’m `ascli` - your data’s personal courier.
24-
I don’t do flashy dashboards; I’m happiest in a terminal window.
25-
Hand me a command, and I’ll zip your files across the network faster than you thought possible.
26-
27-
Need to automate? I’m script-friendly.
28-
29-
Need to integrate? I’ve got APIs on speed-dial.
30-
31-
Need to debug? I’ll show you what’s going on under the hood.
32-
33-
Think of me as Aspera’s command-line sidekick: quick, reliable, and a little no-nonsense. You bring the files; I’ll bring the horsepower."
34-
3518
## Introduction
3619

3720
### Overview
@@ -4823,7 +4806,7 @@ DESCRIPTION
48234806
Use Aspera application to perform operations on command line.
48244807
Documentation and examples: https://rubygems.org/gems/aspera-cli
48254808
execute: ascli conf doc
4826-
or visit: https://www.rubydoc.info/gems/aspera-cli
4809+
or visit: https://ibm.biz/ascli-doc
48274810
source repo: https://github.com/IBM/aspera-cli
48284811
48294812
ENVIRONMENT VARIABLES
@@ -10129,6 +10112,6 @@ ascli config coffee
1012910112
1013010113
Ruby gem: [https://rubygems.org/gems/aspera-cli](https://rubygems.org/gems/aspera-cli)
1013110114
10132-
Ruby Doc: [https://www.rubydoc.info/gems/aspera-cli](https://www.rubydoc.info/gems/aspera-cli)
10115+
Ruby Doc: [https://ibm.biz/ascli-doc](https://ibm.biz/ascli-doc)
1013310116
1013410117
[Aspera APIs on IBM developer](https://developer.ibm.com/apis/catalog/?search=aspera)

0 commit comments

Comments
 (0)