metanorma-iec 0.1.7 → 1.0.0

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: 92b20defce24dab5f7107aad66e8e034a9be80529279c6dbe842300e39974af3
4
- data.tar.gz: 206961dc8da8348e27b4e9a7c86efb0999f6ff6cdcac80e51881224db3a3ea63
3
+ metadata.gz: bc93e8e07d5be4e94b78dbb0fbca3ce2d1950154566e5fa4726ebfdbdcdee9c9
4
+ data.tar.gz: 4b25cebefe0d6a9890b5e3bee62f0bc2493fef0d874a08b8b22fee5bac5318bd
5
5
  SHA512:
6
- metadata.gz: 7b67680e01cf794537cc9d9d37c5765b061cef56ed49b22d2b9ba7e45220300de160396a382f5551ac5437f821c85f77ac629ee76df4a4d85a5a6fd571aea8a3
7
- data.tar.gz: 14cf2ca4493fb7575358ba738c185011bb7b444d6cbd37d3bb94a7a8f25ed6d31a5a202c6b78ae11f69d4bb5de3a0fe151afc50e2a2f7a301ff6c3c32f754c21
6
+ metadata.gz: 2e3cfceb34bd1079babd73f1ee5748c3efa5eb7bf8ea41cbcb58532c447b30424284ec7c70750c3d3837b3452f8d2330f6c53742c3cea39222fabc3bedcfbd87
7
+ data.tar.gz: 38d31f9043008880da563b634031dcac86a045ba6247863eebf2cc934a780703d12b84a74bcf64d8b57862c6e7bdf9179b9cea07bedffcb262b28cb24872e3fc
@@ -9,16 +9,6 @@ module Asciidoctor
9
9
 
10
10
  register_for "iec"
11
11
 
12
- def makexml(node)
13
- @draft = node.attributes.has_key?("draft")
14
- #super
15
- result = makexml1(node)
16
- ret1 = cleanup(Nokogiri::XML(result))
17
- ret1.root.add_namespace(nil, self.class::XML_NAMESPACE)
18
- validate(ret1) unless @novalid
19
- ret1
20
- end
21
-
22
12
  def metadata_author(node, xml)
23
13
  publishers = node.attr("publisher") || "IEC"
24
14
  publishers.split(/,[ ]?/).each do |p|
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <grammar ns="https://www.metanorma.com/ns/iec" xmlns="http://relaxng.org/ns/structure/1.0">
2
+ <grammar ns="https://www.metanorma.org/ns/iec" xmlns="http://relaxng.org/ns/structure/1.0">
3
3
  <!-- default namespace = "https://www.metanorma.com/ns/iec" -->
4
4
  <include href="isostandard.rng">
5
5
  <start>
@@ -19,7 +19,13 @@ module IsoDoc
19
19
  "99" => {"00" => "DELPUB", "60" => "DELPUB"},
20
20
  }.freeze
21
21
 
22
- def stage_abbrev1(stage, substage, iter, doctype, draft)
22
+ def stage_abbr(stage)
23
+ ret = STAGE_ABBRS.dig(stage, "00") || "??"
24
+ ret = "PPUB" if stage == "60"
25
+ ret
26
+ end
27
+
28
+ def status_abbrev1(stage, substage, iter, doctype, draft)
23
29
  return "" unless stage
24
30
  abbr = STAGE_ABBRS.dig(stage, substage) || "??"
25
31
  if stage == "35" && substage == "92"
@@ -50,17 +56,22 @@ module IsoDoc
50
56
  if docstatus
51
57
  set(:stage, docstatus.text)
52
58
  set(:stage_int, docstatus.text.to_i)
53
- set(:unpublished, docstatus.text.to_i > 0 && docstatus.text.to_i < 60)
54
- abbr = stage_abbrev1(docstatus.text,
55
- isoxml&.at(ns("//bibdata/status/substage"))&.text,
56
- isoxml&.at(ns("//bibdata/status/iteration"))&.text,
57
- isoxml&.at(ns("//bibdata/ext/doctype"))&.text,
58
- isoxml&.at(ns("//version/draft"))&.text)
59
- set(:stageabbr, abbr)
59
+ set(:unpublished, unpublished(docstatus.text))
60
+ set(:statusabbr, status_abbrev1(docstatus.text,
61
+ isoxml&.at(ns("//bibdata/status/substage"))&.text,
62
+ isoxml&.at(ns("//bibdata/status/iteration"))&.text,
63
+ isoxml&.at(ns("//bibdata/ext/doctype"))&.text,
64
+ isoxml&.at(ns("//version/draft"))&.text))
65
+ unpublished(docstatus.text) and
66
+ set(:stageabbr, stage_abbr(docstatus.text))
60
67
  end
61
68
  revdate = isoxml.at(ns("//version/revision-date"))
62
69
  set(:revdate, revdate&.text)
63
70
  end
71
+
72
+ def unpublished(status)
73
+ status.to_i > 0 && status.to_i < 60
74
+ end
64
75
  end
65
76
  end
66
77
  end
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "0.1.7"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
6
6
 
@@ -18,6 +18,7 @@ RSpec.describe IsoDoc::Iec::Metadata do
18
18
  <title type="title-part" language="fr" format="text/plain">Riz</title>
19
19
  <docidentifier type="iso">ISO/PreCD3 17301-1</docidentifier>
20
20
  <docidentifier type="iso-tc">17301</docidentifier>
21
+ <docnumber>1730</docnumber>
21
22
  <date type="published"><on>2011</on></date>
22
23
  <date type="accessed"><on>2012</on></date>
23
24
  <date type="created"><from>2010</from><to>2011</to></date>
@@ -70,7 +71,7 @@ RSpec.describe IsoDoc::Iec::Metadata do
70
71
  </bibdata>
71
72
  </iso-standard>
72
73
  INPUT
73
- {:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :authors=>[], :authors_affiliations=>{}, :createddate=>"2010&ndash;2011", :docnumber=>"ISO/PreCD3 17301-1", :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1: Riz", :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses", :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie&nbsp;1", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part&nbsp;1", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :edition=>"2", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :ics=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :revdate=>"2016-05-01", :sc=>"SC 4", :secretariat=>"GB", :stage=>"35", :stage_int=>35, :stageabbr=>"3CD", :tc=>"TC 34", :tc_docnumber=>["17301"], :unpublished=>true, :wg=>"WG 3"}
74
+ {:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :authors=>[], :authors_affiliations=>{}, :createddate=>"2010&ndash;2011", :docnumber=>"ISO/PreCD3 17301-1", :docnumeric=>"1730", :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1: Riz", :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses", :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie&nbsp;1", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part&nbsp;1", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :edition=>"2", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :ics=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :revdate=>"2016-05-01", :sc=>"SC 4", :secretariat=>"GB", :stage=>"35", :stage_int=>35, :stageabbr=>"CD", :statusabbr=>"3CD", :tc=>"TC 34", :tc_docnumber=>["17301"], :unpublished=>true, :wg=>"WG 3"}
74
75
  OUTPUT
75
76
  end
76
77
 
@@ -146,7 +147,7 @@ OUTPUT
146
147
  </bibdata>
147
148
  </iso-standard>
148
149
  INPUT
149
- {:agency=>"ISO/IEC", :authors=>[], :authors_affiliations=>{}, :docnumber=>"ISO/IEC/CD 17301-1-3", :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1&ndash;3: Riz", :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses", :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie&nbsp;1&ndash;3", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1&ndash;3: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part&nbsp;1&ndash;3", :doctype=>"Technical Report", :docyear=>"2016", :draft=>nil, :draftinfo=>"", :edition=>nil, :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :ics=>"1.2.3, 1.2.3", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :revdate=>nil, :sc=>"DEF 4", :secretariat=>"XXXX", :stage=>"50", :stage_int=>50, :stageabbr=>"CFDIS", :tc=>"ABC 34", :tc_docnumber=>["17301"], :unpublished=>true, :wg=>"GHI 3"}
150
+ {:agency=>"ISO/IEC", :authors=>[], :authors_affiliations=>{}, :docnumber=>"ISO/IEC/CD 17301-1-3", :docnumeric=>nil, :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1&ndash;3: Riz", :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses", :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie&nbsp;1&ndash;3", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1&ndash;3: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part&nbsp;1&ndash;3", :doctype=>"Technical Report", :docyear=>"2016", :draft=>nil, :draftinfo=>"", :edition=>nil, :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :ics=>"1.2.3, 1.2.3", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :revdate=>nil, :sc=>"DEF 4", :secretariat=>"XXXX", :stage=>"50", :stage_int=>50, :stageabbr=>"RFDIS", :statusabbr=>"CFDIS", :tc=>"ABC 34", :tc_docnumber=>["17301"], :unpublished=>true, :wg=>"GHI 3"}
150
151
  OUTPUT
151
152
  end
152
153
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-08 00:00:00.000000000 Z
11
+ date: 2020-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-jing