isodoc 1.1.0 → 1.1.1

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: 5b5e9597107793ecac111d5706640c399dcdec0411fdf49489c7058cf342bac2
4
- data.tar.gz: 0b488bc57ff9c36a418f0012a49d68111a2e5f519a0a5d6191d201db99356526
3
+ metadata.gz: 0fe7dc7a4c361573ce166000c4b747853185889ed1385f6219da5ecd9bf33b73
4
+ data.tar.gz: 2da4bf7a5c8a282bdfee95b96b99322c246712405b429404d5accf3385f9b360
5
5
  SHA512:
6
- metadata.gz: 26660b7ac5d08b63f0846c5d8a3caea1f58eed0491c1fcfe83ee3d3b9b3d73da9eaf57636fc48ed84370f12a1dd25e6043b5372750b03d6fc20547be0c6f22f0
7
- data.tar.gz: 99fe284cd22c1c19dc3f4528ae057857194b0354f55cf31414b1dbc1d54f9c564b1b45101faaad426c69fb2fb15dd3ae2186d0532a95a1675f5b92f7658d7546
6
+ metadata.gz: 62e7510c6f20ac7d8773d112bc25957c543097164e3b794dcc05d9b241be70317ea37295e9da8d3fcf61aec5597471091af2912277977db1fa266dd3f5351cae
7
+ data.tar.gz: 6c09ae0a60b767cd4d3dd4ce22a6df2609ea8d1a21f29863a5c5ca27283ebe5897f0d530bf89212dc7b8cd4788641f66d04d646a04189f9c3c379e058d3c50c7
@@ -1,3 +1,5 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
1
3
  name: macos
2
4
 
3
5
  on:
@@ -27,22 +29,14 @@ jobs:
27
29
  uses: actions/setup-ruby@v1
28
30
  with:
29
31
  ruby-version: ${{ matrix.ruby }}
30
- architecture: 'x64'
31
- - name: Update gems
32
- run: |
33
- sudo gem install bundler --force
34
- bundle install --jobs 4 --retry 3
35
- - name: Use Node
36
- uses: actions/setup-node@v1
37
- with:
38
- node-version: '12'
39
- - name: Install Puppeteer
40
- run: |
41
- npm install -g puppeteer@3.0.1
42
32
  - name: Install Inkscape
43
33
  run: |
44
34
  brew cask install inkscape
45
35
  inkscape --version
36
+ - name: Update gems
37
+ run: |
38
+ sudo gem install bundler --force
39
+ bundle install --jobs 4 --retry 3
46
40
  - name: Run specs
47
41
  run: |
48
42
  bundle exec rake
@@ -1,8 +1,12 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
1
3
  name: ubuntu
2
4
 
3
5
  on:
4
6
  push:
5
7
  branches: [ master ]
8
+ tags:
9
+ - '*'
6
10
  pull_request:
7
11
  paths-ignore:
8
12
  - .github/workflows/macos.yml
@@ -27,38 +31,32 @@ jobs:
27
31
  uses: actions/setup-ruby@v1
28
32
  with:
29
33
  ruby-version: ${{ matrix.ruby }}
30
- architecture: 'x64'
31
- - name: Update gems
32
- run: |
33
- gem install bundler
34
- bundle install --jobs 4 --retry 3
35
- - name: Use Node
36
- uses: actions/setup-node@v1
37
- with:
38
- node-version: '12'
39
- - name: Install Puppeteer
40
- run: |
41
- sudo apt-get update
42
- sudo apt-get install libgbm1
43
- npm install -g puppeteer@3.0.1
44
34
  - name: Install Inkscape
45
35
  run: |
46
36
  sudo add-apt-repository ppa:inkscape.dev/stable
47
37
  sudo apt update
48
38
  sudo apt install inkscape
49
39
  inkscape --version
40
+ - name: Update gems
41
+ run: |
42
+ gem install bundler
43
+ bundle install --jobs 4 --retry 3
50
44
  - name: Run specs
51
45
  run: |
52
46
  bundle exec rake
53
- - name: Trigger dependent repositories
54
- if: github.ref == 'refs/heads/master' && matrix.ruby == '2.6'
47
+ - name: Trigger repositories
48
+ if: matrix.ruby == '2.6'
55
49
  env:
56
- GH_USERNAME: ${{ secrets.PAT_USERNAME }}
57
- GH_ACCESS_TOKEN: ${{ secrets.PAT_TOKEN }}
50
+ GH_USERNAME: metanorma-ci
51
+ GH_ACCESS_TOKEN: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
58
52
  run: |
59
53
  curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
60
54
  [[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
61
- for repo in $DEPENDENT_REPOS
55
+ CLIENT_PAYLOAD=$(cat <<EOF
56
+ "{ "ref": "${GITHUB_REF}", "repo": "${GITHUB_REPOSITORY}" }"
57
+ EOF
58
+ )
59
+ for repo in $REPOS
62
60
  do
63
- sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY
61
+ sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "$CLIENT_PAYLOAD"
64
62
  done
@@ -1,3 +1,5 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
1
3
  name: windows
2
4
 
3
5
  on:
@@ -27,24 +29,16 @@ jobs:
27
29
  uses: actions/setup-ruby@v1
28
30
  with:
29
31
  ruby-version: ${{ matrix.ruby }}
30
- architecture: 'x64'
32
+ - name: Install Inkscape
33
+ run: |
34
+ choco install --no-progress -y inkscape
35
+ inkscape --version
31
36
  - name: Update gems
32
37
  shell: pwsh
33
38
  run: |
34
39
  gem install bundler
35
40
  bundle config --local path vendor/bundle
36
41
  bundle install --jobs 4 --retry 3
37
- - name: Use Node
38
- uses: actions/setup-node@v1
39
- with:
40
- node-version: '12'
41
- - name: Install Puppeteer
42
- run: |
43
- npm install -g puppeteer@3.0.1
44
- - name: Install Inkscape
45
- run: |
46
- choco install --no-progress -y inkscape
47
- inkscape --version
48
42
  - name: Run specs
49
43
  run: |
50
44
  bundle exec rake
@@ -16,22 +16,24 @@ module IsoDoc::Function
16
16
  identifiers = render_identifier(ids)
17
17
  if biblio then ref_entry_code(ref, ordinal, identifiers, ids)
18
18
  else
19
- ref << "#{identifiers[0] || identifiers[1]}, "
20
- ref << "#{identifiers[1]}, " if identifiers[0] && identifiers[1]
19
+ ref << "#{identifiers[0] || identifiers[1]}"
20
+ ref << ", #{identifiers[1]}" if identifiers[0] && identifiers[1]
21
21
  end
22
+ ref << ", " unless biblio && !identifiers[1]
22
23
  reference_format(b, ref)
23
24
  end
24
25
  end
25
26
 
26
27
  def std_bibitem_entry(list, b, ordinal, biblio)
27
28
  list.p **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
28
- ids = bibitem_ref_code(b)
29
- identifiers = render_identifier(ids)
30
- prefix_bracketed_ref(ref, "[#{ordinal}]") if biblio
31
- ref << "#{identifiers[0] || identifiers[1]}"
32
- ref << ", #{identifiers[1]}" if identifiers[0] && identifiers[1]
29
+ identifiers = render_identifier(bibitem_ref_code(b))
30
+ if biblio then ref_entry_code(ref, ordinal, identifiers, nil)
31
+ else
32
+ ref << "#{identifiers[0] || identifiers[1]}"
33
+ ref << ", #{identifiers[1]}" if identifiers[0] && identifiers[1]
34
+ end
33
35
  date_note_process(b, ref)
34
- ref << ", "
36
+ ref << ", " unless biblio && !identifiers[1]
35
37
  reference_format(b, ref)
36
38
  end
37
39
  end
@@ -40,9 +42,7 @@ module IsoDoc::Function
40
42
  # else, use both ordinal, as prefix, and t
41
43
  def ref_entry_code(r, ordinal, t, id)
42
44
  prefix_bracketed_ref(r, t[0] || "[#{ordinal}]")
43
- if t[1]
44
- r << "#{t[1]}, "
45
- end
45
+ t[1] and r << "#{t[1]}"
46
46
  end
47
47
 
48
48
  def pref_ref_code(b)
@@ -153,22 +153,33 @@ module IsoDoc::Function
153
153
  end
154
154
  end
155
155
 
156
+ def norm_ref_xpath
157
+ "//bibliography/references[@normative = 'true'] | "\
158
+ "//bibliography/clause[.//references[@normative = 'true']]"
159
+ end
160
+
156
161
  def norm_ref(isoxml, out, num)
157
- q = "//bibliography/references[@normative = 'true']"
158
- f = isoxml.at(ns(q)) or return num
162
+ f = isoxml.at(ns(norm_ref_xpath)) or return num
159
163
  out.div do |div|
160
164
  num = num + 1
161
165
  clause_name(num, @normref_lbl, div, nil)
162
- biblio_list(f, div, false)
166
+ if f.name == "clause"
167
+ f.elements.each { |e| parse(e, div) unless e.name == "title" }
168
+ else
169
+ biblio_list(f, div, false)
170
+ end
163
171
  end
164
172
  num
165
173
  end
166
174
 
167
- BIBLIOGRAPHY_XPATH = "//bibliography/clause[.//references[@normative = 'false']] | "\
168
- "//bibliography/references[@normative = 'false']".freeze
175
+ def bibliography_xpath
176
+ "//bibliography/clause[.//references]"\
177
+ "[not(.//references[@normative = 'true'])] | "\
178
+ "//bibliography/references[@normative = 'false']"
179
+ end
169
180
 
170
181
  def bibliography(isoxml, out)
171
- f = isoxml.at(ns(BIBLIOGRAPHY_XPATH)) || return
182
+ f = isoxml.at(ns(bibliography_xpath)) || return
172
183
  page_break(out)
173
184
  out.div do |div|
174
185
  div.h1 @bibliography_lbl, **{ class: "Section3" }
@@ -18,7 +18,7 @@ module IsoDoc::Function
18
18
 
19
19
  def init_file(filename, debug)
20
20
  filepath = Pathname.new(filename)
21
- filename = filepath.sub_ext('').to_s
21
+ filename = filepath.sub_ext('').sub(/\.presentation$/, "").to_s
22
22
  dir = "#{filename}_files"
23
23
  unless debug
24
24
  Dir.mkdir(dir, 0777) unless File.exists?(dir)
@@ -45,7 +45,7 @@ module IsoDoc::Function
45
45
  head.style do |style|
46
46
  @standardstylesheet.open
47
47
  stylesheet = @standardstylesheet.read.
48
- gsub("FILENAME", File.basename(filename))
48
+ gsub("FILENAME", File.basename(filename).sub(/\.presentation$/, ""))
49
49
  style.comment "\n#{stylesheet}\n"
50
50
  end
51
51
  end
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "1.1.0".freeze
2
+ VERSION = "1.1.1".freeze
3
3
  end
@@ -5,9 +5,7 @@ module IsoDoc::XrefGen
5
5
  annex_names(c, (65 + i).chr.to_s)
6
6
  end
7
7
  docxml.xpath(
8
- ns("//bibliography/clause[.//references[@normative = 'false']] | "\
9
- "//bibliography/references[@normative = 'false']"
10
- )).each do |b|
8
+ ns(@klass.bibliography_xpath)).each do |b|
11
9
  preface_names(b)
12
10
  end
13
11
  docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |ref|
@@ -20,9 +18,7 @@ module IsoDoc::XrefGen
20
18
  # potentially overridden in middle_section_asset_names()
21
19
  sequential_asset_names(d.xpath(ns("//preface/*")))
22
20
  n = section_names(d.at(ns("//clause[title = 'Scope']")), 0, 1)
23
- n = section_names(d.at(ns(
24
- "//bibliography/clause[.//references[@normative = 'true']] | "\
25
- "//bibliography/references[@normative = 'true']")), n, 1)
21
+ n = section_names(d.at(ns(@klass.norm_ref_xpath)), n, 1)
26
22
  n = section_names(d.at(ns("//sections/terms | "\
27
23
  "//sections/clause[descendant::terms]")), n, 1)
28
24
  n = section_names(d.at(ns("//sections/definitions")), n, 1)
@@ -65,7 +61,7 @@ module IsoDoc::XrefGen
65
61
 
66
62
  def middle_section_asset_names(d)
67
63
  middle_sections = "//clause[title = 'Scope'] | "\
68
- "//references[@normative = 'true'] | "\
64
+ "#{@klass.norm_ref_xpath} | "\
69
65
  "//sections/terms | //preface/* | "\
70
66
  "//sections/definitions | //clause[parent::sections]"
71
67
  sequential_asset_names(d.xpath(ns(middle_sections)))
@@ -231,7 +231,7 @@ RSpec.describe IsoDoc do
231
231
  <i>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</i>
232
232
  </p>
233
233
  <p id='ref12' class='Biblio'>
234
- [6]&#160; Citn, IETF RFC 20, CitationWorks. 2019.
234
+ Citn&#160; IETF RFC 20, CitationWorks. 2019.
235
235
  <i>How to cite a reference</i>
236
236
  .
237
237
  </p>
@@ -1109,5 +1109,57 @@ OUTPUT
1109
1109
  OUTPUT
1110
1110
  end
1111
1111
 
1112
+ it "processes clauses containing normative references" do
1113
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1114
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1115
+ <bibliography>
1116
+ <clause id="D" obligation="informative">
1117
+ <title>Bibliography</title>
1118
+ <references id="E" obligation="informative" normative="false">
1119
+ <title>Bibliography Subsection 1</title>
1120
+ </references>
1121
+ <references id="F" obligation="informative" normative="false">
1122
+ <title>Bibliography Subsection 2</title>
1123
+ </references>
1124
+ </clause>
1125
+ <clause id="A" obligation="informative"><title>First References</title>
1126
+ <references id="B" obligation="informative" normative="true">
1127
+ <title>Normative References 1</title>
1128
+ </references>
1129
+ <references id="C" obligation="informative" normative="false">
1130
+ <title>Normative References 2</title>
1131
+ </references>
1132
+ </clause>
1133
+
1134
+ </bibliography>
1135
+ INPUT
1136
+ #{HTML_HDR}
1137
+ <p class='zzSTDTitle1'/>
1138
+ <div>
1139
+ <h1>1.&#160; Normative references</h1>
1140
+ <div>
1141
+ <h2>1.1.&#160; Normative References 1</h2>
1142
+ </div>
1143
+ <div>
1144
+ <h2>1.2.&#160; Normative References 2</h2>
1145
+ </div>
1146
+ </div>
1147
+ <br/>
1148
+ <div>
1149
+ <h1 class='Section3'>Bibliography</h1>
1150
+ <div>
1151
+ <h2 class='Section3'>Bibliography Subsection 1</h2>
1152
+ </div>
1153
+ <div>
1154
+ <h2 class='Section3'>Bibliography Subsection 2</h2>
1155
+ </div>
1156
+ </div>
1157
+ </div>
1158
+ </body>
1159
+ </html>
1160
+
1161
+ OUTPUT
1162
+ end
1163
+
1112
1164
 
1113
1165
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
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-06-26 00:00:00.000000000 Z
11
+ date: 2020-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath