octool 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/octool +1 -0
- data/lib/octool/ssp.rb +9 -7
- data/lib/octool/version.rb +1 -1
- data/octool.rdoc +1 -1
- data/templates/glossary.erb +173 -0
- data/templates/ssp.erb +36 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2bc082300d2393b604bc09640def5bf7ad2cb0b05cf23b45f6e008a5d964547
|
4
|
+
data.tar.gz: 02b576ce174d710fd07e922f1f5aa818dec7114ee931ff39cbf3a2db8d64da1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62fce55d3097c779050eab057ae9b167c72ef8b9a4b257a47630bff1518b6cce1f27a21a547e262862de3fa8608cf894582a2654ea665cc89d3dd819870bf99e
|
7
|
+
data.tar.gz: 64e7035d4ec01fcbb2c87665f8c1b4177561f0af8d3f4a6c226453f9f8c50e5d91c843351aefeea59f498edff066830a940a789c9cbb59b2372631c1fb01d9d9
|
data/bin/octool
CHANGED
@@ -89,6 +89,7 @@ class App
|
|
89
89
|
system = OCTool::Parser.new(config_file).load_system
|
90
90
|
Dir.chdir File.dirname(config_file) do
|
91
91
|
OCTool::SSP.new(system, export_dir).generate(options[:version])
|
92
|
+
OCTool::SSP.new(system, export_dir).generate(options[:version], 'glossary')
|
92
93
|
end
|
93
94
|
end
|
94
95
|
end
|
data/lib/octool/ssp.rb
CHANGED
@@ -12,6 +12,7 @@ module OCTool
|
|
12
12
|
def initialize(system, output_dir)
|
13
13
|
@system = system
|
14
14
|
@output_dir = output_dir
|
15
|
+
@template_name = 'ssp'
|
15
16
|
@version = OCTool::DEFAULT_SSP_VERSION
|
16
17
|
@build_date = DateTime.now
|
17
18
|
end
|
@@ -33,8 +34,9 @@ module OCTool
|
|
33
34
|
exit(1)
|
34
35
|
end
|
35
36
|
|
36
|
-
def generate(version = nil)
|
37
|
+
def generate(version = nil, template_name = 'ssp')
|
37
38
|
self.version = version if version
|
39
|
+
@template_name = template_name if template_name
|
38
40
|
unless File.writable?(@output_dir)
|
39
41
|
warn "[FAIL] #{@output_dir} is not writable"
|
40
42
|
exit(1)
|
@@ -47,7 +49,6 @@ module OCTool
|
|
47
49
|
|
48
50
|
def render_template
|
49
51
|
print "Building markdown #{md_path} ... "
|
50
|
-
template_path = File.join(ERB_DIR, 'ssp.erb')
|
51
52
|
template = File.read(template_path)
|
52
53
|
output = ERB.new(template, nil, '-').result(binding)
|
53
54
|
File.open(md_path, 'w') { |f| f.puts output }
|
@@ -64,15 +65,12 @@ module OCTool
|
|
64
65
|
|
65
66
|
# rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
66
67
|
def write(type = 'pdf')
|
67
|
-
out_path = File.join(@output_dir, "
|
68
|
+
out_path = File.join(@output_dir, "#{@template_name}.#{type}")
|
68
69
|
print "Building #{out_path} ... "
|
69
70
|
converter = pandoc.configure do
|
70
71
|
from 'markdown+autolink_bare_uris'
|
71
72
|
to type
|
72
73
|
pdf_engine 'lualatex'
|
73
|
-
toc
|
74
|
-
toc_depth 3
|
75
|
-
number_sections
|
76
74
|
highlight_style 'pygments'
|
77
75
|
filter 'pandoc-acronyms' if ENV['PANDOC_ACRONYMS_ACRONYMS']
|
78
76
|
# https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings#Encoding_issue
|
@@ -86,7 +84,11 @@ module OCTool
|
|
86
84
|
# rubocop:enable Metrics/AbcSize,Metrics/MethodLength
|
87
85
|
|
88
86
|
def md_path
|
89
|
-
|
87
|
+
File.join(@output_dir, "#{@template_name}.md")
|
88
|
+
end
|
89
|
+
|
90
|
+
def template_path
|
91
|
+
File.join(ERB_DIR, "#{@template_name}.erb")
|
90
92
|
end
|
91
93
|
end
|
92
94
|
end
|
data/lib/octool/version.rb
CHANGED
data/octool.rdoc
CHANGED
@@ -0,0 +1,173 @@
|
|
1
|
+
---
|
2
|
+
<% if @system.config['logo'] -%>
|
3
|
+
title: |
|
4
|
+
{width=<%= @system.config['logo']['width'] %>}
|
5
|
+
|
6
|
+
Glossary
|
7
|
+
<% else %>
|
8
|
+
title: "Glossary"
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
subtitle: |
|
12
|
+
<%=build_date.strftime('%Y-%b-%d')%>
|
13
|
+
|
14
|
+
<% unless version == OCTool::DEFAULT_SSP_VERSION -%>
|
15
|
+
Version <%=version%>
|
16
|
+
<% end -%>
|
17
|
+
|
18
|
+
fontsize: 11pt
|
19
|
+
mainfont: NotoSans
|
20
|
+
monofont: NotoSansMono-ExtraCondensed
|
21
|
+
mainfontoptions:
|
22
|
+
- Numbers=Lowercase
|
23
|
+
- Numbers=Proportional
|
24
|
+
- UprightFont=*
|
25
|
+
- ItalicFont=*-Italic
|
26
|
+
- BoldFont=*-Bold
|
27
|
+
- BoldItalicFont=*-BoldItalic
|
28
|
+
|
29
|
+
colorlinks: true
|
30
|
+
linkcolor: black # internal links (e.g., lof and lot)
|
31
|
+
urlcolor: blue
|
32
|
+
|
33
|
+
documentclass: article
|
34
|
+
classoption:
|
35
|
+
- onecolumn
|
36
|
+
- oneside
|
37
|
+
- portrait
|
38
|
+
|
39
|
+
pagestyle: headings
|
40
|
+
papersize: letter
|
41
|
+
geometry:
|
42
|
+
- top=2cm
|
43
|
+
- left=3cm
|
44
|
+
- right=2cm
|
45
|
+
- bottom=2cm
|
46
|
+
|
47
|
+
header-includes:
|
48
|
+
- |
|
49
|
+
```{=latex}
|
50
|
+
% https://ctan.org/pkg/metalogo?lang=en
|
51
|
+
\usepackage{metalogo}
|
52
|
+
```
|
53
|
+
- |
|
54
|
+
```{=latex}
|
55
|
+
% https://github.com/jgm/pandoc/wiki/Pandoc-Tricks#left-aligning-tables-in-latex
|
56
|
+
\usepackage[margins=raggedright]{floatrow}
|
57
|
+
```
|
58
|
+
- |
|
59
|
+
```{=latex}
|
60
|
+
% https://github.com/jgm/pandoc/wiki/Pandoc-Tricks#definition-list-terms-on-their-own-line-in-latex
|
61
|
+
% "Clone" the original \item command
|
62
|
+
\let\originalitem\item
|
63
|
+
|
64
|
+
% Create variable with default value false to use later
|
65
|
+
% http://handyfloss.net/2007.08/latex-programming-how-to-implement-conditionals/
|
66
|
+
\newif \ifonelinedef
|
67
|
+
\onelinedeffalse
|
68
|
+
|
69
|
+
% Redefine the \item command using the "clone"
|
70
|
+
\makeatletter
|
71
|
+
\renewcommand{\item}[1][\@nil] {%
|
72
|
+
\def \tmp {#1}%
|
73
|
+
\ifx \tmp \@nnil
|
74
|
+
\originalitem
|
75
|
+
\else
|
76
|
+
\ifonelinedef
|
77
|
+
\originalitem[#1]\vspace{4mm}\par
|
78
|
+
\else
|
79
|
+
\originalitem[#1]\hfill\par
|
80
|
+
\fi
|
81
|
+
\fi
|
82
|
+
}
|
83
|
+
\makeatother
|
84
|
+
```
|
85
|
+
- |
|
86
|
+
```{=latex}
|
87
|
+
% The are at least two ways to configure how LaTeX floats figures.
|
88
|
+
%
|
89
|
+
% 1. One approach is described in section 17.2 of
|
90
|
+
% http://tug.ctan.org/tex-archive/info/epslatex/english/epslatex.pdf
|
91
|
+
% However, the approach described there requires to teach people
|
92
|
+
% how to write LaTeX cross-references in markdown.
|
93
|
+
%
|
94
|
+
% 2. Force figures, listings, etc., to float "[H]ere".
|
95
|
+
% This is a LaTeX anti-pattern because it causes large gaps of whitespace on some pages.
|
96
|
+
% This approach avoids having to teach people to create LaTeX cross-references.
|
97
|
+
% https://tex.stackexchange.com/a/101726
|
98
|
+
%
|
99
|
+
% Use option 2.
|
100
|
+
\usepackage{float}
|
101
|
+
\floatplacement{figure}{H}
|
102
|
+
```
|
103
|
+
- |
|
104
|
+
```{=latex}
|
105
|
+
% https://tex.stackexchange.com/a/32537
|
106
|
+
\usepackage{lastpage}
|
107
|
+
|
108
|
+
% https://ctan.org/pkg/fancyhdr?lang=en
|
109
|
+
\usepackage{fancyhdr}
|
110
|
+
|
111
|
+
\pagestyle{fancy}
|
112
|
+
<% unless version == OCTool::DEFAULT_SSP_VERSION %>
|
113
|
+
\fancyfoot[L]{Version: <%=version-%>}
|
114
|
+
<% end %>
|
115
|
+
\fancyfoot[C]{<%=build_date.strftime('%Y-%b-%d')-%>}
|
116
|
+
\fancyfoot[R]{\thepage\ of\ \pageref{LastPage}}
|
117
|
+
\renewcommand{\footrulewidth}{0.4pt} % thickness
|
118
|
+
\renewcommand{\headrulewidth}{0.4pt} % thickness
|
119
|
+
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrule}{}}
|
120
|
+
```
|
121
|
+
- |
|
122
|
+
```{=latex}
|
123
|
+
% Which bullet glyphs are avaiable?
|
124
|
+
% http://texdoc.net/texmf-dist/doc/latex/comprehensive/symbols-a4.pdf TABLE 50
|
125
|
+
%
|
126
|
+
% https://learnbyexample.github.io/tutorial/ebook-generation/customizing-pandoc/
|
127
|
+
% https://tex.stackexchange.com/questions/174244/change-the-shape-of-the-bullet-list
|
128
|
+
% https://texblog.org/2008/10/16/lists-enumerate-itemize-description-and-how-to-change-them/
|
129
|
+
% https://tex.stackexchange.com/a/64899
|
130
|
+
% https://ctan.org/pkg/enumitem?lang=en
|
131
|
+
% https://www.latex4technics.com/?note=2vy0
|
132
|
+
%
|
133
|
+
%\usepackage{amsfonts}
|
134
|
+
%
|
135
|
+
% Make bullets small
|
136
|
+
%\renewcommand{\labelitemi}{\tiny $\textbullet$}
|
137
|
+
%\renewcommand{\labelitemii}{\tiny $\textopenbullet$}
|
138
|
+
%\renewcommand{\labelitemiii}{\tiny $\triangleright$}
|
139
|
+
%
|
140
|
+
% Align bullets to left margin and make small
|
141
|
+
% https://tex.stackexchange.com/a/86408
|
142
|
+
%\usepackage{enumitem}
|
143
|
+
%\usepackage{graphicx}
|
144
|
+
%\setlist[itemize,1]{leftmargin=*,label=\scalebox{.8}{$\textbullet$}}
|
145
|
+
%\setlist[itemize,2]{leftmargin=*,label=\scalebox{.8}{$\textopenbullet$}}
|
146
|
+
%\setlist[itemize,3]{leftmargin=*,label=\scalebox{.8}{\triangleright}}
|
147
|
+
%
|
148
|
+
% Align bullets to left margin and use normal font
|
149
|
+
\usepackage{enumitem}
|
150
|
+
\setlist[itemize,1]{leftmargin=*,label=$\textbullet$}
|
151
|
+
\setlist[itemize,2]{leftmargin=*,label=$\textopenbullet$}
|
152
|
+
\setlist[itemize,3]{leftmargin=*,label=\triangleright}
|
153
|
+
%
|
154
|
+
% Align bullets to left margin and use slightly smaller font
|
155
|
+
%\usepackage{MnSymbol}
|
156
|
+
%\setlist[itemize,1]{leftmargin=*,label=$\bullet$}
|
157
|
+
%\setlist[itemize,2]{leftmargin=*,label=$\circ$}
|
158
|
+
%\setlist[itemize,3]{leftmargin=*,label=\blacktriangleright}
|
159
|
+
```
|
160
|
+
---
|
161
|
+
|
162
|
+
<% if @system.config['acronyms'] %>
|
163
|
+
|
164
|
+
<!-- Force glossary to be typeset as oneline definitions. -->
|
165
|
+
\onelinedeftrue
|
166
|
+
|
167
|
+
<% @system.config['acronyms'].values.sort_by { |a| a['shortform'] }. each do |a| %>
|
168
|
+
<%=a['shortform']%>
|
169
|
+
~ <%=a['longform']%>
|
170
|
+
|
171
|
+
<% end %>
|
172
|
+
\onelinedeffalse
|
173
|
+
<% end %>
|
data/templates/ssp.erb
CHANGED
@@ -45,6 +45,10 @@ colorlinks: true
|
|
45
45
|
linkcolor: black # internal links (e.g., lof and lot)
|
46
46
|
urlcolor: blue
|
47
47
|
|
48
|
+
toc: true
|
49
|
+
toc_depth: 3
|
50
|
+
numbersections: true
|
51
|
+
|
48
52
|
documentclass: report
|
49
53
|
classoption:
|
50
54
|
- onecolumn
|
@@ -76,11 +80,25 @@ header-includes:
|
|
76
80
|
% "Clone" the original \item command
|
77
81
|
\let\originalitem\item
|
78
82
|
|
83
|
+
% Create variable with default value false to use later
|
84
|
+
% http://handyfloss.net/2007.08/latex-programming-how-to-implement-conditionals/
|
85
|
+
\newif \ifonelinedef
|
86
|
+
\onelinedeffalse
|
87
|
+
|
79
88
|
% Redefine the \item command using the "clone"
|
80
89
|
\makeatletter
|
81
|
-
\renewcommand{\item}[1][\@nil]{%
|
82
|
-
\def\tmp{#1}%
|
83
|
-
\ifx\tmp\@nnil
|
90
|
+
\renewcommand{\item}[1][\@nil] {%
|
91
|
+
\def \tmp {#1}%
|
92
|
+
\ifx \tmp \@nnil
|
93
|
+
\originalitem
|
94
|
+
\else
|
95
|
+
\ifonelinedef
|
96
|
+
\originalitem[#1]\vspace{4mm}\par
|
97
|
+
\else
|
98
|
+
\originalitem[#1]\hfill\par
|
99
|
+
\fi
|
100
|
+
\fi
|
101
|
+
}
|
84
102
|
\makeatother
|
85
103
|
```
|
86
104
|
- |
|
@@ -280,6 +298,21 @@ a['satisfies'][1..].each do |s|
|
|
280
298
|
<% end %>
|
281
299
|
|
282
300
|
|
301
|
+
<% if @system.config['acronyms'] %>
|
302
|
+
# Glossary
|
303
|
+
|
304
|
+
<!-- Force glossary to be typeset as oneline definitions. -->
|
305
|
+
\onelinedeftrue
|
306
|
+
|
307
|
+
<% @system.config['acronyms'].values.sort_by { |a| a['shortform'] }. each do |a| %>
|
308
|
+
<%=a['shortform']%>
|
309
|
+
~ <%=a['longform']%>
|
310
|
+
|
311
|
+
<% end %>
|
312
|
+
\onelinedeffalse
|
313
|
+
<% end %>
|
314
|
+
|
315
|
+
|
283
316
|
# Colophon
|
284
317
|
|
285
318
|
This document was typeset in NotoSans with \LuaTeX\.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -178,6 +178,7 @@ files:
|
|
178
178
|
- schemas/v1.0.2/component.yaml
|
179
179
|
- schemas/v1.0.2/config.yaml
|
180
180
|
- schemas/v1.0.2/standard.yaml
|
181
|
+
- templates/glossary.erb
|
181
182
|
- templates/ssp.erb
|
182
183
|
homepage: https://github.com/jumanjiman/octool
|
183
184
|
licenses:
|