metanorma-mpfd 0.1.2 → 0.1.3

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: ec1ff06462b4ba997c1633e1ee3e0d9b97691f1a29e7ea29e8884d04b4cd6be1
4
- data.tar.gz: b6ab1fd59e16b5e732d87d59b5b56e452cfe0757cfa48ca2bef1e046af68c0aa
3
+ metadata.gz: a556a866236e88b62757213d6a47c215860b53f9cba2012fa4f83039fd40067d
4
+ data.tar.gz: 9218d447fe46602f383d0a823d7682ffd1eec13c1d80087f3722d41d241ab848
5
5
  SHA512:
6
- metadata.gz: 8127483942c5bd271e86b4b667451cc41410250553ff84442c2272c34bc1a203577d2ffe4d426a41e172a560bf4008c1c7906619fafc9c1e8e1e4d52fda0d9d9
7
- data.tar.gz: 89ebb41872f5baff594b5a166b43d0cc3c45288aeaf65fec7b92c3e57d4b931099b034febeb8b598595d275ab82e056953ce3263a400d7497aff8458736c70be
6
+ metadata.gz: 6b74475f1abb013d3da557bb1a09447b884a6062c0d52307776d83638495a857308ad3d3e13e54035ee62e50a27a589c09312cc99ccd617433475aad631799cf
7
+ data.tar.gz: a578e8235ee22901945bb43b4d6597437cb1078bc13334ed204baabbb00e556f7c161444a4dcf8f88972a3767d8b0db8e6afa2349b0cc8a4af5536e5872757ee
data/README.adoc CHANGED
@@ -92,10 +92,17 @@ DocBook document authoring tool). Asciidoctor has built-in capability to output
92
92
  Text, DocBook and HTML; so it can be used to preview the file as it is being
93
93
  authored.
94
94
 
95
+ Generating documents via a document model substantially automated formatting
96
+ associated with the document, including automating numbering of headings, figures,
97
+ tables etc, and automatically generating references and citations.
98
+
99
+
95
100
  [[model_additions]]
96
- == Asciidoctor model additions
101
+ == Asciidoctor features specific to CSAND
97
102
 
98
- Refer also to https://github.com/riboseinc/metanorma-standoc/blob/master/README.adoc; this section lists additions specific only to metanorma-mpfd
103
+ The https://github.com/riboseinc/metanorma-standoc[metanorma-standoc]
104
+ gem documents the customisations of Asciidoctor markup common to all metanorma gems.
105
+ The following markup is specific to this gem.
99
106
 
100
107
  All the following modifications to the basic Metanorma model are provisional, as a full analysis of the
101
108
  formatting requirements of MPFD has not yet been conducted.
@@ -260,11 +267,11 @@ This is rendered as
260
267
 
261
268
  == Document Attributes
262
269
 
263
- The gem uses the document attributes defined for metanorma-standoc (see
264
- the https://github.com/riboseinc/metanorma-model-standoc/blob/master/README.adoc[metanorma-standoc README]).
270
+ === Common attributes
265
271
 
266
272
  The gem relies on Asciidoctor document attributes to provide necessary
267
- metadata about the document. These include:
273
+ metadata about the document. The https://github.com/riboseinc/metanorma-standoc[metanorma-standoc]
274
+ gem documents the Asciidoctor document attributes common to all metanorma gems. These include:
268
275
 
269
276
  `:edition:`:: The document edition
270
277
 
@@ -99,13 +99,6 @@ module Asciidoctor
99
99
  d
100
100
  end
101
101
 
102
- def pdf_convert(filename)
103
- url = "#{Dir.pwd}/#{filename}.html"
104
- pdfjs = File.join(File.dirname(__FILE__), 'pdf.js')
105
- system "export NODE_PATH=$(npm root --quiet -g);
106
- node #{pdfjs} file://#{url} #{filename}.pdf"
107
- end
108
-
109
102
  def document(node)
110
103
  init(node)
111
104
  ret1 = makexml(node)
@@ -116,7 +109,7 @@ module Asciidoctor
116
109
  File.open(filename, "w") { |f| f.write(ret) }
117
110
  html_converter(node).convert filename unless node.attr("nodoc")
118
111
  word_converter(node).convert filename unless node.attr("nodoc")
119
- pdf_convert(filename.sub(/\.xml$/, "")) unless node.attr("nodoc")
112
+ pdf_converter(node).convert filename unless node.attr("nodoc")
120
113
  end
121
114
  @files_to_delete.each { |f| FileUtils.rm f }
122
115
  ret
@@ -128,15 +121,6 @@ module Asciidoctor
128
121
  File.join(File.dirname(__FILE__), "mpfd.rng"))
129
122
  end
130
123
 
131
- def literal(node)
132
- noko do |xml|
133
- xml.figure **id_attr(node) do |f|
134
- figure_title(node, f)
135
- f.pre node.lines.join("\n")
136
- end
137
- end
138
- end
139
-
140
124
  def style(n, t)
141
125
  return
142
126
  end
@@ -145,33 +129,13 @@ module Asciidoctor
145
129
  IsoDoc::Mpfd::HtmlConvert.new(html_extract_attributes(node))
146
130
  end
147
131
 
148
- def word_converter(node)
149
- IsoDoc::Mpfd::WordConvert.new(doc_extract_attributes(node))
132
+ def pdf_converter(node)
133
+ IsoDoc::Mpfd::PdfConvert.new(html_extract_attributes(node))
150
134
  end
151
135
 
152
- def inline_quoted(node)
153
- noko do |xml|
154
- case node.type
155
- when :emphasis then xml.em node.text
156
- when :strong then xml.strong node.text
157
- when :monospaced then xml.tt node.text
158
- when :double then xml << "\"#{node.text}\""
159
- when :single then xml << "'#{node.text}'"
160
- when :superscript then xml.sup node.text
161
- when :subscript then xml.sub node.text
162
- when :asciimath then stem_parse(node.text, xml)
163
- else
164
- case node.role
165
- when "strike" then xml.strike node.text
166
- when "smallcap" then xml.smallcap node.text
167
- when "keyword" then xml.keyword node.text
168
- else
169
- xml << node.text
170
- end
171
- end
172
- end.join
136
+ def word_converter(node)
137
+ IsoDoc::Mpfd::WordConvert.new(doc_extract_attributes(node))
173
138
  end
174
-
175
139
  end
176
140
  end
177
141
  end
@@ -384,6 +384,7 @@
384
384
  <ref name="sourcecode"/>
385
385
  <ref name="example"/>
386
386
  <ref name="review"/>
387
+ <ref name="pre"/>
387
388
  </choice>
388
389
  </define>
389
390
  <define name="paragraph">
@@ -540,6 +541,20 @@
540
541
  </zeroOrMore>
541
542
  </element>
542
543
  </define>
544
+ <define name="pre">
545
+ <element name="pre">
546
+ <attribute name="id">
547
+ <data type="ID"/>
548
+ </attribute>
549
+ <optional>
550
+ <ref name="tname"/>
551
+ </optional>
552
+ <text/>
553
+ <zeroOrMore>
554
+ <ref name="note"/>
555
+ </zeroOrMore>
556
+ </element>
557
+ </define>
543
558
  <define name="table">
544
559
  <element name="table">
545
560
  <attribute name="id">
@@ -710,6 +725,7 @@
710
725
  </optional>
711
726
  <choice>
712
727
  <ref name="image"/>
728
+ <ref name="pre"/>
713
729
  <zeroOrMore>
714
730
  <ref name="figure"/>
715
731
  </zeroOrMore>
@@ -735,6 +751,7 @@
735
751
  <ref name="sub"/>
736
752
  <ref name="sup"/>
737
753
  <ref name="tt"/>
754
+ <ref name="keyword"/>
738
755
  <ref name="strike"/>
739
756
  <ref name="smallcap"/>
740
757
  <ref name="xref"/>
@@ -765,6 +782,11 @@
765
782
  <text/>
766
783
  </element>
767
784
  </define>
785
+ <define name="keyword">
786
+ <element name="keyword">
787
+ <text/>
788
+ </element>
789
+ </define>
768
790
  <define name="sub">
769
791
  <element name="sub">
770
792
  <text/>
@@ -744,6 +744,9 @@
744
744
  </define>
745
745
  <define name="preface">
746
746
  <element name="preface">
747
+ <optional>
748
+ <ref name="preface_abstract"/>
749
+ </optional>
747
750
  <ref name="foreword"/>
748
751
  <optional>
749
752
  <ref name="introduction"/>
@@ -811,6 +814,11 @@
811
814
  </optional>
812
815
  </element>
813
816
  </define>
817
+ <define name="preface_abstract">
818
+ <element name="abstract">
819
+ <ref name="Basic-Section"/>
820
+ </element>
821
+ </define>
814
822
  <define name="foreword">
815
823
  <element name="foreword">
816
824
  <ref name="Basic-Section"/>
@@ -81,28 +81,6 @@
81
81
  </choice>
82
82
  </element>
83
83
  </define>
84
- <!-- TextElement |= keyword -->
85
- <define name="TextElement">
86
- <choice>
87
- <text/>
88
- <ref name="em"/>
89
- <ref name="eref"/>
90
- <ref name="strong"/>
91
- <ref name="stem"/>
92
- <ref name="sub"/>
93
- <ref name="sup"/>
94
- <ref name="tt"/>
95
- <ref name="strike"/>
96
- <ref name="smallcap"/>
97
- <ref name="xref"/>
98
- <ref name="br"/>
99
- <ref name="hyperlink"/>
100
- <ref name="hr"/>
101
- <ref name="pagebreak"/>
102
- <ref name="bookmark"/>
103
- <ref name="keyword"/>
104
- </choice>
105
- </define>
106
84
  <define name="BibItemType" combine="choice">
107
85
  <choice>
108
86
  <value>policy-and-procedures</value>
@@ -191,16 +169,6 @@
191
169
  <text/>
192
170
  </element>
193
171
  </define>
194
- <define name="pre">
195
- <element name="pre">
196
- <text/>
197
- </element>
198
- </define>
199
- <define name="keyword">
200
- <element name="keyword">
201
- <text/>
202
- </element>
203
- </define>
204
172
  <define name="security">
205
173
  <element name="security">
206
174
  <text/>
@@ -80,22 +80,6 @@ module IsoDoc
80
80
  end
81
81
  end
82
82
 
83
- def pre_parse(node, out)
84
- out.pre node.text # content.gsub(/</, "&lt;").gsub(/>/, "&gt;")
85
- end
86
-
87
- def error_parse(node, out)
88
- # catch elements not defined in ISO
89
- case node.name
90
- when "pre"
91
- pre_parse(node, out)
92
- when "keyword"
93
- out.span node.text, **{ class: "keyword" }
94
- else
95
- super
96
- end
97
- end
98
-
99
83
  def fileloc(loc)
100
84
  File.join(File.dirname(__FILE__), loc)
101
85
  end
@@ -78,22 +78,6 @@ module IsoDoc
78
78
  end
79
79
  end
80
80
 
81
- def pre_parse(node, out)
82
- out.pre node.text # content.gsub(/</, "&lt;").gsub(/>/, "&gt;")
83
- end
84
-
85
- def error_parse(node, out)
86
- # catch elements not defined in ISO
87
- case node.name
88
- when "pre"
89
- pre_parse(node, out)
90
- when "keyword"
91
- out.span node.text, **{ class: "keyword" }
92
- else
93
- super
94
- end
95
- end
96
-
97
81
  def fileloc(loc)
98
82
  File.join(File.dirname(__FILE__), loc)
99
83
  end
@@ -62,22 +62,6 @@ module IsoDoc
62
62
  end
63
63
  end
64
64
 
65
- def pre_parse(node, out)
66
- out.pre node.text # content.gsub(/</, "&lt;").gsub(/>/, "&gt;")
67
- end
68
-
69
- def error_parse(node, out)
70
- # catch elements not defined in ISO
71
- case node.name
72
- when "pre"
73
- pre_parse(node, out)
74
- when "keyword"
75
- out.span node.text, **{ class: "keyword" }
76
- else
77
- super
78
- end
79
- end
80
-
81
65
  def fileloc(loc)
82
66
  File.join(File.dirname(__FILE__), loc)
83
67
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Mpfd
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
@@ -39,7 +39,7 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency "guard-rspec", "~> 4.7"
40
40
  spec.add_development_dependency "rake", "~> 12.0"
41
41
  spec.add_development_dependency "rspec", "~> 3.6"
42
- spec.add_development_dependency "rubocop", "~> 0.50"
42
+ spec.add_development_dependency "rubocop", "= 0.54.0"
43
43
  spec.add_development_dependency "simplecov", "~> 0.15"
44
44
  spec.add_development_dependency "timecop", "~> 0.9"
45
45
  spec.add_development_dependency "metanorma", "~> 0.3.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-mpfd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
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-11-19 00:00:00.000000000 Z
11
+ date: 2018-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -196,16 +196,16 @@ dependencies:
196
196
  name: rubocop
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - "~>"
199
+ - - '='
200
200
  - !ruby/object:Gem::Version
201
- version: '0.50'
201
+ version: 0.54.0
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - "~>"
206
+ - - '='
207
207
  - !ruby/object:Gem::Version
208
- version: '0.50'
208
+ version: 0.54.0
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: simplecov
211
211
  requirement: !ruby/object:Gem::Requirement