metanorma-standoc 1.0.4 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1453d5a4693d43ed4e32a5a97d1ac72760b055c961bf9977d50f6732ffcd6b7
4
- data.tar.gz: ad33298dc46235a94b759bbdd07124f30f1f0b7a233a5e0e8675c3fa8b73f725
3
+ metadata.gz: 29ab7132a76a53ee303ac53204ca6ed7f3c7c08fbed11630735cd977c709b9d8
4
+ data.tar.gz: 39bfe93c825d14a28f480018a8d7b454dde14820560ae0e7afac68003bfe2bba
5
5
  SHA512:
6
- metadata.gz: 786e9ede1e35e90a2d523c17dcb623b35d9a6039e20c2808cb176bf0a54f2cfa2e83026514f672bccb9771ab863214d9a6ed4275f6b388ac9d1f31ae26f85d49
7
- data.tar.gz: 2ffc403caa148b2b2248bf33bbb12284dd7331781abc173a8e858b66a8a1a212e6f23e68b7c9156ccdbab0432387400f42191c0369c070d6b4f463efbfc028e9
6
+ metadata.gz: b9b36882ea7259d3fd618e1c1ed804f91d5ffa36503ee924f19e78e7ed52e67f1317fb47c0056705cb1e3542ff65fbd2e4c8871e9a1c503223c6cf34446a7895
7
+ data.tar.gz: b62285a6f373777087a57becc2a5a028a65f3f61e5d658daa6e93af61d078a15b239f5ff0da5498b3561457c4a7f664bb83e01e6ccc6d184c82de3b672828a85
@@ -1,5 +1,5 @@
1
1
  require "asciidoctor"
2
- require "asciidoctor/standoc/version"
2
+ require "metanorma/standoc/version"
3
3
  require "asciidoctor/standoc/base"
4
4
  require "asciidoctor/standoc/front"
5
5
  require "asciidoctor/standoc/lists"
@@ -54,9 +54,10 @@ module Asciidoctor
54
54
 
55
55
  def self.generate_file parent, reader
56
56
  src = reader.source
57
- reader.lines.first.sub(/\s+$/, "") != "@startuml" or
57
+ !reader.lines.first.sub(/\s+$/, "").match /^@startuml($| )/ or
58
58
  src = "@startuml\n#{src}\n@enduml\n"
59
- filename = parent.document.reader.lineno
59
+ /^@startuml (?<filename>[^\n]+)\n/ =~ src
60
+ filename ||= parent.document.reader.lineno
60
61
  system "mkdir -p plantuml"
61
62
  File.open("plantuml/#{filename}.pml", "w") { |f| f.write src }
62
63
  system "plantuml plantuml/#{filename}.pml"
@@ -43,12 +43,17 @@ module Asciidoctor
43
43
  "#{id}:#{year}"
44
44
  end
45
45
 
46
+ def docid(t, code)
47
+ type, code_stripped = @bibdb&.docid_type(code)
48
+ t.docidentifier (code_stripped || code), **attr_code(type: type)
49
+ end
50
+
46
51
  def isorefmatches(xml, m)
47
52
  ref = fetch_ref xml, m[:code], m[:year]
48
53
  return use_my_anchor(ref, m[:anchor]) if ref
49
54
  xml.bibitem **attr_code(ref_attributes(m)) do |t|
50
55
  t.title(**plaintxt) { |i| i << ref_normalise(m[:text]) }
51
- t.docidentifier id_and_year(m[:code], m[:year])
56
+ docid(t, id_and_year(m[:code], m[:year]))
52
57
  m[:year] and t.date **{ type: "published" } do |d|
53
58
  set_date_range(d, m[:year])
54
59
  end
@@ -61,7 +66,7 @@ module Asciidoctor
61
66
  return use_my_anchor(ref, m[:anchor]) if ref
62
67
  xml.bibitem **attr_code(ref_attributes(m)) do |t|
63
68
  t.title(**plaintxt) { |i| i << ref_normalise(m[:text]) }
64
- t.docidentifier id_and_year(m[:code], "--")
69
+ docid(t, id_and_year(m[:code], "--"))
65
70
  t.date **{ type: "published" } do |d|
66
71
  d.on "--"
67
72
  end
@@ -71,13 +76,13 @@ module Asciidoctor
71
76
  end
72
77
 
73
78
  def conditional_date(t, m, noyr)
74
- m.names.include?("year") and
75
- t.date(**{ type: "published" }) do |d|
76
- if noyr then d.on "--"
77
- else
78
- set_date_range(d, m[:year])
79
- end
79
+ m.names.include?("year") and !m[:year].nil? and
80
+ t.date(**{ type: "published" }) do |d|
81
+ if noyr then d.on "--"
82
+ else
83
+ set_date_range(d, m[:year])
80
84
  end
85
+ end
81
86
  end
82
87
 
83
88
  def isorefmatches3(xml, m)
@@ -87,7 +92,7 @@ module Asciidoctor
87
92
  return use_my_anchor(ref, m[:anchor]) if ref
88
93
  xml.bibitem(**attr_code(ref_attributes(m))) do |t|
89
94
  t.title(**plaintxt) { |i| i << ref_normalise(m[:text]) }
90
- t.docidentifier(id_and_year(m[:code], m[:year]) + " (all parts)")
95
+ docid(t, id_and_year(m[:code], m[:year]) + " (all parts)")
91
96
  conditional_date(t, m, noyr)
92
97
  iso_publisher(t, m[:code])
93
98
  t.note(**plaintxt) { |p| p << "ISO DATE: #{m[:fn]}" } if m.names.include?("fn") && m[:fn]
@@ -109,7 +114,7 @@ module Asciidoctor
109
114
  t.formattedref **{ format: "application/x-isodoc+xml" } do |i|
110
115
  i << ref_normalise_no_format(m[:text])
111
116
  end
112
- t.docidentifier(/^\d+$/.match(m[:code]) ? "[#{m[:code]}]" : m[:code])
117
+ docid(t, /^\d+$/.match(m[:code]) ? "[#{m[:code]}]" : m[:code])
113
118
  end
114
119
  end
115
120
 
@@ -18,7 +18,7 @@ module Metanorma
18
18
  end
19
19
 
20
20
  def version
21
- "Asciidoctor::Standoc #{Metanorma::Standoc::VERSION}/IsoDoc #{IsoDoc::VERSION}"
21
+ "Metanorma::Standoc #{Metanorma::Standoc::VERSION}/IsoDoc #{IsoDoc::VERSION}"
22
22
  end
23
23
 
24
24
  def input_to_isodoc(file)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Standoc
3
- VERSION = "1.0.4".freeze
3
+ VERSION = "1.0.5".freeze
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  require "asciidoctor" unless defined? Asciidoctor::Converter
2
2
  require_relative "asciidoctor/standoc/converter"
3
- require_relative "asciidoctor/standoc/version"
3
+ require_relative "metanorma/standoc/version"
4
4
  require "asciidoctor/extensions"
5
5
 
6
6
  if defined? Metanorma
@@ -2,7 +2,7 @@
2
2
 
3
3
  lib = File.expand_path("../lib", __FILE__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require "asciidoctor/standoc/version"
5
+ require "metanorma/standoc/version"
6
6
 
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = "metanorma-standoc"
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency "ruby-jing"
31
31
  spec.add_dependency "isodoc", "~> 0.9.0"
32
32
  spec.add_dependency "iev", "~> 0.2.0"
33
- spec.add_dependency "relaton", "~> 0.2.0"
33
+ spec.add_dependency "relaton", "~> 0.2.2"
34
34
 
35
35
  spec.add_development_dependency "bundler", "~> 1.15"
36
36
  spec.add_development_dependency "byebug"
@@ -44,4 +44,5 @@ Gem::Specification.new do |spec|
44
44
  spec.add_development_dependency "timecop", "~> 0.9"
45
45
  spec.add_development_dependency "metanorma", "~> 0.2.6"
46
46
  spec.add_development_dependency "isobib", "~> 0.3.0"
47
+ spec.add_development_dependency "ietfbib", "~> 0.3.0"
47
48
  end
@@ -41,6 +41,17 @@ RSpec.describe Asciidoctor::Standoc do
41
41
  Alice -> Bob: Another authentication Request
42
42
  Alice <-- Bob: another authentication Response
43
43
  ....
44
+
45
+ [plantuml]
46
+ ....
47
+ @startuml filename
48
+ Alice -> Bob: Authentication Request
49
+ Bob --> Alice: Authentication Response
50
+
51
+ Alice -> Bob: Another authentication Request
52
+ Alice <-- Bob: another authentication Response
53
+ @enduml
54
+ ....
44
55
  INPUT
45
56
  #{BLANK_HDR}
46
57
  <sections><figure id="_">
@@ -48,7 +59,11 @@ RSpec.describe Asciidoctor::Standoc do
48
59
  </figure>
49
60
  <figure id="_">
50
61
  <image src="plantuml/29.png" id="_" imagetype="PNG" height="auto" width="auto"/>
51
- </figure></sections>
62
+ </figure>
63
+ <figure id="_">
64
+ <image src="plantuml/filename.png" id="_" imagetype="PNG" height="auto" width="auto"/>
65
+ </figure>
66
+ </sections>
52
67
 
53
68
  </standard-document>
54
69
  OUTPUT
@@ -1,5 +1,6 @@
1
1
  require "spec_helper"
2
2
  require "isobib"
3
+ require "ietfbib"
3
4
 
4
5
  RSpec.describe Asciidoctor::Standoc do
5
6
  it "processes simple ISO reference" do
@@ -462,7 +463,7 @@ RSpec.describe Asciidoctor::Standoc do
462
463
  <title>Normative References</title>
463
464
  <bibitem id="iso123" type="standard">
464
465
  <title format="text/plain">Standard</title>
465
- <docidentifier>ISO 123</docidentifier>
466
+ <docidentifier type="ISO">ISO 123</docidentifier>
466
467
  <contributor>
467
468
  <role type="publisher"/>
468
469
  <organization>
@@ -600,7 +601,7 @@ OUTPUT
600
601
  end
601
602
 
602
603
  def mock_rfcbib_get_rfc8341
603
- expect(RfcBib::RfcBibliography).to receive(:get).with("RFC 8341", nil, {}) do
604
+ expect(IETFBib::RfcBibliography).to receive(:get).with("RFC 8341", nil, {}) do
604
605
  IsoBibItem.from_xml(<<~"OUTPUT")
605
606
  <bibitem id="RFC8341">
606
607
  <title format="text/plain" language="en" script="Latn">Network Configuration Access Control Model</title>
@@ -19,7 +19,7 @@ RSpec.describe Metanorma::Standoc::Processor do
19
19
  end
20
20
 
21
21
  it "registers version against metanorma" do
22
- expect(processor.version.to_s).to match(%r{^Asciidoctor::Standoc })
22
+ expect(processor.version.to_s).to match(%r{^Metanorma::Standoc })
23
23
  expect(processor.version.to_s).to match(%r{/IsoDoc })
24
24
  end
25
25
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-standoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-04 00:00:00.000000000 Z
11
+ date: 2018-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.2.0
75
+ version: 0.2.2
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.2.0
82
+ version: 0.2.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -248,6 +248,20 @@ dependencies:
248
248
  - - "~>"
249
249
  - !ruby/object:Gem::Version
250
250
  version: 0.3.0
251
+ - !ruby/object:Gem::Dependency
252
+ name: ietfbib
253
+ requirement: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - "~>"
256
+ - !ruby/object:Gem::Version
257
+ version: 0.3.0
258
+ type: :development
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - "~>"
263
+ - !ruby/object:Gem::Version
264
+ version: 0.3.0
251
265
  description: |
252
266
  metanorma-standoc realises standards following the Metanorma standoc model
253
267
 
@@ -296,10 +310,10 @@ files:
296
310
  - lib/asciidoctor/standoc/utils.rb
297
311
  - lib/asciidoctor/standoc/validate.rb
298
312
  - lib/asciidoctor/standoc/validate_section.rb
299
- - lib/asciidoctor/standoc/version.rb
300
313
  - lib/metanorma-standoc.rb
301
314
  - lib/metanorma/standoc.rb
302
315
  - lib/metanorma/standoc/processor.rb
316
+ - lib/metanorma/standoc/version.rb
303
317
  - metanorma-standoc.gemspec
304
318
  - spec/asciidoctor-standoc/base_spec.rb
305
319
  - spec/asciidoctor-standoc/blocks_spec.rb