isodoc 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +34 -0
- data/.github/workflows/ubuntu.yml +34 -0
- data/.github/workflows/windows.yml +37 -0
- data/Gemfile.lock +19 -21
- data/README.adoc +4 -3
- data/lib/isodoc/base_style/all.scss +6 -0
- data/lib/isodoc/base_style/bands.scss +76 -0
- data/lib/isodoc/base_style/blocks.scss +108 -0
- data/lib/isodoc/base_style/coverpage.scss +7 -0
- data/lib/isodoc/base_style/defaults.scss +26 -0
- data/lib/isodoc/base_style/nav.scss +180 -0
- data/lib/isodoc/base_style/reset.scss +98 -0
- data/lib/isodoc/base_style/typography.scss +89 -0
- data/lib/isodoc/class_utils.rb +2 -2
- data/lib/isodoc/convert.rb +3 -0
- data/lib/isodoc/function/blocks.rb +17 -13
- data/lib/isodoc/function/references.rb +25 -26
- data/lib/isodoc/function/utils.rb +12 -8
- data/lib/isodoc/function/xref_sect_gen.rb +2 -2
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +3 -2
- data/spec/isodoc/blocks_spec.rb +4 -2
- data/spec/isodoc/postproc_spec.rb +1 -1
- data/spec/isodoc/ref_spec.rb +12 -0
- data/spec/isodoc/section_spec.rb +2 -0
- data/spec/isodoc/table_spec.rb +14 -1
- metadata +13 -4
- data/.travis.yml +0 -22
- data/appveyor.yml +0 -37
@@ -0,0 +1,180 @@
|
|
1
|
+
@import 'defaults';
|
2
|
+
|
3
|
+
@mixin toc($colorLink, $colorLinkActiveBg, $colorLinkActiveFg) {
|
4
|
+
ul {
|
5
|
+
margin: 0;
|
6
|
+
padding: 0;
|
7
|
+
list-style: none;
|
8
|
+
|
9
|
+
li a {
|
10
|
+
padding: 5px 10px;
|
11
|
+
}
|
12
|
+
|
13
|
+
a {
|
14
|
+
color: $colorLink;
|
15
|
+
text-decoration: none;
|
16
|
+
display: block;
|
17
|
+
|
18
|
+
&:hover {
|
19
|
+
box-shadow: none;
|
20
|
+
color: $colorLinkActiveFg;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
.h2 {
|
26
|
+
padding-left: 30px;
|
27
|
+
}
|
28
|
+
|
29
|
+
.h3 {
|
30
|
+
padding-left: 50px;
|
31
|
+
}
|
32
|
+
|
33
|
+
.toc-active, li:hover {
|
34
|
+
background: $colorLinkActiveBg;
|
35
|
+
box-shadow: inset -5px 0px 10px -5px $colorLinkActiveBg !important;
|
36
|
+
|
37
|
+
a {
|
38
|
+
color: $colorLinkActiveFg;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
@media print {
|
43
|
+
.toc-active, li:hover {
|
44
|
+
background: white;
|
45
|
+
box-shadow: none !important;
|
46
|
+
}
|
47
|
+
|
48
|
+
.toc-active a {
|
49
|
+
color: $colorLink;
|
50
|
+
}
|
51
|
+
|
52
|
+
li:hover a {
|
53
|
+
color: black;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
@mixin sidebarNavContainer($offset) {
|
59
|
+
// Expected to be applied to body.
|
60
|
+
|
61
|
+
@media screen and (min-width: $bigscreenBreakpoint) {
|
62
|
+
padding-left: $offset;
|
63
|
+
}
|
64
|
+
|
65
|
+
@media print {
|
66
|
+
padding-left: 0;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
@mixin sidebarToc($font: $bodyfont, $fontWeight: 400) {
|
71
|
+
font-family: $font;
|
72
|
+
font-weight: $fontWeight;
|
73
|
+
|
74
|
+
@media screen and (max-width: $bigscreenBreakpoint) {
|
75
|
+
padding: 0 1.5em;
|
76
|
+
overflow: visible;
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
@mixin sidebarNav(
|
81
|
+
$colorBg,
|
82
|
+
$width,
|
83
|
+
$offsetLeft,
|
84
|
+
$lineHeight: null) {
|
85
|
+
|
86
|
+
@media screen and (min-width: $bigscreenBreakpoint) {
|
87
|
+
position: fixed;
|
88
|
+
top: 0;
|
89
|
+
bottom: 0;
|
90
|
+
left: 0;
|
91
|
+
width: $width;
|
92
|
+
font-size: 0.9em;
|
93
|
+
overflow: auto;
|
94
|
+
padding: 0 0 0 $offsetLeft;
|
95
|
+
background-color: $colorBg;
|
96
|
+
|
97
|
+
@if $lineHeight != null {
|
98
|
+
line-height: $lineHeight;
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
@media print {
|
103
|
+
position: relative;
|
104
|
+
width: auto;
|
105
|
+
font-size: 0.9em;
|
106
|
+
overflow: auto;
|
107
|
+
padding: 0;
|
108
|
+
margin-right: 0;
|
109
|
+
background-color: white;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
@mixin sidebarNavToggle($colorFg: white, $colorBg: black) {
|
114
|
+
@media screen and (min-width: $bigscreenBreakpoint) {
|
115
|
+
position: fixed;
|
116
|
+
height: 100%;
|
117
|
+
width: 30px;
|
118
|
+
background-color: $colorBg;
|
119
|
+
color: $colorFg !important;
|
120
|
+
cursor: pointer;
|
121
|
+
z-index: 100;
|
122
|
+
|
123
|
+
span {
|
124
|
+
text-align: center;
|
125
|
+
width: 100%;
|
126
|
+
position: absolute;
|
127
|
+
top: 50%;
|
128
|
+
transform: translate(0, -50%);
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
@media screen and (max-width: $bigscreenBreakpoint) {
|
133
|
+
display: none;
|
134
|
+
}
|
135
|
+
|
136
|
+
@media print {
|
137
|
+
display: none;
|
138
|
+
}
|
139
|
+
}
|
140
|
+
|
141
|
+
@mixin tocSeparator {
|
142
|
+
@media screen and (min-width: $bigscreenBreakpoint) {
|
143
|
+
display: none;
|
144
|
+
}
|
145
|
+
}
|
146
|
+
|
147
|
+
@mixin toTopBtn($color, $colorBg) {
|
148
|
+
font-family: $monospacefont;
|
149
|
+
font-variant-ligatures: none;
|
150
|
+
display: none;
|
151
|
+
position: fixed;
|
152
|
+
bottom: 20px;
|
153
|
+
right: 30px;
|
154
|
+
z-index: 99;
|
155
|
+
font-size: 12px;
|
156
|
+
border: none;
|
157
|
+
outline: none;
|
158
|
+
background-color: $colorBg;
|
159
|
+
opacity: 0.15;
|
160
|
+
color: $color;
|
161
|
+
cursor: pointer;
|
162
|
+
padding: 10px 15px 10px 15px;
|
163
|
+
border-radius: 4px;
|
164
|
+
|
165
|
+
&:hover {
|
166
|
+
opacity: 1;
|
167
|
+
}
|
168
|
+
|
169
|
+
@media print {
|
170
|
+
display: none;
|
171
|
+
}
|
172
|
+
}
|
173
|
+
|
174
|
+
@mixin anchorLink($color) {
|
175
|
+
&:hover {
|
176
|
+
background: none;
|
177
|
+
color: $color;
|
178
|
+
box-shadow: none;
|
179
|
+
}
|
180
|
+
}
|
@@ -0,0 +1,98 @@
|
|
1
|
+
html, body, div, span, applet, object, iframe,
|
2
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
3
|
+
a, abbr, acronym, address, big, cite, code,
|
4
|
+
del, dfn, em, img, ins, kbd, q, s, samp,
|
5
|
+
small, strike, strong, sub, sup, tt, var,
|
6
|
+
b, u, i, center,
|
7
|
+
ol, ul, li,
|
8
|
+
fieldset, form, label, legend,
|
9
|
+
table, caption, tbody, tfoot, thead, tr, th, td,
|
10
|
+
article, aside, canvas, details, embed,
|
11
|
+
figure, figcaption, footer, header, hgroup,
|
12
|
+
menu, nav, output, ruby, section, summary,
|
13
|
+
time, mark, audio, video {
|
14
|
+
margin: 0;
|
15
|
+
padding: 0;
|
16
|
+
}
|
17
|
+
|
18
|
+
html, body, div, span, applet, object, iframe,
|
19
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
20
|
+
a, abbr, acronym, address, big, cite, code,
|
21
|
+
del, dfn, em, img, ins, kbd, q, s, samp,
|
22
|
+
small, strike, strong, sub, sup, tt, var,
|
23
|
+
b, u, i, center,
|
24
|
+
dl, dt, dd, ol, ul, li,
|
25
|
+
fieldset, form, label, legend,
|
26
|
+
table, caption, tbody, tfoot, thead, tr, th, td,
|
27
|
+
article, aside, canvas, details, embed,
|
28
|
+
figure, figcaption, footer, header, hgroup,
|
29
|
+
menu, nav, output, ruby, section, summary,
|
30
|
+
time, mark, audio, video {
|
31
|
+
border: 0;
|
32
|
+
font-size: 100%;
|
33
|
+
}
|
34
|
+
|
35
|
+
html, body, div, span, applet, object, iframe,
|
36
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
37
|
+
a, abbr, acronym, address, big, cite, code,
|
38
|
+
del, dfn, em, img, ins, kbd, q, s, samp,
|
39
|
+
small, strike, strong, tt, var,
|
40
|
+
b, u, i, center,
|
41
|
+
dl, dd, ol, ul, li,
|
42
|
+
fieldset, form, label, legend,
|
43
|
+
table, caption, tbody, tfoot, thead, tr, th, td,
|
44
|
+
article, aside, canvas, details, embed,
|
45
|
+
figure, figcaption, footer, header, hgroup,
|
46
|
+
menu, nav, output, ruby, section, summary,
|
47
|
+
time, mark, audio, video {
|
48
|
+
vertical-align: baseline;
|
49
|
+
}
|
50
|
+
|
51
|
+
html, body, div, span, applet, object, iframe,
|
52
|
+
p, blockquote,
|
53
|
+
a, abbr, acronym, address, big, cite,
|
54
|
+
del, dfn, em, img, ins, q, s,
|
55
|
+
small, strike, strong, sub, sup, var,
|
56
|
+
b, u, i, center,
|
57
|
+
dl, dt, dd, ol, ul, li,
|
58
|
+
fieldset, form, label, legend,
|
59
|
+
table, caption, tbody, tfoot, thead, tr, th, td,
|
60
|
+
article, aside, canvas, details, embed,
|
61
|
+
figure, figcaption, footer, header, hgroup,
|
62
|
+
menu, nav, output, ruby, section, summary,
|
63
|
+
time, mark, audio, video {
|
64
|
+
font-family: $bodyfont;
|
65
|
+
}
|
66
|
+
|
67
|
+
code, pre, tt, kbd, samp {
|
68
|
+
font-family: $monospacefont;
|
69
|
+
font-variant-ligatures: none;
|
70
|
+
}
|
71
|
+
|
72
|
+
code *, pre *, tt *, kbd *, samp * {
|
73
|
+
font-family: $monospacefont !important;
|
74
|
+
font-variant-ligatures: none;
|
75
|
+
}
|
76
|
+
|
77
|
+
article, aside, details, figcaption, figure,
|
78
|
+
footer, header, hgroup, menu, nav, section {
|
79
|
+
display: block;
|
80
|
+
}
|
81
|
+
|
82
|
+
table {
|
83
|
+
border-collapse: collapse;
|
84
|
+
border-spacing: 0;
|
85
|
+
}
|
86
|
+
|
87
|
+
h1, h2, h3, h4, h5, h6 {
|
88
|
+
font-family: $headerfont;
|
89
|
+
}
|
90
|
+
|
91
|
+
blockquote, q {
|
92
|
+
quotes: none;
|
93
|
+
|
94
|
+
&:before, &:after {
|
95
|
+
content: '';
|
96
|
+
content: none;
|
97
|
+
}
|
98
|
+
}
|
@@ -0,0 +1,89 @@
|
|
1
|
+
.h2Annex {
|
2
|
+
font-family: $headerfont;
|
3
|
+
}
|
4
|
+
|
5
|
+
dl {
|
6
|
+
display: grid;
|
7
|
+
grid-template-columns: max-content auto;
|
8
|
+
|
9
|
+
dt, dd {
|
10
|
+
p {
|
11
|
+
margin-top: 0;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
dt {
|
16
|
+
grid-column-start: 1;
|
17
|
+
}
|
18
|
+
|
19
|
+
dd {
|
20
|
+
grid-column-start: 2;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
@mixin bodyStyle1($fontSize, $lineHeight, $colorText, $colorBackground, $fontWeight: 400) {
|
25
|
+
margin-left: auto;
|
26
|
+
margin-right: auto;
|
27
|
+
max-width: 100%;
|
28
|
+
font-size: $fontSize;
|
29
|
+
font-weight: $fontWeight;
|
30
|
+
line-height: $lineHeight;
|
31
|
+
color: $colorText;
|
32
|
+
background-color: $colorBackground;
|
33
|
+
|
34
|
+
main {
|
35
|
+
margin: 0 3em 0 6em;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
@mixin elementStyles($color, $colorHighlightBg, $colorHighlightFg) {
|
40
|
+
a, a:visited {
|
41
|
+
text-decoration: none;
|
42
|
+
color: $color;
|
43
|
+
}
|
44
|
+
a:hover {
|
45
|
+
color: $colorHighlightFg;
|
46
|
+
background: $colorHighlightBg;
|
47
|
+
box-shadow: 3px 0 0 $colorHighlightBg, -3px 0 0 $colorHighlightBg;
|
48
|
+
}
|
49
|
+
::selection,
|
50
|
+
::-moz-selection {
|
51
|
+
background: $colorHighlightBg;
|
52
|
+
color: $colorHighlightFg;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
@mixin rule($thickness, $color, $margin: 2em 0, $clear: false) {
|
57
|
+
width: 100%;
|
58
|
+
height: $thickness;
|
59
|
+
background-color: $color;
|
60
|
+
|
61
|
+
@if $margin {
|
62
|
+
margin: $margin;
|
63
|
+
}
|
64
|
+
|
65
|
+
// Obsolete (?)
|
66
|
+
@if $clear {
|
67
|
+
clear: both;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
@mixin table($border: none) {
|
72
|
+
width: 100%;
|
73
|
+
font-weight: 300;
|
74
|
+
margin: 1em 0 2em 0;
|
75
|
+
margin-left: auto;
|
76
|
+
margin-right: auto;
|
77
|
+
padding-right: 2em;
|
78
|
+
|
79
|
+
&, th, td {
|
80
|
+
border: $border;
|
81
|
+
font-size: 0.95em;
|
82
|
+
}
|
83
|
+
th, td {
|
84
|
+
padding: 1em;
|
85
|
+
}
|
86
|
+
td.header {
|
87
|
+
font-weigth: 400;
|
88
|
+
}
|
89
|
+
}
|
data/lib/isodoc/class_utils.rb
CHANGED
@@ -20,8 +20,8 @@ module IsoDoc
|
|
20
20
|
|
21
21
|
def liquid(doc)
|
22
22
|
# unescape HTML escapes in doc
|
23
|
-
doc = doc.split(%r<(\{
|
24
|
-
a[2].gsub
|
23
|
+
doc = doc.split(%r<(\{%|%\})>).each_slice(4).map do |a|
|
24
|
+
a[2] = a[2].gsub("<", "<").gsub(">", ">") if a.size > 2
|
25
25
|
a.join("")
|
26
26
|
end.join("")
|
27
27
|
Liquid::Template.parse(doc)
|
data/lib/isodoc/convert.rb
CHANGED
@@ -125,6 +125,9 @@ module IsoDoc
|
|
125
125
|
stylesheet = File.read(filename, encoding: "UTF-8")
|
126
126
|
stylesheet = populate_template(stylesheet, :word)
|
127
127
|
stylesheet.gsub!(/(\s|\{)mso-[^:]+:[^;]+;/m, "\\1") if stripwordcss
|
128
|
+
SassC.load_paths << File.join(Gem.loaded_specs['isodoc'].full_gem_path,
|
129
|
+
"lib", "isodoc")
|
130
|
+
SassC.load_paths << File.dirname(filename)
|
128
131
|
engine = SassC::Engine.new(fontheader + stylesheet, syntax: :scss)
|
129
132
|
outname = File.basename(filename, ".*") + ".css"
|
130
133
|
File.open(outname, "w:UTF-8") { |f| f.write(engine.render) }
|
@@ -59,36 +59,37 @@ module IsoDoc::Function
|
|
59
59
|
|
60
60
|
def figure_parse(node, out)
|
61
61
|
@in_figure = true
|
62
|
-
name = node.at(ns("./name"))
|
63
62
|
out.div **attr_code(id: node["id"], class: "figure") do |div|
|
64
63
|
node.children.each do |n|
|
65
64
|
figure_key(out) if n.name == "dl"
|
66
65
|
parse(n, div) unless n.name == "name"
|
67
66
|
end
|
68
|
-
figure_name_parse(node, div, name)
|
67
|
+
figure_name_parse(node, div, node.at(ns("./name")))
|
69
68
|
end
|
70
69
|
@in_figure = false
|
71
70
|
end
|
72
71
|
|
73
|
-
def example_label(node)
|
72
|
+
def example_label(node, div, name)
|
74
73
|
n = get_anchors[node["id"]]
|
75
|
-
|
76
|
-
|
74
|
+
div.p **{ class: "example-title" } do |p|
|
75
|
+
lbl = (n.nil? || n[:label].nil? || n[:label].empty?) ? @example_lbl :
|
76
|
+
l10n("#{@example_lbl} #{n[:label]}")
|
77
|
+
p << lbl
|
78
|
+
name and !lbl.nil? and p << " — "
|
79
|
+
name and name.children.each { |n| parse(n, div) }
|
80
|
+
end
|
77
81
|
end
|
78
82
|
|
79
83
|
EXAMPLE_TBL_ATTR =
|
80
|
-
#{ valign: "top",
|
81
84
|
{ class: "example_label", style: "width:82.8pt;padding:0 0 0 0;\
|
82
85
|
margin-left:0pt;vertical-align:top;" }.freeze
|
83
86
|
|
84
87
|
# used if we are boxing examples
|
85
88
|
def example_div_parse(node, out)
|
86
89
|
out.div **attr_code(id: node["id"], class: "example") do |div|
|
87
|
-
div.
|
88
|
-
p << example_label(node)
|
89
|
-
end
|
90
|
+
example_label(node, div, node.at(ns("./name")))
|
90
91
|
node.children.each do |n|
|
91
|
-
parse(n, div)
|
92
|
+
parse(n, div) unless n.name == "name"
|
92
93
|
end
|
93
94
|
end
|
94
95
|
end
|
@@ -98,14 +99,17 @@ module IsoDoc::Function
|
|
98
99
|
style: "border-collapse:collapse;border-spacing:0;" )
|
99
100
|
end
|
100
101
|
|
102
|
+
EXAMPLE_TD_ATTR =
|
103
|
+
{ style: "vertical-align:top;padding:0;", class: "example" }.freeze
|
104
|
+
|
101
105
|
def example_table_parse(node, out)
|
102
106
|
out.table **example_table_attr(node) do |t|
|
103
107
|
t.tr do |tr|
|
104
108
|
tr.td **EXAMPLE_TBL_ATTR do |td|
|
105
|
-
td
|
109
|
+
example_label(node, td, node.at(ns("./name")))
|
106
110
|
end
|
107
|
-
tr.td **
|
108
|
-
node.children.each { |n| parse(n, td) }
|
111
|
+
tr.td **EXAMPLE_TD_ATTR do |td|
|
112
|
+
node.children.each { |n| parse(n, td) unless n.name == "name" }
|
109
113
|
end
|
110
114
|
end
|
111
115
|
end
|