metanorma-m3d 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e547037e67b0e0e801e60628c592161fbb2f8f3475e9430dc4b804ceaed0bea
4
- data.tar.gz: 7a821dff76506187b273df899d7fe4e84a4b7299d67f13591bf8ce00cbc763ba
3
+ metadata.gz: e56ff0f758437606bfe1cd38596fa6d53e827e00b1c1c74d9b394a897a0709da
4
+ data.tar.gz: 75b1c8474c4031c75ee5c85539c285e5cb291bd7122f55b45aa3cb8eb272087c
5
5
  SHA512:
6
- metadata.gz: 87c1537944eb92c2d3d3599ecb63e635150357ce07a900ac25661b750054f192a7efd07d12dd3437d557bc43654952e87fef319c9e50a08e57a2a20cd0f7145c
7
- data.tar.gz: 759fe729cd05b687c2bd2b3c700ed8a080e756a244827e1cec25bc093c5ce5e94ff376f80f8170ba7b1dd6e58154e94bbe43b105ad8eaf62b4cf65975c96a3fd
6
+ metadata.gz: 7d9d0fb6708b39019c1688f1db57607b15e26eb30ddc61c3721983cb4c2b48f5e034b56447d123ce48bbec4c4320baa7820c8dd018dec81faa6350c62c08b14a
7
+ data.tar.gz: 758cd891a9273629b2b681791ab6a41e0bd54bf35b1784ee2b31395c297ff0150cbe97e7b74f2ff64316c9e501b6462413b9b67c7e16ea5a15a1e47786479460
data/.hound.yml ADDED
@@ -0,0 +1,3 @@
1
+ ruby:
2
+ Enabled: true
3
+ config_file: .rubocop.yml
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ # This project follows the Ribose OSS style guide.
2
+ # https://github.com/riboseinc/oss-guides
3
+ # All project-specific additions and overrides should be specified in this file.
4
+
5
+ inherit_from:
6
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
7
+ AllCops:
8
+ TargetRubyVersion: 2.3
9
+ Rails:
10
+ Enabled: true
@@ -476,6 +476,9 @@
476
476
  <zeroOrMore>
477
477
  <ref name="docidentifier"/>
478
478
  </zeroOrMore>
479
+ <optional>
480
+ <ref name="docnumber"/>
481
+ </optional>
479
482
  <zeroOrMore>
480
483
  <ref name="bdate"/>
481
484
  </zeroOrMore>
@@ -637,6 +640,8 @@
637
640
  <value>transmitted</value>
638
641
  <value>copied</value>
639
642
  <value>unchanged</value>
643
+ <value>circulated</value>
644
+ <text/>
640
645
  </choice>
641
646
  </attribute>
642
647
  <choice>
@@ -673,6 +678,11 @@
673
678
  <text/>
674
679
  </element>
675
680
  </define>
681
+ <define name="docnumber">
682
+ <element name="docnumber">
683
+ <text/>
684
+ </element>
685
+ </define>
676
686
  <define name="bclassification">
677
687
  <element name="classification">
678
688
  <optional>
@@ -19,6 +19,7 @@ module Asciidoctor
19
19
  title node, xml
20
20
  metadata_source(node, xml)
21
21
  metadata_id(node, xml)
22
+ metadata_date(node, xml)
22
23
  metadata_author(node, xml)
23
24
  metadata_publisher(node, xml)
24
25
  xml.language node.attr("language")
@@ -60,20 +61,21 @@ module Asciidoctor
60
61
  end
61
62
  end
62
63
 
63
- def title(node, xml)
64
- ["en"].each do |lang|
65
- xml.title **{ language: lang, format: "plain" } do |t|
66
- t << asciidoc_sub(node.attr("title"))
67
- end
68
- end
69
- end
70
-
71
64
  def metadata_status(node, xml)
72
65
  xml.status(**{ format: "plain" }) { |s| s << node.attr("status") }
73
66
  end
74
67
 
75
68
  def metadata_id(node, xml)
76
- xml.docidentifier { |i| i << node.attr("docnumber") }
69
+ docstatus = node.attr("status")
70
+ dn = node.attr("docnumber")
71
+ if docstatus
72
+ abbr = IsoDoc::M3d::Metadata.new("en", "Latn", {}).
73
+ status_abbr(docstatus)
74
+ dn = "#{dn}(#{abbr})" unless abbr.empty?
75
+ end
76
+ node.attr("copyright-year") and dn += ":#{node.attr("copyright-year")}"
77
+ xml.docidentifier dn, **{type: "m3d"}
78
+ xml.docnumber { |i| i << node.attr("docnumber") }
77
79
  end
78
80
 
79
81
  def metadata_copyright(node, xml)
@@ -1034,6 +1034,9 @@
1034
1034
  <zeroOrMore>
1035
1035
  <ref name="docidentifier"/>
1036
1036
  </zeroOrMore>
1037
+ <optional>
1038
+ <ref name="docnumber"/>
1039
+ </optional>
1037
1040
  <zeroOrMore>
1038
1041
  <ref name="bdate"/>
1039
1042
  </zeroOrMore>
@@ -84,6 +84,9 @@
84
84
  <zeroOrMore>
85
85
  <ref name="docidentifier"/>
86
86
  </zeroOrMore>
87
+ <optional>
88
+ <ref name="docnumber"/>
89
+ </optional>
87
90
  <zeroOrMore>
88
91
  <ref name="bdate"/>
89
92
  </zeroOrMore>
@@ -163,6 +166,9 @@
163
166
  <zeroOrMore>
164
167
  <ref name="docidentifier"/>
165
168
  </zeroOrMore>
169
+ <optional>
170
+ <ref name="docnumber"/>
171
+ </optional>
166
172
  <zeroOrMore>
167
173
  <ref name="bdate"/>
168
174
  </zeroOrMore>
@@ -20,8 +20,6 @@
20
20
  <div class="coverpage-doc-identity">
21
21
  <div class="doc-number">
22
22
  <span class="docnumber">{{ docnumber }}</span>
23
- <span class="docnumber-separator">:</span>
24
- <span class="docyear">{{ docyear }}</span>
25
23
  </div>
26
24
 
27
25
  <div class="coverpage-title">
@@ -1,5 +1,5 @@
1
1
  <p class="MsoNormal" align="right" style='text-align:right'><b style='mso-bidi-font-weight:
2
- normal'><span lang="EN-GB" style='font-size:14.0pt;mso-no-proof:yes'>{{ agency }}&nbsp;{{ docnumber }}:{{ docyear }}(E) {{ draftinfo }}</span></b><b
2
+ normal'><span lang="EN-GB" style='font-size:14.0pt;mso-no-proof:yes'>{{ docnumber }} {{ draftinfo }}</span></b><b
3
3
  style='mso-bidi-font-weight:normal'><span lang="EN-GB" style='font-size:14.0pt'><o:p></o:p></span></b></p>
4
4
 
5
5
  <p class="MsoNormal" align="right" style='text-align:right'><span lang="EN-GB"
@@ -56,45 +56,11 @@ module IsoDoc
56
56
  end
57
57
  end
58
58
 
59
- def make_body2(body, docxml)
60
- body.div **{ class: "WordSection2" } do |div2|
61
- info docxml, div2
62
- div2.p { |p| p << "&nbsp;" } # placeholder
63
- end
64
- # body.br **{ clear: "all", style: "page-break-before:auto;mso-break-type:section-break;" }
65
- # apparently that was not intended: enforce page break between ToC and body
66
- section_break(body)
67
- end
68
-
69
59
  def title(isoxml, _out)
70
60
  main = isoxml&.at(ns("//title[@language='en']"))&.text
71
61
  set_metadata(:doctitle, main)
72
62
  end
73
63
 
74
- def generate_header(filename, dir)
75
- return unless @header
76
- template = Liquid::Template.parse(File.read(@header, encoding: "UTF-8"))
77
- meta = @meta.get
78
- meta[:filename] = filename
79
- params = meta.map { |k, v| [k.to_s, v] }.to_h
80
- File.open("header.html", "w") { |f| f.write(template.render(params)) }
81
- @files_to_delete << "header.html"
82
- "header.html"
83
- end
84
-
85
- def header_strip(h)
86
- h = h.to_s.gsub(%r{<br/>}, " ").sub(/<\/?h[12][^>]*>/, "")
87
- h1 = to_xhtml_fragment(h.dup)
88
- h1.traverse do |x|
89
- x.replace(" ") if x.name == "span" &&
90
- /mso-tab-count/.match(x["style"])
91
- x.remove if x.name == "span" && x["class"] == "MsoCommentReference"
92
- x.remove if x.name == "a" && x["epub:type"] == "footnote"
93
- x.replace(x.children) if x.name == "a"
94
- end
95
- from_xhtml(h1)
96
- end
97
-
98
64
  def info(isoxml, out)
99
65
  @meta.url isoxml, out
100
66
  super
@@ -27,18 +27,7 @@ module IsoDoc
27
27
 
28
28
  def docid(isoxml, _out)
29
29
  docnumber = isoxml.at(ns("//bibdata/docidentifier"))
30
- docstatus = isoxml.at(ns("//bibdata/status"))
31
- dn = docnumber&.text
32
- if docstatus
33
- set(:status, status_print(docstatus.text))
34
- abbr = status_abbr(docstatus.text)
35
- dn = "#{dn}(#{abbr})" unless abbr.empty?
36
- end
37
- set(:docnumber, dn)
38
- end
39
-
40
- def status_print(status)
41
- status.split(/-/).map{ |w| w.capitalize }.join(" ")
30
+ set(:docnumber, docnumber&.text)
42
31
  end
43
32
 
44
33
  def status_abbr(status)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module M3d
3
- VERSION = "1.0.8"
3
+ VERSION = "1.0.9"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-m3d
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-27 00:00:00.000000000 Z
11
+ date: 2018-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -345,6 +345,8 @@ extensions: []
345
345
  extra_rdoc_files: []
346
346
  files:
347
347
  - ".gitignore"
348
+ - ".hound.yml"
349
+ - ".rubocop.yml"
348
350
  - ".travis.yml"
349
351
  - CODE_OF_CONDUCT.md
350
352
  - Gemfile