metanorma-cli 1.4.14 → 1.4.16

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: 8e6336cbea42f724106ef2d81a1a742526f713e843718861a3388d3e20c3148e
4
- data.tar.gz: 89577c835bb93e9f2adb29a441481686ea85421af5149675eabc8fb3e01e1561
3
+ metadata.gz: e9144b8f31e88505e6bacc75d9168bf1b5671b7b09a8aec4c9d3b90fc4f2fc5b
4
+ data.tar.gz: 979bd574b765d9c6f039427db42e7f429475f93329c3cc85cf5897dcc295c8ef
5
5
  SHA512:
6
- metadata.gz: b33354642e93dd60bbec2a596d4197a53ff738106d73e9552f25dc8e7169c942891cd09d93c8d7124463764955da5b2520bd51fc361e12b849d621b241f7aae6
7
- data.tar.gz: 6ed35b3dea41caaa1e6c519ffcc9626e817a230923ea10864c168cabbffa8000d09d613881e76a6ba33800558aae05bce46c09ff0175f4a4f645665badc3b37e
6
+ metadata.gz: 7c3caa0038cd3e65ad164da094035e007cf33c40b154d4b382436b5f5523e8199ae7e62db8150cebb59fcd73106ab8eb1d7df098c161d925c23d58b308d982fc
7
+ data.tar.gz: 1d5f659db3a7cd5909a4ca3237f27a75ea7931bddcd232d0a8fef7f042e65a677d1f51246fb2d839af9958fbd4747389a943325a2f86a1fb363a16624ac2f414
@@ -17,7 +17,8 @@ def uuid
17
17
  end
18
18
 
19
19
  def extract_documents(m)
20
- return [] unless m and m["sections"]
20
+ return [] unless m && m["sections"]
21
+
21
22
  ret = []
22
23
  m["sections"].each do |s|
23
24
  ret << s if s["file"]
@@ -28,17 +29,19 @@ end
28
29
 
29
30
  def hyperlink(link, suffix)
30
31
  return unless link
32
+
31
33
  link.sub(/\.adoc(?=$|#)/, ".#{suffix}")
32
34
  end
33
35
 
34
36
  def iterate(sections, options)
35
37
  return "" unless sections
38
+
36
39
  ret = ""
37
40
  Array(sections).each do |m|
38
- ret+= "<clause id='#{uuid}'>\n"
39
- title = m["title"] && m["number"] ? "#{m['number']}. #{m['title']}" : ( m["number"] || m["title"] || "&mdash;" )
40
- ret+= "<title>#{title}</title>\n"
41
- ret+= "<p>#{m["type"]}</p>\n" if m["type"]
41
+ ret += "<clause id='#{uuid}'>\n"
42
+ title = m["title"] && m["number"] ? "#{m['number']}. #{m['title']}" : (m["number"] || m["title"] || "&mdash;")
43
+ ret += "<title>#{title}</title>\n"
44
+ ret += "<p>#{m['type']}</p>\n" if m["type"]
42
45
  if m["file"]
43
46
  ret += "<p>"
44
47
  file = hyperlink(m["file"], "html")
@@ -53,20 +56,18 @@ def iterate(sections, options)
53
56
  end
54
57
  ret += "</p>\n"
55
58
  end
56
- ret+= "<p>#{m['description']}</p>\n" if m["description"]
59
+ ret += "<p>#{m['description']}</p>\n" if m["description"]
57
60
  if m["revdate"]
58
- if m["status"]
59
- ret+= "<p>STAGE: #{m["status"]} (#{m['revdate']})</p>\n"
60
- else
61
- ret+= "<p align='right'>#{m['revdate']}</p>\n"
62
- end
63
- else
64
- if m["status"]
65
- ret+= "<p>STAGE: #{m["status"]}</p>\n"
66
- end
61
+ ret += if m["status"]
62
+ "<p>STAGE: #{m['status']} (#{m['revdate']})</p>\n"
63
+ else
64
+ "<p align='right'>#{m['revdate']}</p>\n"
65
+ end
66
+ elsif m["status"]
67
+ ret += "<p>STAGE: #{m['status']}</p>\n"
67
68
  end
68
69
  ret += iterate(m["sections"], options)
69
- ret+= "</clause>\n"
70
+ ret += "</clause>\n"
70
71
  end
71
72
  ret
72
73
  end
@@ -74,24 +75,24 @@ end
74
75
  opt_parser = OptionParser.new do |opts|
75
76
  opts.banner += " <file>"
76
77
  opts.on(
77
- '-t',
78
- '--type TYPE',
79
- "Type of standard to generate"
78
+ "-t",
79
+ "--type TYPE",
80
+ "Type of standard to generate",
80
81
  ) { |v| options[:type] = v.to_sym }
81
82
 
82
83
  opts.on(
83
- '-r',
84
- '--require LIBRARY',
85
- 'Require LIBRARY prior to execution'
86
- ) { |v|
84
+ "-r",
85
+ "--require LIBRARY",
86
+ "Require LIBRARY prior to execution",
87
+ ) do |v|
87
88
  options[:require] ||= []
88
89
  options[:require] << v
89
- }
90
+ end
90
91
 
91
92
  opts.on(
92
- '-R dir',
93
- '--relaton',
94
- "Insert links to relaton XML, generated by relaton-server-csd, with root directory dir (/id/xxxx is supplied)"
93
+ "-R dir",
94
+ "--relaton",
95
+ "Insert links to relaton XML, generated by relaton-server-csd, with root directory dir (/id/xxxx is supplied)",
95
96
  ) { |v| options[:relaton] = v }
96
97
 
97
98
  opts.on_tail("-h", "--help", "Show this message") do
@@ -115,35 +116,35 @@ documents = extract_documents(manifest)
115
116
  # TODO real lookup of namespaces and root elements
116
117
 
117
118
  out = <<~END
118
- <#{options[:type]}-standard xmlns="http://riboseinc.com/isoxml">
119
- <bibdata type="standard">
120
- <title>#{manifest["title"]}</title>
119
+ <#{options[:type]}-standard xmlns="http://riboseinc.com/isoxml">
120
+ <bibdata type="standard">
121
+ <title>#{manifest['title']}</title>
121
122
  END
122
123
 
123
124
  # TODO leave in anchor references?
124
125
  #
125
126
  documents.each do |d|
126
127
  out += <<~END
127
- <relation type="partOf">
128
- <bibdata type="standard">
129
- <title>#{d['title']}</title>
130
- <docidentifier>#{d['number']}</docidentifier>
131
- <abstract>#{d['description']}</abstract>
132
- </bibdata>
133
- </relation>
128
+ <relation type="partOf">
129
+ <bibdata type="standard">
130
+ <title>#{d['title']}</title>
131
+ <docidentifier>#{d['number']}</docidentifier>
132
+ <abstract>#{d['description']}</abstract>
133
+ </bibdata>
134
+ </relation>
134
135
  END
135
136
  end
136
137
 
137
138
  out += <<~END
138
- </bibdata>
139
- <sections>
139
+ </bibdata>
140
+ <sections>
140
141
  END
141
142
 
142
- out+=iterate(manifest["sections"], options)
143
+ out += iterate(manifest["sections"], options)
143
144
 
144
- out+= <<~END
145
- </sections>
146
- <#{options[:type]}-standard>
145
+ out += <<~END
146
+ </sections>
147
+ <#{options[:type]}-standard>
147
148
  END
148
149
  outfilename = options[:filename].sub(/\.[^.]+$/, ".xml")
149
150
  File.open(outfilename, "w") { |f| f.write out }
@@ -153,5 +154,8 @@ ext = :html
153
154
  file_extension = "html" || processor.output_formats[ext]
154
155
  outfilename = options[:filename].sub(/\.[^.]+$/, ".#{file_extension}")
155
156
  isodoc_options = { suppressheadingnumbers: true }
156
- isodoc_options[:htmlstylesheet] = manifest["htmlstylesheet"] if manifest["htmlstylesheet"]
157
+ if manifest["htmlstylesheet"]
158
+ isodoc_options[:htmlstylesheet] =
159
+ manifest["htmlstylesheet"]
160
+ end
157
161
  processor.output(out, outfilename, ext, isodoc_options)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Cli
3
- VERSION = "1.4.14".freeze
3
+ VERSION = "1.4.16".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.14
4
+ version: 1.4.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-16 00:00:00.000000000 Z
11
+ date: 2021-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug