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
data/lib/isodoc/gem_tasks.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
3
|
+
require "sassc"
|
4
|
+
require "isodoc/sassc_importer"
|
5
|
+
require "rake/clean"
|
6
6
|
|
7
7
|
module IsoDoc
|
8
8
|
module GemTasks
|
@@ -11,32 +11,30 @@ module IsoDoc
|
|
11
11
|
module_function
|
12
12
|
|
13
13
|
def install
|
14
|
-
rule
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
notify_borken_compilation(e, current_task)
|
20
|
-
end
|
14
|
+
rule ".css" => [proc { |tn| tn.sub(/\.css$/, ".scss") }] do |current_task|
|
15
|
+
puts(current_task)
|
16
|
+
compile_scss_task(current_task)
|
17
|
+
rescue StandardError => e
|
18
|
+
notify_borken_compilation(e, current_task)
|
21
19
|
end
|
22
20
|
|
23
|
-
scss_files = Rake::FileList[
|
24
|
-
source_files = scss_files.ext(
|
21
|
+
scss_files = Rake::FileList["lib/**/*.scss"]
|
22
|
+
source_files = scss_files.ext(".css")
|
25
23
|
|
26
24
|
task :comment_out_liquid do
|
27
25
|
process_css_files(scss_files) do |file_name|
|
28
|
-
comment_out_liquid(File.read(file_name, encoding:
|
26
|
+
comment_out_liquid(File.read(file_name, encoding: "UTF-8"))
|
29
27
|
end
|
30
28
|
end
|
31
29
|
|
32
30
|
task build_scss: [:comment_out_liquid].push(*source_files) do
|
33
31
|
process_css_files(scss_files) do |file_name|
|
34
|
-
uncomment_out_liquid(File.read(file_name, encoding:
|
32
|
+
uncomment_out_liquid(File.read(file_name, encoding: "UTF-8"))
|
35
33
|
end
|
36
|
-
git_cache_compiled_files && puts(
|
34
|
+
git_cache_compiled_files && puts("Built scss!")
|
37
35
|
end
|
38
36
|
|
39
|
-
Rake::Task[
|
37
|
+
Rake::Task["build"].enhance [:build_scss] do
|
40
38
|
git_rm_compiled_files
|
41
39
|
Rake::Task[:clean].invoke
|
42
40
|
end
|
@@ -44,7 +42,7 @@ module IsoDoc
|
|
44
42
|
|
45
43
|
def notify_borken_compilation(error, current_task)
|
46
44
|
puts("Cannot compile #{current_task} because of #{error.message}")
|
47
|
-
puts(
|
45
|
+
puts("continue anyway[y|n]?")
|
48
46
|
answer = STDIN.gets.strip
|
49
47
|
if %w[y yes].include?(answer.strip.downcase)
|
50
48
|
puts("Cannot compile #{current_task} because of #{error.message}")
|
@@ -68,7 +66,7 @@ module IsoDoc
|
|
68
66
|
def process_css_files(scss_files)
|
69
67
|
scss_files.each do |file_name|
|
70
68
|
result = yield(file_name)
|
71
|
-
File.open(file_name,
|
69
|
+
File.open(file_name, "w", encoding: "UTF-8") do |file|
|
72
70
|
file.puts(result)
|
73
71
|
end
|
74
72
|
end
|
@@ -81,54 +79,54 @@ module IsoDoc
|
|
81
79
|
else
|
82
80
|
line
|
83
81
|
end
|
84
|
-
end
|
85
|
-
.join("\n")
|
82
|
+
end.join("\n")
|
86
83
|
end
|
87
84
|
|
88
85
|
def uncomment_out_liquid(text)
|
89
86
|
text
|
90
|
-
.gsub(
|
91
|
-
.gsub(
|
92
|
-
.gsub('"{{',
|
87
|
+
.gsub("/* LIQUID_COMMENT", "")
|
88
|
+
.gsub("LIQUID_COMMENT */", "")
|
89
|
+
.gsub('"{{', "{{").gsub('}}"', "}}")
|
93
90
|
end
|
94
91
|
|
95
92
|
def fonts_placeholder
|
96
93
|
<<~TEXT
|
97
|
-
$bodyfont:
|
98
|
-
$headerfont:
|
99
|
-
$monospacefont:
|
100
|
-
$normalfontsize:
|
101
|
-
$smallerfontsize:
|
102
|
-
$footnotefontsize:
|
103
|
-
$monospacefontsize:
|
94
|
+
$bodyfont: "{{bodyfont}}";
|
95
|
+
$headerfont: "{{headerfont}}";
|
96
|
+
$monospacefont: "{{monospacefont}}";
|
97
|
+
$normalfontsize: "{{normalfontsize}}";
|
98
|
+
$smallerfontsize: "{{smallerfontsize}}";
|
99
|
+
$footnotefontsize: "{{footnotefontsize}}";
|
100
|
+
$monospacefontsize: "{{monospacefontsize}}";
|
104
101
|
TEXT
|
105
102
|
end
|
106
103
|
|
107
104
|
def compile_scss(filename)
|
108
|
-
require
|
105
|
+
require "sassc"
|
109
106
|
|
110
|
-
isodoc_path = if Gem.loaded_specs[
|
111
|
-
File.join(Gem.loaded_specs[
|
107
|
+
isodoc_path = if Gem.loaded_specs["isodoc"]
|
108
|
+
File.join(Gem.loaded_specs["isodoc"].full_gem_path,
|
109
|
+
"lib", "isodoc")
|
112
110
|
else
|
113
|
-
File.join(
|
111
|
+
File.join("lib", "isodoc")
|
114
112
|
end
|
115
113
|
[isodoc_path,
|
116
114
|
File.dirname(filename)].each do |name|
|
117
115
|
SassC.load_paths << name
|
118
116
|
end
|
119
|
-
sheet_content = File.read(filename, encoding:
|
117
|
+
sheet_content = File.read(filename, encoding: "UTF-8")
|
120
118
|
SassC::Engine.new(fonts_placeholder + sheet_content,
|
121
119
|
syntax: :scss,
|
122
120
|
importer: SasscImporter)
|
123
|
-
|
121
|
+
.render
|
124
122
|
end
|
125
123
|
|
126
124
|
def compile_scss_task(current_task)
|
127
125
|
filename = current_task.source
|
128
|
-
basename = File.basename(filename,
|
126
|
+
basename = File.basename(filename, ".*")
|
129
127
|
compiled_path = File.join(File.dirname(filename), "#{basename}.css")
|
130
128
|
content = uncomment_out_liquid(compile_scss(filename))
|
131
|
-
File.open(compiled_path,
|
129
|
+
File.open(compiled_path, "w:UTF-8") do |f|
|
132
130
|
f.write(content)
|
133
131
|
end
|
134
132
|
CLEAN << compiled_path
|
@@ -1,11 +1,10 @@
|
|
1
|
-
require_relative "html_function/comments
|
2
|
-
require_relative "html_function/footnotes
|
3
|
-
require_relative "html_function/html
|
1
|
+
require_relative "html_function/comments"
|
2
|
+
require_relative "html_function/footnotes"
|
3
|
+
require_relative "html_function/html"
|
4
4
|
require "fileutils"
|
5
5
|
|
6
6
|
module IsoDoc
|
7
7
|
class HeadlessHtmlConvert < ::IsoDoc::Convert
|
8
|
-
|
9
8
|
include HtmlFunction::Comments
|
10
9
|
include HtmlFunction::Footnotes
|
11
10
|
include HtmlFunction::Html
|
@@ -26,16 +25,18 @@ module IsoDoc
|
|
26
25
|
docxml, filename, dir = convert_init(file, input_filename, debug)
|
27
26
|
result = convert1(docxml, filename, dir)
|
28
27
|
return result if debug
|
29
|
-
|
28
|
+
|
29
|
+
postprocess(result, "#{filename}.tmp.html", dir)
|
30
30
|
FileUtils.rm_rf dir
|
31
|
-
strip_head(filename
|
31
|
+
strip_head("#{filename}.tmp.html",
|
32
|
+
output_filename || "#{filename}.#{@suffix}")
|
32
33
|
FileUtils.rm_rf ["#{filename}.tmp.html", tmpimagedir]
|
33
34
|
end
|
34
35
|
|
35
36
|
def strip_head(input, output)
|
36
37
|
file = File.read(input, encoding: "utf-8")
|
37
38
|
doc = Nokogiri::XML(file)
|
38
|
-
doc.xpath("//head").each
|
39
|
+
doc.xpath("//head").each(&:remove)
|
39
40
|
doc.xpath("//html").each { |x| x.name = "div" }
|
40
41
|
body = doc.at("//body")
|
41
42
|
body.replace(body.children)
|
data/lib/isodoc/html_convert.rb
CHANGED
@@ -1,13 +1,16 @@
|
|
1
|
-
require_relative "html_function/comments
|
2
|
-
require_relative "html_function/footnotes
|
3
|
-
require_relative "html_function/html
|
4
|
-
require_relative "html_function/postprocess
|
1
|
+
require_relative "html_function/comments"
|
2
|
+
require_relative "html_function/footnotes"
|
3
|
+
require_relative "html_function/html"
|
4
|
+
require_relative "html_function/postprocess"
|
5
|
+
require_relative "html_function/sectionsplit"
|
6
|
+
require_relative "html_function/form"
|
5
7
|
|
6
8
|
module IsoDoc
|
7
9
|
class HtmlConvert < ::IsoDoc::Convert
|
8
10
|
|
9
11
|
include HtmlFunction::Comments
|
10
12
|
include HtmlFunction::Footnotes
|
13
|
+
include HtmlFunction::Form
|
11
14
|
include HtmlFunction::Html
|
12
15
|
|
13
16
|
def tmpimagedir_suffix
|
@@ -21,6 +24,9 @@ module IsoDoc
|
|
21
24
|
end
|
22
25
|
|
23
26
|
def convert(filename, file = nil, debug = false, output_filename = nil)
|
27
|
+
@sectionsplit and
|
28
|
+
return sectionsplit_convert(filename, file, debug, output_filename)
|
29
|
+
|
24
30
|
ret = super
|
25
31
|
Dir.exists?(tmpimagedir) and Dir["#{tmpimagedir}/*"].empty? and
|
26
32
|
FileUtils.rm_r tmpimagedir
|
@@ -24,16 +24,16 @@ module IsoDoc::HtmlFunction
|
|
24
24
|
=end
|
25
25
|
end
|
26
26
|
|
27
|
-
def comment_link_attrs(
|
28
|
-
{ style: "MsoCommentReference", target:
|
27
|
+
def comment_link_attrs(fnote, node)
|
28
|
+
{ style: "MsoCommentReference", target: fnote,
|
29
29
|
class: "commentLink", from: node["from"],
|
30
30
|
to: node["to"] }
|
31
31
|
end
|
32
32
|
|
33
33
|
# add in from and to links to move the comment into place
|
34
|
-
def make_comment_link(out,
|
35
|
-
out.span(**comment_link_attrs(
|
36
|
-
s1.a **{ style: "mso-comment-reference:SMC_#{
|
34
|
+
def make_comment_link(out, fnote, node)
|
35
|
+
out.span(**comment_link_attrs(fnote, node)) do |s1|
|
36
|
+
s1.a **{ style: "mso-comment-reference:SMC_#{fnote};"\
|
37
37
|
"mso-comment-date:#{node['date'].gsub(/[-:Z]/, '')}" }
|
38
38
|
end
|
39
39
|
end
|
@@ -44,9 +44,9 @@ module IsoDoc::HtmlFunction
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
def make_comment_text(node,
|
47
|
+
def make_comment_text(node, fnote)
|
48
48
|
noko do |xml|
|
49
|
-
xml.div **{ style: "mso-element:comment", id:
|
49
|
+
xml.div **{ style: "mso-element:comment", id: fnote } do |div|
|
50
50
|
div.span **{ style: %{mso-comment-author:"#{node['reviewer']}"} }
|
51
51
|
make_comment_target(div)
|
52
52
|
node.children.each { |n| parse(n, div) }
|
@@ -84,6 +84,7 @@ module IsoDoc::HtmlFunction
|
|
84
84
|
def comment_attributes(docxml, x)
|
85
85
|
fromlink = docxml.at("//*[@id='#{x['from']}']")
|
86
86
|
return(nil) if fromlink.nil?
|
87
|
+
|
87
88
|
tolink = docxml.at("//*[@id='#{x['to']}']") || fromlink
|
88
89
|
target = docxml.at("//*[@id='#{x['target']}']")
|
89
90
|
{ from: fromlink, to: tolink, target: target }
|
@@ -98,13 +99,13 @@ module IsoDoc::HtmlFunction
|
|
98
99
|
from["style"] != "mso-special-character:comment"
|
99
100
|
end
|
100
101
|
|
101
|
-
def insert_comment_cont(from,
|
102
|
-
# includes_to = from.at(".//*[@id='#{
|
103
|
-
while !from.nil? && from["id"] !=
|
102
|
+
def insert_comment_cont(from, upto, target)
|
103
|
+
# includes_to = from.at(".//*[@id='#{upto}']")
|
104
|
+
while !from.nil? && from["id"] != upto
|
104
105
|
following = from.xpath("./following::*")
|
105
|
-
(from = following.shift) && incl_to = from.at(".//*[@id='#{
|
106
|
+
(from = following.shift) && incl_to = from.at(".//*[@id='#{upto}']")
|
106
107
|
while !incl_to.nil? && !from.nil? && skip_comment_wrap(from)
|
107
|
-
(from = following.shift) && incl_to = from.at(".//*[@id='#{
|
108
|
+
(from = following.shift) && incl_to = from.at(".//*[@id='#{upto}']")
|
108
109
|
end
|
109
110
|
wrap_comment_cont(from, target) if !from.nil?
|
110
111
|
end
|
@@ -122,6 +123,7 @@ module IsoDoc::HtmlFunction
|
|
122
123
|
comments = []
|
123
124
|
docxml.xpath("//div[@style='mso-element:comment']").each do |c|
|
124
125
|
next unless c["id"] && !link_order[c["id"]].nil?
|
126
|
+
|
125
127
|
comments << { text: c.remove.to_s, id: c["id"] }
|
126
128
|
end
|
127
129
|
comments.sort! { |a, b| link_order[a[:id]] <=> link_order[b[:id]] }
|
@@ -3,6 +3,7 @@ module IsoDoc::HtmlFunction
|
|
3
3
|
|
4
4
|
def footnotes(div)
|
5
5
|
return if @footnotes.empty?
|
6
|
+
|
6
7
|
@footnotes.each { |fn| div.parent << fn }
|
7
8
|
end
|
8
9
|
|
@@ -44,15 +45,19 @@ module IsoDoc::HtmlFunction
|
|
44
45
|
def get_table_ancestor_id(node)
|
45
46
|
table = node.ancestors("table") || node.ancestors("figure")
|
46
47
|
return UUIDTools::UUID.random_create.to_s if table.empty?
|
48
|
+
|
47
49
|
table.last["id"]
|
48
50
|
end
|
49
51
|
|
52
|
+
# @seen_footnote:
|
53
|
+
# do not output footnote text if we have already seen it for this table
|
54
|
+
|
50
55
|
def table_footnote_parse(node, out)
|
51
56
|
fn = node["reference"] || UUIDTools::UUID.random_create.to_s
|
52
57
|
tid = get_table_ancestor_id(node)
|
53
58
|
make_table_footnote_link(out, tid + fn, fn)
|
54
|
-
# do not output footnote text if we have already seen it for this table
|
55
59
|
return if @seen_footnote.include?(tid + fn)
|
60
|
+
|
56
61
|
@in_footnote = true
|
57
62
|
out.aside **{ class: "footnote" } do |a|
|
58
63
|
a << make_table_footnote_text(node, tid + fn, fn)
|
@@ -62,8 +67,9 @@ module IsoDoc::HtmlFunction
|
|
62
67
|
end
|
63
68
|
|
64
69
|
def footnote_parse(node, out)
|
65
|
-
|
66
|
-
!node.ancestors.map
|
70
|
+
return table_footnote_parse(node, out) if (@in_table || @in_figure) &&
|
71
|
+
!node.ancestors.map(&:name).include?("name")
|
72
|
+
|
67
73
|
fn = node["reference"] || UUIDTools::UUID.random_create.to_s
|
68
74
|
attrs = { class: "FootnoteRef", href: "#fn:#{fn}" }
|
69
75
|
out.a **attrs do |a|
|
@@ -72,12 +78,13 @@ module IsoDoc::HtmlFunction
|
|
72
78
|
make_footnote(node, fn)
|
73
79
|
end
|
74
80
|
|
75
|
-
def make_footnote(node,
|
76
|
-
return if @seen_footnote.include?(
|
81
|
+
def make_footnote(node, fnote)
|
82
|
+
return if @seen_footnote.include?(fnote)
|
83
|
+
|
77
84
|
@in_footnote = true
|
78
|
-
@footnotes << make_generic_footnote_text(node,
|
85
|
+
@footnotes << make_generic_footnote_text(node, fnote)
|
79
86
|
@in_footnote = false
|
80
|
-
@seen_footnote <<
|
87
|
+
@seen_footnote << fnote
|
81
88
|
end
|
82
89
|
end
|
83
90
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module IsoDoc::HtmlFunction
|
2
|
+
module Form
|
3
|
+
def form_parse(node, out)
|
4
|
+
out.form **attr_code(id: node["id"], name: node["name"],
|
5
|
+
action: node["action"]) do |div|
|
6
|
+
node.children.each do |n|
|
7
|
+
parse(n, div)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def input_parse(node, out)
|
13
|
+
out.input nil, **attr_code(
|
14
|
+
id: node["id"], name: node["name"], type: node["type"],
|
15
|
+
value: node["value"], disabled: node["disabled"],
|
16
|
+
readonly: node["readonly"], checked: node["checked"],
|
17
|
+
maxlength: node["maxlength"], minlength: node["minlength"]
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
def select_parse(node, out)
|
22
|
+
selected = node.at(ns("./option[@value = '#{node['value']}']"))
|
23
|
+
selected and selected["selected"] = true
|
24
|
+
out.select **attr_code(
|
25
|
+
id: node["id"], name: node["name"], size: node["size"],
|
26
|
+
disabled: node["disabled"], multiple: node["multiple"]
|
27
|
+
) do |div|
|
28
|
+
node.children.each do |n|
|
29
|
+
parse(n, div)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def label_parse(node, out)
|
35
|
+
out.label **attr_code(for: node["for"]) do |div|
|
36
|
+
node.children.each do |n|
|
37
|
+
parse(n, div)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def option_parse(node, out)
|
43
|
+
out.option **attr_code(
|
44
|
+
disabled: node["disabled"], selected: node["selected"],
|
45
|
+
value: node["value"]
|
46
|
+
) do |o|
|
47
|
+
node.children.each do |n|
|
48
|
+
parse(n, o)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def textarea_parse(node, out)
|
54
|
+
out.textarea **attr_code(
|
55
|
+
id: node["id"], name: node["name"], rows: node["rows"],
|
56
|
+
cols: node["cols"]
|
57
|
+
) do |div|
|
58
|
+
node["value"] and div << node["value"]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -5,9 +5,9 @@ module IsoDoc::HtmlFunction
|
|
5
5
|
module Html
|
6
6
|
def convert1(docxml, filename, dir)
|
7
7
|
noko do |xml|
|
8
|
-
xml.html **{ lang:
|
8
|
+
xml.html **{ lang: @lang.to_s } do |html|
|
9
9
|
info docxml, nil
|
10
|
-
populate_css
|
10
|
+
populate_css
|
11
11
|
html.head { |head| define_head head, filename, dir }
|
12
12
|
make_body(html, docxml)
|
13
13
|
end
|
@@ -15,13 +15,17 @@ module IsoDoc::HtmlFunction
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def make_body1(body, _docxml)
|
18
|
+
return if @bare
|
19
|
+
|
18
20
|
body.div **{ class: "title-section" } do |div1|
|
19
21
|
div1.p { |p| p << " " } # placeholder
|
20
22
|
end
|
21
23
|
section_break(body)
|
22
24
|
end
|
23
25
|
|
24
|
-
def make_body2(body,
|
26
|
+
def make_body2(body, _docxml)
|
27
|
+
return if @bare
|
28
|
+
|
25
29
|
body.div **{ class: "prefatory-section" } do |div2|
|
26
30
|
div2.p { |p| p << " " } # placeholder
|
27
31
|
end
|
@@ -43,46 +47,47 @@ module IsoDoc::HtmlFunction
|
|
43
47
|
end
|
44
48
|
end
|
45
49
|
|
46
|
-
def googlefonts
|
50
|
+
def googlefonts
|
47
51
|
<<~HEAD.freeze
|
48
|
-
|
49
|
-
|
52
|
+
<link href="https://fonts.googleapis.com/css?family=Overpass:300,300i,600,900" rel="stylesheet">
|
53
|
+
<link href="https://fonts.googleapis.com/css?family=Lato:400,400i,700,900" rel="stylesheet">
|
50
54
|
HEAD
|
51
55
|
end
|
52
56
|
|
53
|
-
def html_head
|
57
|
+
def html_head
|
54
58
|
<<~HEAD.freeze
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
59
|
+
<title>#{@meta&.get&.dig(:doctitle)}</title>
|
60
|
+
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
61
|
+
|
62
|
+
<!--TOC script import-->
|
63
|
+
<script type="text/javascript" src="https://cdn.rawgit.com/jgallen23/toc/0.3.2/dist/toc.min.js"></script>
|
64
|
+
<script type="text/javascript">#{toclevel}</script>
|
65
|
+
|
66
|
+
<!--Google fonts-->
|
67
|
+
<link rel="preconnect" href="https://fonts.gstatic.com">#{' '}
|
68
|
+
#{googlefonts}
|
69
|
+
<!--Font awesome import for the link icon-->
|
70
|
+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/solid.css" integrity="sha384-v2Tw72dyUXeU3y4aM2Y0tBJQkGfplr39mxZqlTBDUZAb9BGoC40+rdFCG0m10lXk" crossorigin="anonymous">
|
71
|
+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/fontawesome.css" integrity="sha384-q3jl8XQu1OpdLgGFvNRnPdj5VIlCvgsDQTQB6owSOHWlAurxul7f+JpUOVdAiJ5P" crossorigin="anonymous">
|
72
|
+
<style class="anchorjs"></style>
|
69
73
|
HEAD
|
70
74
|
end
|
71
75
|
|
72
|
-
def html_button
|
76
|
+
def html_button
|
73
77
|
'<button onclick="topFunction()" id="myBtn" '\
|
74
78
|
'title="Go to top">Top</button>'.freeze
|
75
79
|
end
|
76
80
|
|
77
81
|
def html_main(docxml)
|
78
|
-
docxml.at("//head").add_child(html_head
|
82
|
+
docxml.at("//head").add_child(html_head)
|
79
83
|
d = docxml.at('//div[@class="main-section"]')
|
80
84
|
d.name = "main"
|
81
|
-
d.children.empty? or d.children.first.previous = html_button
|
85
|
+
d.children.empty? or d.children.first.previous = html_button
|
82
86
|
end
|
83
87
|
|
84
88
|
def sourcecodelang(lang)
|
85
89
|
return unless lang
|
90
|
+
|
86
91
|
case lang.downcase
|
87
92
|
when "javascript" then "lang-js"
|
88
93
|
when "c" then "lang-c"
|
@@ -117,7 +122,6 @@ module IsoDoc::HtmlFunction
|
|
117
122
|
end
|
118
123
|
end
|
119
124
|
|
120
|
-
def table_long_strings_cleanup(docxml)
|
121
|
-
end
|
125
|
+
def table_long_strings_cleanup(docxml); end
|
122
126
|
end
|
123
127
|
end
|