metanorma-iho 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/macos.yml +34 -0
  3. data/.github/workflows/ubuntu.yml +34 -0
  4. data/.github/workflows/windows.yml +36 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +11 -0
  7. data/LICENSE +25 -0
  8. data/README.adoc +26 -0
  9. data/Rakefile +6 -0
  10. data/bin/console +14 -0
  11. data/bin/rspec +18 -0
  12. data/bin/setup +8 -0
  13. data/lib/asciidoctor/iho/basicdoc.rng +1059 -0
  14. data/lib/asciidoctor/iho/biblio.rng +1207 -0
  15. data/lib/asciidoctor/iho/boilerplate.xml +30 -0
  16. data/lib/asciidoctor/iho/converter.rb +94 -0
  17. data/lib/asciidoctor/iho/iho.rng +144 -0
  18. data/lib/asciidoctor/iho/isodoc.rng +1061 -0
  19. data/lib/asciidoctor/iho/reqt.rng +171 -0
  20. data/lib/asciidoctor/iho.rb +4 -0
  21. data/lib/isodoc/iho/base_convert.rb +74 -0
  22. data/lib/isodoc/iho/html/header.html +241 -0
  23. data/lib/isodoc/iho/html/html_iho_intro.html +8 -0
  24. data/lib/isodoc/iho/html/html_iho_titlepage.html +89 -0
  25. data/lib/isodoc/iho/html/htmlstyle.scss +757 -0
  26. data/lib/isodoc/iho/html/iho.scss +760 -0
  27. data/lib/isodoc/iho/html/image001.png +0 -0
  28. data/lib/isodoc/iho/html/image002.png +0 -0
  29. data/lib/isodoc/iho/html/image003.png +0 -0
  30. data/lib/isodoc/iho/html/logo.png +0 -0
  31. data/lib/isodoc/iho/html/logo.svg +555 -0
  32. data/lib/isodoc/iho/html/scripts.html +68 -0
  33. data/lib/isodoc/iho/html/scripts.pdf.html +72 -0
  34. data/lib/isodoc/iho/html/word_iho_intro.html +24 -0
  35. data/lib/isodoc/iho/html/word_iho_titlepage.html +888 -0
  36. data/lib/isodoc/iho/html/wordstyle.scss +1156 -0
  37. data/lib/isodoc/iho/html_convert.rb +33 -0
  38. data/lib/isodoc/iho/metadata.rb +26 -0
  39. data/lib/isodoc/iho/pdf_convert.rb +31 -0
  40. data/lib/isodoc/iho/word_convert.rb +46 -0
  41. data/lib/metanorma/iho/processor.rb +37 -0
  42. data/lib/metanorma/iho/version.rb +5 -0
  43. data/lib/metanorma/iho.rb +32 -0
  44. data/lib/metanorma-iho.rb +12 -0
  45. data/metanorma-iho.gemspec +43 -0
  46. data/metanorma.yml +56 -0
  47. metadata +274 -0
@@ -0,0 +1,30 @@
1
+ <boilerplate>
2
+ <copyright-statement>
3
+ <clause>
4
+ <p align="center"> © Copyright International Hydrographic Organization {{ docyear }}</p>
5
+ <p>This work is copyright. Apart from any use permitted in accordance with the Berne Convention for the Protection of Literary and Artistic Works (1886), and except in the circumstances described below, no part may be translated, reproduced by any process, adapted, communicated or commercially exploited without prior written permission from the International Hydrographic Organization (IHO). Copyright in some of the material in this publication may be owned by another party and permission for the translation and/or reproduction of that material must be obtained from the owner.</p>
6
+ </clause>
7
+ </copyright-statement>
8
+ <license-statement>
9
+ <clause>
10
+ <p>This document or partial material from this document may be translated, reproduced or distributed for general information, on no more than a cost recovery basis. Copies may not be sold or distributed for profit or gain without prior written agreement of the IHO and any other copyright holders.</p>
11
+ <p>In the event that this document or partial material from this document is reproduced, translated or distributed under the terms described above, the following statements are to be included:</p>
12
+ <quote>
13
+ <p><em>"Material from IHO publication [reference to extract: Title, Edition] is reproduced with the permission of the International Hydrographic Organization (IHO) Secretariat (Permission No ……./…) acting for the International Hydrographic Organization (IHO), which does not accept responsibility for the correctness of the material as reproduced: in case of doubt, the IHO's authentic text shall prevail. The incorporation of material sourced from IHO shall not be construed as constituting an endorsement by IHO of this product."</em></p>
14
+ <p><em>"This [document/publication] is a translation of IHO [document/publication] [name]. The IHO has not checked this translation and therefore takes no responsibility for its accuracy. In case of doubt the source version of [name] in [language] should be consulted."</em></p>
15
+ </quote>
16
+ <p>The IHO Logo or other identifiers shall not be used in any derived product without prior written permission from the IHO.</p>
17
+ </clause>
18
+ </license-statement>
19
+ <feedback-statement>
20
+ <p>Published by the<br/>
21
+ International Hydrographic Organization<br/>
22
+ 4b quai Antoine 1er<br/>
23
+ Principauté de Monaco<br/>
24
+ Tel: (377) 93.10.81.00<br/>
25
+ Fax: (377) 93.10.81.40<br/>
26
+ info@iho.int<br/>
27
+ www.iho.int</p>
28
+ </feedback-statement>
29
+ </boilerplate>
30
+
@@ -0,0 +1,94 @@
1
+ require "asciidoctor/standoc/converter"
2
+ require 'asciidoctor/generic/converter'
3
+
4
+ module Asciidoctor
5
+ module IHO
6
+ # A {Converter} implementation that generates RSD output, and a document
7
+ # schema encapsulation of the document for validation
8
+ #
9
+ class Converter < Asciidoctor::Generic::Converter
10
+ XML_ROOT_TAG = 'iho-standard'.freeze
11
+ XML_NAMESPACE = 'https://www.metanorma.org/ns/iho'.freeze
12
+
13
+ register_for "iho"
14
+
15
+ def clause_parse(attrs, xml, node)
16
+ node.option? "appendix" and
17
+ return appendix_parse(attrs, xml, node)
18
+ super
19
+ end
20
+
21
+ def appendix_parse(attrs, xml, node)
22
+ attrs["inline-header".to_sym] = node.option? "inline-header"
23
+ set_obligation(attrs, node)
24
+ xml.appendix **attr_code(attrs) do |xml_section|
25
+ xml_section.title { |name| name << node.title }
26
+ xml_section << node.content
27
+ end
28
+ end
29
+
30
+ SERIESNAME = {
31
+ B: "Bathymetric",
32
+ C: "Capacity Building",
33
+ M: "Miscellaneous",
34
+ P: "Periodic",
35
+ S: "Standards and Specifications",
36
+ }
37
+
38
+ def metadata_series(node, xml)
39
+ series = node.attr("series") or return
40
+ xml.series **{ type: "main" } do |s|
41
+ s.title SERIESNAME[series.to_sym] || "N/A"
42
+ s.abbreviation series
43
+ end
44
+ end
45
+
46
+ def metadata_ext(node, ext)
47
+ super
48
+ metadata_commentperiod(node, ext)
49
+ end
50
+
51
+ def metadata_commentperiod(node, xml)
52
+ from = node.attr("comment-from") or return
53
+ to = node.attr("comment-to")
54
+ xml.commentperiod do |c|
55
+ c.from from
56
+ c.to to if to
57
+ end
58
+ end
59
+
60
+ def metadata_committee(node, xml)
61
+ return unless node.attr("workgroup")
62
+ xml.editorialgroup do |a|
63
+ a.committee node.attr("committee")
64
+ a.workgroup node.attr("workgroup")
65
+ end
66
+ i = 2
67
+ while node.attr("workgroup_#{i}") do
68
+ xml.editorialgroup do |a|
69
+ a.committee node.attr("committee_#{i}")
70
+ a.workgroup node.attr("workgroup_#{i}")
71
+ end
72
+ i += 1
73
+ end
74
+ end
75
+
76
+ def configuration
77
+ Metanorma::IHO.configuration
78
+ end
79
+
80
+ def html_converter(node)
81
+ IsoDoc::IHO::HtmlConvert.new(html_extract_attributes(node))
82
+ end
83
+
84
+ def pdf_converter(node)
85
+ return nil if node.attr("no-pdf")
86
+ IsoDoc::IHO::PdfConvert.new(html_extract_attributes(node))
87
+ end
88
+
89
+ def word_converter(node)
90
+ IsoDoc::IHO::WordConvert.new(doc_extract_attributes(node))
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,144 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <grammar ns="https://www.metanorma.org/ns/iho" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
+ <!--
4
+ Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
5
+ we cannot have a new default namespace: we will end up with a grammar with two different
6
+ namespaces, one for isostandard and one for csand additions. And we do not want that.
7
+ -->
8
+ <include href="isodoc.rng">
9
+ <start>
10
+ <ref name="iho-standard"/>
11
+ </start>
12
+ <define name="DocumentType">
13
+ <choice>
14
+ <value>policy-and-procedures</value>
15
+ <value>best-practices</value>
16
+ <value>supporting-document</value>
17
+ <value>report</value>
18
+ <value>legal</value>
19
+ <value>directives</value>
20
+ <value>proposal</value>
21
+ <value>standard</value>
22
+ </choice>
23
+ </define>
24
+ <define name="editorialgroup">
25
+ <element name="editorialgroup">
26
+ <ref name="committee"/>
27
+ <ref name="workgroup"/>
28
+ </element>
29
+ </define>
30
+ <define name="BibDataExtensionType">
31
+ <optional>
32
+ <ref name="doctype"/>
33
+ </optional>
34
+ <oneOrMore>
35
+ <ref name="editorialgroup"/>
36
+ </oneOrMore>
37
+ <zeroOrMore>
38
+ <ref name="ics"/>
39
+ </zeroOrMore>
40
+ <optional>
41
+ <ref name="commentperiod"/>
42
+ </optional>
43
+ </define>
44
+ <define name="annex">
45
+ <element name="annex">
46
+ <optional>
47
+ <attribute name="id">
48
+ <data type="ID"/>
49
+ </attribute>
50
+ </optional>
51
+ <optional>
52
+ <attribute name="language"/>
53
+ </optional>
54
+ <optional>
55
+ <attribute name="script"/>
56
+ </optional>
57
+ <optional>
58
+ <attribute name="inline-header">
59
+ <data type="boolean"/>
60
+ </attribute>
61
+ </optional>
62
+ <attribute name="obligation">
63
+ <choice>
64
+ <value>normative</value>
65
+ <value>informative</value>
66
+ </choice>
67
+ </attribute>
68
+ <optional>
69
+ <ref name="section-title"/>
70
+ </optional>
71
+ <group>
72
+ <group>
73
+ <zeroOrMore>
74
+ <ref name="BasicBlock"/>
75
+ </zeroOrMore>
76
+ <zeroOrMore>
77
+ <ref name="note"/>
78
+ </zeroOrMore>
79
+ </group>
80
+ <zeroOrMore>
81
+ <choice>
82
+ <ref name="annex-subsection"/>
83
+ <ref name="terms"/>
84
+ <ref name="definitions"/>
85
+ <ref name="references"/>
86
+ </choice>
87
+ </zeroOrMore>
88
+ </group>
89
+ <zeroOrMore>
90
+ <ref name="annex-appendix"/>
91
+ </zeroOrMore>
92
+ </element>
93
+ </define>
94
+ </include>
95
+ <define name="committee">
96
+ <element name="committee">
97
+ <choice>
98
+ <value>hssc</value>
99
+ <value>ircc</value>
100
+ </choice>
101
+ </element>
102
+ </define>
103
+ <define name="workgroup">
104
+ <element name="workgroup">
105
+ <text/>
106
+ </element>
107
+ </define>
108
+ <define name="annex-appendix">
109
+ <element name="appendix">
110
+ <ref name="Clause-Section"/>
111
+ </element>
112
+ </define>
113
+ <define name="commentperiod">
114
+ <element name="commentperiod">
115
+ <element name="from">
116
+ <ref name="ISO8601Date"/>
117
+ </element>
118
+ <optional>
119
+ <element name="to">
120
+ <ref name="ISO8601Date"/>
121
+ </element>
122
+ </optional>
123
+ </element>
124
+ </define>
125
+ <define name="iho-standard">
126
+ <element name="iho-standard">
127
+ <ref name="bibdata"/>
128
+ <zeroOrMore>
129
+ <ref name="termdocsource"/>
130
+ </zeroOrMore>
131
+ <optional>
132
+ <ref name="boilerplate"/>
133
+ </optional>
134
+ <ref name="preface"/>
135
+ <oneOrMore>
136
+ <ref name="sections"/>
137
+ </oneOrMore>
138
+ <zeroOrMore>
139
+ <ref name="annex"/>
140
+ </zeroOrMore>
141
+ <ref name="bibliography"/>
142
+ </element>
143
+ </define>
144
+ </grammar>