isodoc 1.0.10 → 1.0.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: acde5067685a87b3ab6d60d0db7d0d0bb41258ee9569248487fea64ad9bdc6bb
4
- data.tar.gz: 8afea86b4d65ed1dc140d598e3e9bf84fe1f6025edfd6287e266e5f725d58044
3
+ metadata.gz: 1842bc01d32d12e9bdc0fd5d468c4e0d92f92bd17323b42dd9a40a9179fa1462
4
+ data.tar.gz: 95194b1e93992bd7aa9bc345cf10508eea01ccd3402bd17654574446898b512d
5
5
  SHA512:
6
- metadata.gz: c989302746ce89015f7dc719b5df66b2b3a8c27e498aa20471bf7e9631a1a80cc0914226b7e6d0778b4b792e9d91d0ea29eb84f07ec14fd646e6800999f5e1a3
7
- data.tar.gz: ae33822c3445e57c08b2b0f8bc575e635c88cd7e071af6c93f04b039a1c5375de1deb7373984b9d7877c39a37542f9ef4a3e3f33dcbddf7316c71eb5bb55daaf
6
+ metadata.gz: 920c818ea215000355ee34aeb7714f5b3de2eb6681413d1ceff2f0734baf0bd5a0d114a9c1681687027a2ef4e86c44f733e00e45b0e0c4150b950b091ea1a8fa
7
+ data.tar.gz: 9104bd8e1d4bb7479fab74cb4ff302b7b684bd0949bb5a49da7638ca7d7c04958680a29ad1aaaadea8dc2b1f2098dfae693d106cfc75df6c4ec848219182802a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- isodoc (1.0.10)
4
+ isodoc (1.0.11)
5
5
  asciimath
6
6
  html2doc (~> 0.9.0)
7
7
  htmlentities (~> 4.3.4)
@@ -114,7 +114,7 @@ GEM
114
114
  json (>= 1.8, < 3)
115
115
  simplecov-html (~> 0.10.0)
116
116
  simplecov-html (0.10.2)
117
- thor (0.20.3)
117
+ thor (1.0.1)
118
118
  thread_safe (0.3.6)
119
119
  timecop (0.9.1)
120
120
  unicode-display_width (1.6.0)
@@ -40,8 +40,10 @@ module IsoDoc::Function
40
40
 
41
41
  def figure_name_parse(node, div, name)
42
42
  return if name.nil? && node.at(ns("./figure"))
43
+ lbl = anchor(node['id'], :label, false)
44
+ lbl = nil if labelled_ancestor(node) && node.ancestors("figure").empty?
45
+ return if lbl.nil? && name.nil?
43
46
  div.p **{ class: "FigureTitle", style: "text-align:center;" } do |p|
44
- lbl = anchor(node['id'], :label, false)
45
47
  lbl.nil? or p << l10n("#{@figure_lbl} #{lbl}")
46
48
  name and !lbl.nil? and p << "&nbsp;&mdash; "
47
49
  name and name.children.each { |n| parse(n, div) }
@@ -69,14 +71,14 @@ module IsoDoc::Function
69
71
  end
70
72
 
71
73
  def pseudocode_parse(node, out)
72
- @in_figure = true
73
- name = node.at(ns("./name"))
74
- out.div **attr_code(id: node["id"], class: "pseudocode") do |div|
75
- node.children.each { |n| parse(n, div) unless n.name == "name" }
76
- sourcecode_name_parse(node, div, name) if name
77
- end
78
- @in_figure = false
74
+ @in_figure = true
75
+ name = node.at(ns("./name"))
76
+ out.div **attr_code(id: node["id"], class: "pseudocode") do |div|
77
+ node.children.each { |n| parse(n, div) unless n.name == "name" }
78
+ sourcecode_name_parse(node, div, name)
79
79
  end
80
+ @in_figure = false
81
+ end
80
82
 
81
83
  def example_label(node, div, name)
82
84
  n = get_anchors[node["id"]]
@@ -129,9 +131,11 @@ module IsoDoc::Function
129
131
  end
130
132
 
131
133
  def sourcecode_name_parse(node, div, name)
134
+ lbl = anchor(node['id'], :label, false)
135
+ lbl = nil if labelled_ancestor(node)
136
+ return if lbl.nil? && name.nil?
132
137
  div.p **{ class: "SourceTitle", style: "text-align:center;" } do |p|
133
138
  if node.ancestors("example").empty?
134
- lbl = anchor(node['id'], :label, false)
135
139
  lbl.nil? or p << l10n("#{@figure_lbl} #{lbl}")
136
140
  name and !lbl.nil? and p << "&nbsp;&mdash; "
137
141
  end
@@ -152,8 +156,7 @@ module IsoDoc::Function
152
156
  node.children.each { |n| parse(n, div) unless n.name == "name" }
153
157
  @sourcecode = false
154
158
  end
155
- sourcecode_name_parse(node, out, name) if name ||
156
- node.ancestors("example").empty? && anchor(node['id'], :label, false)
159
+ sourcecode_name_parse(node, out, name)
157
160
  end
158
161
 
159
162
  def pre_parse(node, out)
@@ -7,10 +7,7 @@ module IsoDoc::Function
7
7
 
8
8
  def recommendation_name(node, out, type)
9
9
  label, title, lbl = recommendation_labels(node)
10
- #label = node.at(ns("./label"))
11
- #title = node.at(ns("./title"))
12
10
  out.p **{ class: "AdmonitionTitle" } do |b|
13
- #lbl = anchor(node['id'], :label, false)
14
11
  b << (lbl.nil? ? l10n("#{type}:") : l10n("#{type} #{lbl}:"))
15
12
  if label || title
16
13
  b.br
@@ -3,8 +3,10 @@ module IsoDoc::Function
3
3
 
4
4
  def table_title_parse(node, out)
5
5
  name = node.at(ns("./name"))
6
+ lbl = anchor(node['id'], :label, false)
7
+ lbl = nil if labelled_ancestor(node)
8
+ return if name.nil? && lbl.nil?
6
9
  out.p **{ class: "TableTitle", style: "text-align:center;" } do |p|
7
- lbl = anchor(node['id'], :label, false)
8
10
  lbl.nil? or p << l10n("#{@table_lbl} #{lbl}")
9
11
  name and !lbl.nil? and p << l10n("&nbsp;&mdash; ")
10
12
  name and name.children.each { |n| parse(n, p) }
@@ -176,5 +176,10 @@ module IsoDoc::Function
176
176
  File.join(@localdir, i["src"])
177
177
  end
178
178
  end
179
+
180
+ def labelled_ancestor(node)
181
+ return !node.ancestors("example, requirement, recommendation, permission, "\
182
+ "table, figure, sourcecode").empty?
183
+ end
179
184
  end
180
185
  end
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "1.0.10".freeze
2
+ VERSION = "1.0.11".freeze
3
3
  end
@@ -272,7 +272,6 @@ B</pre>
272
272
  <div class="figure" id="figure-C">
273
273
  <pre>A &lt;
274
274
  B</pre>
275
- <p class="FigureTitle" style="text-align:center;"/>
276
275
  </div>
277
276
  </div>
278
277
  <p class="zzSTDTitle1"/>
@@ -430,6 +429,9 @@ B</pre>
430
429
  <sourcecode lang="ruby" id="samplecode">
431
430
  <name>Ruby <em>code</em></name>
432
431
  puts x
432
+ </sourcecode>
433
+ <sourcecode unnumbered="true">
434
+ Que?
433
435
  </sourcecode>
434
436
  </foreword></preface>
435
437
  </iso-standard>
@@ -439,6 +441,11 @@ B</pre>
439
441
  <div>
440
442
  <h1 class="ForewordTitle">Foreword</h1>
441
443
  <pre id="samplecode" class="prettyprint lang-rb"><br/>&#160;&#160;&#160; <br/>&#160; puts x<br/><p class="SourceTitle" style="text-align:center;">Figure 1&#160;&#8212; Ruby <i>code</i></p></pre>
444
+ <pre class='prettyprint '>
445
+ <br/>
446
+ Que?
447
+ <br/>
448
+ </pre>
442
449
  </div>
443
450
  <p class="zzSTDTitle1"/>
444
451
  </div>
@@ -454,6 +461,9 @@ B</pre>
454
461
  <sourcecode lang="ruby" id="samplecode">
455
462
  <name>Ruby <em>code</em></name>
456
463
  puts x
464
+ </sourcecode>
465
+ <sourcecode unnumbered="true">
466
+ Que?
457
467
  </sourcecode>
458
468
  </foreword></preface>
459
469
  </iso-standard>
@@ -474,6 +484,11 @@ B</pre>
474
484
  <div>
475
485
  <h1 class="ForewordTitle">Foreword</h1>
476
486
  <p id="samplecode" class="Sourcecode"><br/>&#160;&#160;&#160; <br/>&#160; puts x<br/></p><p class="SourceTitle" style="text-align:center;">Figure 1&#160;&#8212; Ruby <i>code</i></p>
487
+ <p class='Sourcecode'>
488
+ <br/>
489
+ Que?
490
+ <br/>
491
+ </p>
477
492
  </div>
478
493
  <p>&#160;</p>
479
494
  </div>
@@ -1066,6 +1081,53 @@ INPUT
1066
1081
  OUTPUT
1067
1082
  end
1068
1083
 
1084
+ it "does not label embedded figures, sourcecode" do
1085
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1086
+ <itu-standard xmlns="http://riboseinc.com/isoxml">
1087
+ <bibdata>
1088
+ <language>en</language>
1089
+ </bibdata>
1090
+ <preface><foreword>
1091
+ <example>
1092
+ <sourcecode id="B"><name>Label</name>A B C</sourcecode>
1093
+ <figure id="A" class="pseudocode"><name>Label</name><p id="_">  <strong>A</strong></p></figure>
1094
+ <sourcecode id="B1">A B C</sourcecode>
1095
+ <figure id="A1" class="pseudocode"><p id="_">  <strong>A</strong></p></figure>
1096
+ </example>
1097
+ </preface></itu-standard>
1098
+ INPUT
1099
+ #{HTML_HDR}
1100
+ <br/>
1101
+ <div>
1102
+ <h1 class='ForewordTitle'>Foreword</h1>
1103
+ <div class='example'>
1104
+ <p class='example-title'>EXAMPLE</p>
1105
+ <pre id='B' class='prettyprint '>
1106
+ A B C
1107
+ <p class='SourceTitle' style='text-align:center;'>Label</p>
1108
+ </pre>
1109
+ <div id='A' class='pseudocode'>
1110
+ <p id='_'>
1111
+ &#160;&#160;
1112
+ <b>A</b>
1113
+ </p>
1114
+ <p class='SourceTitle' style='text-align:center;'>Label</p>
1115
+ </div>
1116
+ <pre id='B1' class='prettyprint '>A B C</pre>
1117
+ <div id='A1' class='pseudocode'>
1118
+ <p id='_'>
1119
+ &#160;&#160;
1120
+ <b>A</b>
1121
+ </p>
1122
+ </div>
1123
+ </div>
1124
+ </div>
1125
+ <p class='zzSTDTitle1'/>
1126
+ </div>
1127
+ </body>
1128
+ </html>
1129
+ OUTPUT
1130
+ end
1069
1131
 
1070
1132
 
1071
1133
  end
@@ -1054,7 +1054,6 @@ word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="
1054
1054
  </p>
1055
1055
  <div>
1056
1056
  <h1 class="ForewordTitle">Foreword</h1>
1057
- <p class="TableTitle" style="text-align:center;font-size:0pt;">&#xA0;</p>
1058
1057
  <div align="center" class="table_container">
1059
1058
  <table class="MsoISOTable" style="mso-table-lspace:15.0cm;margin-left:423.0pt;mso-table-rspace:15.0cm;margin-right:423.0pt;mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;"><a name="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7"></a>
1060
1059
  <thead>
@@ -1109,7 +1108,6 @@ word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="
1109
1108
  </p>
1110
1109
  <div>
1111
1110
  <h1 class='ForewordTitle'>Foreword</h1>
1112
- <p class='TableTitle' style='text-align:center;font-size:0pt;'>&#xA0;</p>
1113
1111
  <div align='center' class="table_container">
1114
1112
  <table class='MsoISOTable' style='mso-table-lspace:15.0cm;margin-left:423.0pt;mso-table-rspace:15.0cm;margin-right:423.0pt;mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
1115
1113
  <a name='_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7' id='_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7'/>
@@ -121,7 +121,6 @@ RSpec.describe IsoDoc do
121
121
  <p><span class="note_label">NOTE</span>&#160; This is a table about rice</p>
122
122
  </div>
123
123
  </table>
124
- <p class="TableTitle" style="text-align:center;"/>
125
124
  <table id="tableD-2" class="MsoISOTable" style="border-width:1px;border-spacing:0;">
126
125
  <tbody>
127
126
  <tr>
@@ -337,6 +337,7 @@ RSpec.describe IsoDoc do
337
337
  <p class="FigureTitle" style="text-align:center;">Figure 3&#160;&#8212; Split-it-right sample divider</p></div>
338
338
  <div id="note3" class="pseudocode">
339
339
  <p>pseudocode</p>
340
+ <p class='SourceTitle' style='text-align:center;'>Figure 4</p>
340
341
  </div>
341
342
  <pre id='note4' class='prettyprint '>
342
343
  <br/>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-13 00:00:00.000000000 Z
11
+ date: 2019-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath