isodoc 1.6.0 → 1.6.5
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/.github/workflows/rake.yml +2 -12
- data/.hound.yml +3 -1
- data/.rubocop.yml +4 -8
- data/Rakefile +2 -2
- data/bin/rspec +1 -2
- data/isodoc.gemspec +4 -3
- data/lib/isodoc-yaml/i18n-ar.yaml +152 -0
- data/lib/isodoc-yaml/i18n-de.yaml +149 -0
- data/lib/isodoc-yaml/i18n-en.yaml +1 -0
- data/lib/isodoc-yaml/i18n-es.yaml +151 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +154 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
- data/lib/isodoc.rb +0 -2
- data/lib/isodoc/common.rb +2 -0
- data/lib/isodoc/convert.rb +10 -4
- data/lib/isodoc/css.rb +30 -26
- data/lib/isodoc/function/blocks.rb +26 -8
- data/lib/isodoc/function/blocks_example_note.rb +2 -2
- data/lib/isodoc/function/cleanup.rb +53 -45
- data/lib/isodoc/function/form.rb +51 -0
- data/lib/isodoc/function/inline.rb +8 -7
- data/lib/isodoc/function/references.rb +71 -77
- data/lib/isodoc/function/section.rb +28 -16
- data/lib/isodoc/function/table.rb +22 -22
- data/lib/isodoc/function/terms.rb +6 -7
- data/lib/isodoc/function/to_word_html.rb +19 -25
- data/lib/isodoc/function/utils.rb +180 -160
- data/lib/isodoc/gem_tasks.rb +36 -38
- data/lib/isodoc/headlesshtml_convert.rb +8 -7
- data/lib/isodoc/html_convert.rb +10 -4
- data/lib/isodoc/html_function/comments.rb +14 -12
- data/lib/isodoc/html_function/footnotes.rb +14 -7
- data/lib/isodoc/html_function/form.rb +62 -0
- data/lib/isodoc/html_function/html.rb +30 -26
- data/lib/isodoc/html_function/postprocess.rb +191 -226
- data/lib/isodoc/html_function/postprocess_footnotes.rb +59 -0
- data/lib/isodoc/html_function/sectionsplit.rb +230 -0
- data/lib/isodoc/i18n.rb +33 -31
- data/lib/isodoc/metadata.rb +22 -20
- data/lib/isodoc/metadata_contributor.rb +31 -28
- data/lib/isodoc/pdf_convert.rb +11 -13
- data/lib/isodoc/presentation_function/bibdata.rb +54 -30
- data/lib/isodoc/presentation_function/block.rb +17 -8
- data/lib/isodoc/presentation_function/inline.rb +72 -120
- data/lib/isodoc/presentation_function/math.rb +84 -0
- data/lib/isodoc/presentation_function/section.rb +55 -19
- data/lib/isodoc/presentation_xml_convert.rb +2 -0
- data/lib/isodoc/sassc_importer.rb +1 -1
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +28 -24
- data/lib/isodoc/word_function/footnotes.rb +22 -15
- data/lib/isodoc/word_function/postprocess.rb +50 -36
- data/lib/isodoc/xref.rb +11 -10
- data/lib/isodoc/xref/xref_counter.rb +32 -17
- data/lib/isodoc/xref/xref_gen.rb +33 -21
- data/lib/isodoc/xref/xref_gen_seq.rb +60 -35
- data/lib/isodoc/xref/xref_sect_gen.rb +37 -35
- data/spec/assets/scripts_override.html +3 -0
- data/spec/isodoc/blocks_spec.rb +2258 -2622
- data/spec/isodoc/cleanup_spec.rb +1103 -1107
- data/spec/isodoc/form_spec.rb +156 -0
- data/spec/isodoc/i18n_spec.rb +802 -917
- data/spec/isodoc/inline_spec.rb +1105 -921
- data/spec/isodoc/lists_spec.rb +316 -315
- data/spec/isodoc/metadata_spec.rb +384 -379
- data/spec/isodoc/postproc_spec.rb +1783 -1549
- data/spec/isodoc/presentation_xml_spec.rb +355 -278
- data/spec/isodoc/ref_spec.rb +718 -723
- data/spec/isodoc/section_spec.rb +216 -199
- data/spec/isodoc/sectionsplit_spec.rb +190 -0
- data/spec/isodoc/table_spec.rb +41 -42
- data/spec/isodoc/terms_spec.rb +84 -84
- data/spec/isodoc/xref_spec.rb +1024 -930
- metadata +33 -7
@@ -0,0 +1,154 @@
|
|
1
|
+
term_def_boilerplate:
|
2
|
+
scope: Сфера применения
|
3
|
+
symbolsabbrev: Символы и сокращенные термины
|
4
|
+
abbrev: Сокращенные термины
|
5
|
+
symbols: Символы
|
6
|
+
table_of_contents: Содержание
|
7
|
+
introduction: Введение
|
8
|
+
foreword: Предисловие
|
9
|
+
abstract: Реферат
|
10
|
+
acknowledgements: Подтверждения
|
11
|
+
termsdef: Термины и определения
|
12
|
+
termsdefsymbolsabbrev: Термины, определения, символы и сокращенные термины
|
13
|
+
termsdefsymbols: Термины, определения и символы
|
14
|
+
termsdefabbrev: Термины, определения и сокращенные термины
|
15
|
+
normref: Нормативные ссылки
|
16
|
+
bibliography: Библиография
|
17
|
+
clause: Пункт
|
18
|
+
annex: Дополнение
|
19
|
+
appendix: Приложение
|
20
|
+
no_terms_boilerplate: |
|
21
|
+
<p>Термины и определения не перечислены в этом документе.</p>
|
22
|
+
internal_terms_boilerplate: |
|
23
|
+
<p>Для целей этого документа
|
24
|
+
применяются следующие термины и определения.</p>
|
25
|
+
norm_with_refs_pref:
|
26
|
+
Следующие документы упоминаются в тексте таким образом,
|
27
|
+
что некоторая часть или все их содержание являются требованиями
|
28
|
+
настоящего документа. Для датированных ссылок применяют только указанное издание.
|
29
|
+
Для недатированных ссылок применяют последнее издание
|
30
|
+
указанного документа (включая любые поправки).
|
31
|
+
norm_empty_pref:
|
32
|
+
Нет нормативных ссылок в этом документе.
|
33
|
+
external_terms_boilerplate: |
|
34
|
+
<p>Для целей этого документа применяются
|
35
|
+
термины и определения, данные в %.</p>
|
36
|
+
internal_external_terms_boilerplate: |
|
37
|
+
<p>Для целей этого документа применяются
|
38
|
+
термины и определения, данные в % и следующие.</p>
|
39
|
+
term_defined_in: "[термин, определенный в %]"
|
40
|
+
note: ПРИМЕЧАНИЕ
|
41
|
+
note_xref: Примечание
|
42
|
+
termnote: Примечание % к определению
|
43
|
+
list: Список
|
44
|
+
figure: Рисунок
|
45
|
+
formula: Формула
|
46
|
+
inequality: Формула
|
47
|
+
table: Таблица
|
48
|
+
requirement: Требование
|
49
|
+
recommendation: Рекомендация
|
50
|
+
permission: Разрешение
|
51
|
+
key: Условные обозначения
|
52
|
+
example: ПРИМЕР
|
53
|
+
example_xref: Пример
|
54
|
+
where: где
|
55
|
+
wholeoftext: Текст полностью
|
56
|
+
draft_label: проект
|
57
|
+
inform_annex: информативное
|
58
|
+
norm_annex: нормативное
|
59
|
+
modified: изменен
|
60
|
+
deprecated: НЕ РЕКОМЕНДУЕТСЯ
|
61
|
+
source: ИСТОЧНИК
|
62
|
+
and: и
|
63
|
+
all_parts: Все части
|
64
|
+
month_january: Январь
|
65
|
+
month_february: Февраль
|
66
|
+
month_march: Март
|
67
|
+
month_april: Апрель
|
68
|
+
month_may: Май
|
69
|
+
month_june: Июнь
|
70
|
+
month_july: Июль
|
71
|
+
month_august: Август
|
72
|
+
month_september: Сентябрь
|
73
|
+
month_october: Октябрь
|
74
|
+
month_november: Ноябрь
|
75
|
+
month_december: Декабрь
|
76
|
+
obligation: Обязательство
|
77
|
+
subject: Тема
|
78
|
+
inherits: Наследует
|
79
|
+
admonition: {
|
80
|
+
danger: Опасность,
|
81
|
+
warning: Предупреждение,
|
82
|
+
caution: Предостережение,
|
83
|
+
important: Важно,
|
84
|
+
safety precautions: Меры безопасности
|
85
|
+
}
|
86
|
+
locality: {
|
87
|
+
section: Раздел,
|
88
|
+
clause: Пункт,
|
89
|
+
part: Часть,
|
90
|
+
paragraph: Абзац,
|
91
|
+
chapter: Глава,
|
92
|
+
page: Стр.,
|
93
|
+
table: Таблица,
|
94
|
+
annex: Дополнение,
|
95
|
+
figure: Рисунок,
|
96
|
+
example: Пример,
|
97
|
+
note: Примечание,
|
98
|
+
formula: Формула
|
99
|
+
}
|
100
|
+
inflection:
|
101
|
+
Пункт:
|
102
|
+
sg: Пункт
|
103
|
+
pl: Пункты
|
104
|
+
Дополнение:
|
105
|
+
sg: Дополнение
|
106
|
+
pl: Дополнения
|
107
|
+
Приложение:
|
108
|
+
sg: Приложение
|
109
|
+
pl: Приложения
|
110
|
+
Примечание:
|
111
|
+
sg: Примечание
|
112
|
+
pl: Примечания
|
113
|
+
"Примечание % к записи":
|
114
|
+
sg: Примечание % к записи
|
115
|
+
pl: Примечания % к записи
|
116
|
+
Список:
|
117
|
+
sg: Список
|
118
|
+
pl: Списки
|
119
|
+
Рисунок:
|
120
|
+
sg: Рисунок
|
121
|
+
pl: Рисунки
|
122
|
+
Формула:
|
123
|
+
sg: Формула
|
124
|
+
pl: Формулы
|
125
|
+
Таблица:
|
126
|
+
sg: Таблица
|
127
|
+
pl: Таблицы
|
128
|
+
Требование:
|
129
|
+
sg: Требование
|
130
|
+
pl: Требования
|
131
|
+
Рекомендация:
|
132
|
+
sg: Рекомендация
|
133
|
+
pl: Рекомендации
|
134
|
+
Разрешение:
|
135
|
+
sg: Разрешение
|
136
|
+
pl: Разрешения
|
137
|
+
Пример:
|
138
|
+
sg: Пример
|
139
|
+
pl: Примеры
|
140
|
+
Часть:
|
141
|
+
sg: Часть
|
142
|
+
pl: Части
|
143
|
+
Раздел:
|
144
|
+
sg: Раздел
|
145
|
+
pl: Разделы
|
146
|
+
Абзац:
|
147
|
+
sg: Абзац
|
148
|
+
pl: Абзацы
|
149
|
+
Глава:
|
150
|
+
sg: Глава
|
151
|
+
pl: Главы
|
152
|
+
"Стр.":
|
153
|
+
sg: Стр.
|
154
|
+
pl: Стр.
|
data/lib/isodoc.rb
CHANGED
@@ -8,7 +8,6 @@ require "mime/types"
|
|
8
8
|
require "image_size"
|
9
9
|
require "set"
|
10
10
|
require "pp"
|
11
|
-
require "uuidtools"
|
12
11
|
require "html2doc"
|
13
12
|
require "liquid"
|
14
13
|
require "htmlentities"
|
@@ -26,5 +25,4 @@ require "isodoc/xref"
|
|
26
25
|
require "isodoc/i18n"
|
27
26
|
|
28
27
|
module IsoDoc
|
29
|
-
|
30
28
|
end
|
data/lib/isodoc/common.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative "./function/blocks"
|
2
2
|
require_relative "./function/cleanup"
|
3
|
+
require_relative "./function/form"
|
3
4
|
require_relative "./function/inline"
|
4
5
|
require_relative "./function/lists"
|
5
6
|
require_relative "./function/references"
|
@@ -15,6 +16,7 @@ module IsoDoc
|
|
15
16
|
class Common
|
16
17
|
include Function::Blocks
|
17
18
|
include Function::Cleanup
|
19
|
+
include Function::Form
|
18
20
|
include Function::Inline
|
19
21
|
include Function::Lists
|
20
22
|
include Function::References
|
data/lib/isodoc/convert.rb
CHANGED
@@ -8,7 +8,7 @@ require_relative "css"
|
|
8
8
|
|
9
9
|
module IsoDoc
|
10
10
|
class Convert < ::IsoDoc::Common
|
11
|
-
attr_accessor :options, :i18n, :meta
|
11
|
+
attr_accessor :options, :i18n, :meta, :xrefs
|
12
12
|
|
13
13
|
# htmlstylesheet: Generic stylesheet for HTML
|
14
14
|
# htmlstylesheet_override: Override stylesheet for HTML
|
@@ -32,10 +32,13 @@ module IsoDoc
|
|
32
32
|
# monospace: font to use for monospace text
|
33
33
|
# suppressheadingnumbers: suppress heading numbers for clauses
|
34
34
|
# scripts: Scripts file for HTML
|
35
|
+
# scripts_override: Override scripts file for HTML
|
35
36
|
# scripts_pdf: Scripts file for PDF (not used in XSLT PDF)
|
36
37
|
# datauriimage: Encode images in HTML output as data URIs
|
37
38
|
# break_up_urls_in_tables: whether to insert spaces in URLs in tables
|
38
39
|
# every 40-odd chars
|
40
|
+
# sectionsplit: split up HTML output on sections
|
41
|
+
# bare: do not insert any prefatory material (coverpage, boilerplate)
|
39
42
|
def initialize(options)
|
40
43
|
@libdir ||= File.dirname(__FILE__) # rubocop:disable Lint/DisjunctiveAssignmentInConstructor
|
41
44
|
options.merge!(default_fonts(options)) do |_, old, new|
|
@@ -64,12 +67,15 @@ module IsoDoc
|
|
64
67
|
@scripts = options[:scripts] ||
|
65
68
|
File.join(File.dirname(__FILE__), "base_style", "scripts.html")
|
66
69
|
@scripts_pdf = options[:scripts_pdf]
|
70
|
+
@scripts_override = options[:scripts_override]
|
67
71
|
@i18nyaml = options[:i18nyaml]
|
68
72
|
@ulstyle = options[:ulstyle]
|
69
73
|
@olstyle = options[:olstyle]
|
70
74
|
@datauriimage = options[:datauriimage]
|
71
75
|
@suppressheadingnumbers = options[:suppressheadingnumbers]
|
72
76
|
@break_up_urls_in_tables = options[:break_up_urls_in_tables] == "true"
|
77
|
+
@sectionsplit = options[:sectionsplit] == "true"
|
78
|
+
@bare = options[:bare]
|
73
79
|
@termdomain = ""
|
74
80
|
@termexample = false
|
75
81
|
@note = false
|
@@ -150,7 +156,7 @@ module IsoDoc
|
|
150
156
|
[docxml, filename, dir]
|
151
157
|
end
|
152
158
|
|
153
|
-
def convert(input_filename, file = nil, debug = false,
|
159
|
+
def convert(input_filename, file = nil, debug = false,
|
154
160
|
output_filename = nil)
|
155
161
|
file = File.read(input_filename, encoding: "utf-8") if file.nil?
|
156
162
|
@openmathdelim, @closemathdelim = extract_delims(file)
|
@@ -163,9 +169,9 @@ module IsoDoc
|
|
163
169
|
FileUtils.rm_rf dir
|
164
170
|
end
|
165
171
|
|
166
|
-
def middle_clause(
|
172
|
+
def middle_clause(_docxml = nil)
|
167
173
|
"//clause[parent::sections][not(@type = 'scope')]"\
|
168
|
-
|
174
|
+
"[not(descendant::terms)]"
|
169
175
|
end
|
170
176
|
|
171
177
|
def target_pdf(node)
|
data/lib/isodoc/css.rb
CHANGED
@@ -6,17 +6,20 @@ module IsoDoc
|
|
6
6
|
def precompiled_style_or_original(stylesheet_path)
|
7
7
|
# Already have compiled stylesheet, use it
|
8
8
|
return stylesheet_path if stylesheet_path.nil? ||
|
9
|
-
File.extname(stylesheet_path) ==
|
10
|
-
|
9
|
+
File.extname(stylesheet_path) == ".css"
|
10
|
+
|
11
|
+
basename = File.basename(stylesheet_path, ".*")
|
11
12
|
compiled_path = File.join(File.dirname(stylesheet_path),
|
12
13
|
"#{basename}.css")
|
13
14
|
return stylesheet_path unless File.file?(compiled_path)
|
15
|
+
|
14
16
|
compiled_path
|
15
17
|
end
|
16
18
|
|
17
19
|
def localpath(path)
|
18
|
-
return path if %r{^[A-Z]:|^/|^file:/}.match(path)
|
20
|
+
return path if %r{^[A-Z]:|^/|^file:/}.match?(path)
|
19
21
|
return path unless (@sourcedir || @localdir) && path
|
22
|
+
|
20
23
|
File.expand_path(File.join((@sourcedir || @localdir), path))
|
21
24
|
end
|
22
25
|
|
@@ -34,9 +37,9 @@ module IsoDoc
|
|
34
37
|
|
35
38
|
def default_fonts(_options)
|
36
39
|
{
|
37
|
-
bodyfont:
|
38
|
-
headerfont:
|
39
|
-
monospacefont:
|
40
|
+
bodyfont: "Arial",
|
41
|
+
headerfont: "Arial",
|
42
|
+
monospacefont: "Courier",
|
40
43
|
}
|
41
44
|
end
|
42
45
|
|
@@ -48,35 +51,35 @@ module IsoDoc
|
|
48
51
|
|
49
52
|
def fonts_options
|
50
53
|
{
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
+
"bodyfont" => options[:bodyfont] || "Arial",
|
55
|
+
"headerfont" => options[:headerfont] || "Arial",
|
56
|
+
"monospacefont" => options[:monospacefont] || "Courier",
|
54
57
|
"normalfontsize" => options[:normalfontsize],
|
55
58
|
"monospacefontsize" => options[:monospacefontsize],
|
56
59
|
"smallerfontsize" => options[:smallerfontsize],
|
57
|
-
"footnotefontsize" => options[:footnotefontsize]
|
60
|
+
"footnotefontsize" => options[:footnotefontsize],
|
58
61
|
}
|
59
62
|
end
|
60
63
|
|
61
64
|
def scss_fontheader(is_html_css)
|
62
|
-
b = options[:bodyfont] ||
|
63
|
-
h = options[:headerfont] ||
|
64
|
-
m = options[:monospacefont] ||
|
65
|
-
ns = options[:normalfontsize] || (is_html_css ? "1.0em" :
|
66
|
-
ms = options[:monospacefontsize] || (is_html_css ? "0.8em" :
|
67
|
-
ss = options[:smallerfontsize] || (is_html_css ? "0.9em" :
|
68
|
-
fs = options[:footnotefontsize] || (is_html_css ? "0.9em" :
|
65
|
+
b = options[:bodyfont] || "Arial"
|
66
|
+
h = options[:headerfont] || "Arial"
|
67
|
+
m = options[:monospacefont] || "Courier"
|
68
|
+
ns = options[:normalfontsize] || (is_html_css ? "1.0em" : "12.0pt")
|
69
|
+
ms = options[:monospacefontsize] || (is_html_css ? "0.8em" : "11.0pt")
|
70
|
+
ss = options[:smallerfontsize] || (is_html_css ? "0.9em" : "10.0pt")
|
71
|
+
fs = options[:footnotefontsize] || (is_html_css ? "0.9em" : "9.0pt")
|
69
72
|
"$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"\
|
70
73
|
"$normalfontsize: #{ns};\n$monospacefontsize: #{ms};\n"\
|
71
74
|
"$smallerfontsize: #{ss};\n$footnotefontsize: #{fs};\n"
|
72
75
|
end
|
73
76
|
|
74
77
|
def convert_scss(filename, stylesheet, stripwordcss)
|
75
|
-
require
|
76
|
-
require
|
78
|
+
require "sassc"
|
79
|
+
require "isodoc/sassc_importer"
|
77
80
|
|
78
|
-
[File.join(Gem.loaded_specs[
|
79
|
-
|
81
|
+
[File.join(Gem.loaded_specs["isodoc"].full_gem_path,
|
82
|
+
"lib", "isodoc"),
|
80
83
|
File.dirname(filename)].each do |name|
|
81
84
|
SassC.load_paths << name
|
82
85
|
end
|
@@ -88,15 +91,16 @@ module IsoDoc
|
|
88
91
|
# stripwordcss if HTML stylesheet, !stripwordcss if DOC stylesheet
|
89
92
|
def generate_css(filename, stripwordcss)
|
90
93
|
return nil if filename.nil?
|
94
|
+
|
91
95
|
filename = precompiled_style_or_original(filename)
|
92
|
-
stylesheet = File.read(filename, encoding:
|
96
|
+
stylesheet = File.read(filename, encoding: "UTF-8")
|
93
97
|
stylesheet = populate_template(stylesheet, :word)
|
94
|
-
stylesheet.gsub!(/(\s|\{)mso-[^:]+:[^;]+;/m,
|
95
|
-
if File.extname(filename) ==
|
98
|
+
stylesheet.gsub!(/(\s|\{)mso-[^:]+:[^;]+;/m, "\\1") if stripwordcss
|
99
|
+
if File.extname(filename) == ".scss"
|
96
100
|
stylesheet = convert_scss(filename, stylesheet, stripwordcss)
|
97
101
|
end
|
98
|
-
Tempfile.open([File.basename(filename,
|
99
|
-
encoding:
|
102
|
+
Tempfile.open([File.basename(filename, ".*"), "css"],
|
103
|
+
encoding: "utf-8") do |f|
|
100
104
|
f.write(stylesheet)
|
101
105
|
f
|
102
106
|
end
|
@@ -4,10 +4,21 @@ module IsoDoc::Function
|
|
4
4
|
module Blocks
|
5
5
|
@annotation = false
|
6
6
|
|
7
|
-
def
|
8
|
-
|
7
|
+
def middle_title(_isoxml, out)
|
8
|
+
out.p(**{ class: "zzSTDTitle1" }) { |p| p << @meta.get[:doctitle] }
|
9
|
+
end
|
10
|
+
|
11
|
+
def middle_admonitions(isoxml, out)
|
12
|
+
isoxml.xpath(ns("//sections/note | //sections/admonition")).each do |x|
|
13
|
+
parse(x, out)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def figure_name_parse(_node, div, name)
|
18
|
+
return if name.nil?
|
19
|
+
|
9
20
|
div.p **{ class: "FigureTitle", style: "text-align:center;" } do |p|
|
10
|
-
name.children.each { |n| parse(n,
|
21
|
+
name.children.each { |n| parse(n, p) }
|
11
22
|
end
|
12
23
|
end
|
13
24
|
|
@@ -24,6 +35,7 @@ module IsoDoc::Function
|
|
24
35
|
def figure_parse(node, out)
|
25
36
|
return pseudocode_parse(node, out) if node["class"] == "pseudocode" ||
|
26
37
|
node["type"] == "pseudocode"
|
38
|
+
|
27
39
|
@in_figure = true
|
28
40
|
out.div **figure_attrs(node) do |div|
|
29
41
|
node.children.each do |n|
|
@@ -50,7 +62,8 @@ module IsoDoc::Function
|
|
50
62
|
end
|
51
63
|
|
52
64
|
def sourcecode_name_parse(node, div, name)
|
53
|
-
return if name.nil?
|
65
|
+
return if name.nil?
|
66
|
+
|
54
67
|
div.p **{ class: "SourceTitle", style: "text-align:center;" } do |p|
|
55
68
|
name.children.each { |n| parse(n, p) }
|
56
69
|
end
|
@@ -91,14 +104,15 @@ module IsoDoc::Function
|
|
91
104
|
@annotation = false
|
92
105
|
end
|
93
106
|
|
94
|
-
def admonition_class(
|
107
|
+
def admonition_class(_node)
|
95
108
|
"Admonition"
|
96
109
|
end
|
97
110
|
|
98
111
|
def admonition_name(node, type)
|
99
112
|
name = node&.at(ns("./name")) and return name
|
100
|
-
name = Nokogiri::XML::Node.new(
|
113
|
+
name = Nokogiri::XML::Node.new("name", node.document)
|
101
114
|
return unless type && @i18n.admonition[type]
|
115
|
+
|
102
116
|
name << @i18n.admonition[type]&.upcase
|
103
117
|
name
|
104
118
|
end
|
@@ -119,7 +133,8 @@ module IsoDoc::Function
|
|
119
133
|
|
120
134
|
def formula_where(dl, out)
|
121
135
|
return unless dl
|
122
|
-
|
136
|
+
|
137
|
+
out.p **{ style: "page-break-after:avoid;" } do |p|
|
123
138
|
p << @i18n.where
|
124
139
|
end
|
125
140
|
parse(dl, out)
|
@@ -148,6 +163,7 @@ module IsoDoc::Function
|
|
148
163
|
formula_where(node.at(ns("./dl")), div)
|
149
164
|
node.children.each do |n|
|
150
165
|
next if %w(stem dl name).include? n.name
|
166
|
+
|
151
167
|
parse(n, div)
|
152
168
|
end
|
153
169
|
end
|
@@ -182,6 +198,7 @@ module IsoDoc::Function
|
|
182
198
|
author = node.at(ns("./author"))
|
183
199
|
source = node.at(ns("./source"))
|
184
200
|
return if author.nil? && source.nil?
|
201
|
+
|
185
202
|
out.p **{ class: "QuoteAttribution" } do |p|
|
186
203
|
p << "— #{author.text}" if author
|
187
204
|
p << ", " if author && source
|
@@ -201,8 +218,9 @@ module IsoDoc::Function
|
|
201
218
|
end
|
202
219
|
|
203
220
|
def passthrough_parse(node, out)
|
204
|
-
return if node["format"]
|
221
|
+
return if node["format"] &&
|
205
222
|
!(node["format"].split(/,/).include? @format.to_s)
|
223
|
+
|
206
224
|
out.passthrough node.text
|
207
225
|
end
|
208
226
|
|