metanorma-ietf 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/appveyor.yml ADDED
@@ -0,0 +1,35 @@
1
+ version: '{build}'
2
+
3
+ cache:
4
+ - vendor/bundle
5
+
6
+ environment:
7
+ matrix:
8
+ - RUBY_VERSION: 25
9
+ - RUBY_VERSION: 24
10
+ - RUBY_VERSION: _trunk
11
+
12
+ matrix:
13
+ allow_failures:
14
+ - RUBY_VERSION: _trunk
15
+
16
+ install:
17
+ - ps: . { iwr -useb https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/appveyor.ps1 } | iex
18
+ - refreshenv
19
+
20
+ build_script:
21
+ - set PYTHON_VERSION=37
22
+ - set PATH=C:\Ruby%RUBY_VERSION%\bin;%USERPROFILE%\AppData\Roaming\Python\Python%PYTHON_VERSION%\Scripts;C:\Python%PYTHON_VERSION%\Scripts;C:\Python%PYTHON_VERSION%;%PATH%
23
+ - pip3 install --user --upgrade pip
24
+ - pip3 install --user xml2rfc
25
+ - bundle config --local path vendor/bundle
26
+ - bundle update
27
+ - bundle install
28
+
29
+ before_test:
30
+ - ruby -v
31
+ - gem -v
32
+ - bundle -v
33
+
34
+ test_script:
35
+ - bundle exec rake
@@ -0,0 +1,2 @@
1
+ @echo off
2
+ ruby %~dp0\asciidoctor-rfc2 %*
@@ -377,15 +377,22 @@ HERE
377
377
  wgcache_name = "#{Dir.home}/.asciidoc-rfc-workgroup-cache.json"
378
378
  # If we are required to, clear the wg cache
379
379
  if node.attr("flush-caches") == "true"
380
- system("rm -f #{wgcache_name}")
380
+ FileUtils.rm wgcache_name, :force => true
381
381
  end
382
382
  # Is there already a wg cache? If not, create it.
383
383
  wg = []
384
+
384
385
  if Pathname.new(wgcache_name).file?
385
- File.open(wgcache_name, "r") do |f|
386
- wg = JSON.parse(f.read)
386
+ begin
387
+ File.open(wgcache_name, "r") do |f|
388
+ wg = JSON.parse(f.read)
389
+ end
390
+ rescue Exception => e
391
+ STDERR.puts "Cache #{wgcache_name} is invalid, drop it"
387
392
  end
388
- else
393
+ end
394
+
395
+ if wg.empty?
389
396
  File.open(wgcache_name, "w") do |b|
390
397
  STDERR.puts "Reading workgroups from https://tools.ietf.org/wg/..."
391
398
  Kernel.open("https://tools.ietf.org/wg/") do |f|
@@ -154,6 +154,18 @@ module Asciidoctor
154
154
  result
155
155
  end
156
156
 
157
+ # is this a text-only example? if so, mark it up as paragraphs
158
+ def text_only_example(node)
159
+ seen_artwork = false
160
+ node.blocks.each do |b|
161
+ case b.context
162
+ when :listing, :image, :literal, :stem
163
+ seen_artwork = true
164
+ end
165
+ end
166
+ !seen_artwork
167
+ end
168
+
157
169
  # Syntax:
158
170
  # [[id]]
159
171
  # .Title
@@ -172,22 +184,31 @@ module Asciidoctor
172
184
  }
173
185
  # TODO iref
174
186
  seen_artwork = false
175
- noko do |xml|
176
- xml.figure **attr_code(figure_attributes) do |xml_figure|
187
+
188
+ if text_only_example(node)
189
+ noko do |xml|
177
190
  node.blocks.each do |b|
178
- case b.context
179
- when :listing, :image, :literal, :stem
180
- xml_figure << send(b.context, b).join("\n")
181
- seen_artwork = true
182
- else
183
- # we want to see the para text, not its <t> container
184
- if seen_artwork
185
- xml_figure.postamble do |postamble|
186
- postamble << b.content
187
- end
191
+ xml << node.content
192
+ end
193
+ end
194
+ else
195
+ noko do |xml|
196
+ xml.figure **attr_code(figure_attributes) do |xml_figure|
197
+ node.blocks.each do |b|
198
+ case b.context
199
+ when :listing, :image, :literal, :stem
200
+ xml_figure << send(b.context, b).join("\n")
201
+ seen_artwork = true
188
202
  else
189
- xml_figure.preamble do |preamble|
190
- preamble << b.content
203
+ # we want to see the para text, not its <t> container
204
+ if seen_artwork
205
+ xml_figure.postamble do |postamble|
206
+ postamble << b.content
207
+ end
208
+ else
209
+ xml_figure.preamble do |preamble|
210
+ preamble << b.content
211
+ end
191
212
  end
192
213
  end
193
214
  end
@@ -72,8 +72,9 @@ module Asciidoctor
72
72
 
73
73
  rowlength += cell.text.size
74
74
  xml.ttcol **attr_code(ttcol_attributes) do |ttcol|
75
- ttcol << cell.text
75
+ #ttcol << cell.text
76
76
  # NOT cell.content: v2 does not permit blocks in cells
77
+ ttcol << Array(cell.content).join("").gsub(%r{<t>}, "").gsub(%r{</t>}, "")
77
78
  end
78
79
  end
79
80
  warn "asciidoctor: WARNING (#{current_location(node)}): header row of table is longer than 72 ascii characters" if rowlength > 72
@@ -101,8 +102,9 @@ module Asciidoctor
101
102
  row.each do |cell|
102
103
  rowlength += cell.text.size
103
104
  xml.c do |c|
104
- c << cell.text
105
+ #c << cell.text
105
106
  # NOT cell.content: v2 does not permit blocks in cells
107
+ c << Array(cell.content).join("").gsub(%r{<t>}, "").gsub(%r{</t>}, "")
106
108
  end
107
109
  end
108
110
  warn "asciidoctor: WARNING (#{current_location(node)}): row #{i} of table is longer than 72 ascii characters" if rowlength > 72
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ietf
3
- VERSION = "1.0.1".freeze
3
+ VERSION = "1.0.2".freeze
4
4
  end
5
5
  end
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  Formerly known as asciidoctor-ietf.
25
25
  DESCRIPTION
26
26
 
27
- spec.homepage = "https://github.com/riboseinc/metanorma-ietf"
27
+ spec.homepage = "https://github.com/metanorma/metanorma-ietf"
28
28
  spec.license = "BSD-2-Clause"
29
29
 
30
30
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ietf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-21 00:00:00.000000000 Z
11
+ date: 2019-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc
@@ -223,7 +223,9 @@ files:
223
223
  - LICENSE
224
224
  - README.adoc
225
225
  - Rakefile
226
+ - appveyor.yml
226
227
  - bin/asciidoctor-rfc2
228
+ - bin/asciidoctor-rfc2.bat
227
229
  - bin/asciidoctor-rfc3
228
230
  - bin/console
229
231
  - bin/rspec
@@ -261,7 +263,7 @@ files:
261
263
  - rfc2629-other.ent
262
264
  - rfc2629-xhtml.ent
263
265
  - rfc2629.dtd
264
- homepage: https://github.com/riboseinc/metanorma-ietf
266
+ homepage: https://github.com/metanorma/metanorma-ietf
265
267
  licenses:
266
268
  - BSD-2-Clause
267
269
  metadata: {}