metanorma-standoc 2.7.4 → 2.7.5

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: 67faf1005268886a18a869cd5cae9b22989946d6999317d446798521bd9b6728
4
- data.tar.gz: b3127ed75c593c211bda46f42cb1fe744f59b04337977a71e0213f2b1e6997a8
3
+ metadata.gz: 9d3fc596438edd06d1a0bbfa6ca008e650e22e9230048259f4b0696bde8a1087
4
+ data.tar.gz: 3b5c3569a642d7da4b61cb98aa999a2ad526e4f43265489bd99fa59c659e5d48
5
5
  SHA512:
6
- metadata.gz: bd52c09a6b065f0d097c277ec332c8d0b4dd9406fb6a71e42dfb514ba35b03b4d6f2316e6f808e55f99249b8b8c7f488fb137c65e044cb5b9abff2b8015d9824
7
- data.tar.gz: 61b6e99444cbd529626fcce026356070d5898f9607ef2239bbfd72d9445f15a81f8b06a5801057293d2838af8d300908365d566acd3ef66c3aedab0e9324c6d9
6
+ metadata.gz: 483f649b259da9b1a6b44736eb78979b3e06ad5ae29f666e0e2416ef3aa2193b22ea13b9aa14f2ac6b249020f6226f8912ab95cd2860458df767be62f6198127
7
+ data.tar.gz: ba5da0a5a7af09d8da8237fabeeb9bfe813e3d43d21295e04ea0b2f0bc9c0011d52a7da2c55df2a00fad8fe2568bd14e5e57b28fa761c0ed2535d72f0a22eeb4
data/Gemfile CHANGED
@@ -4,12 +4,6 @@ Encoding.default_internal = Encoding::UTF_8
4
4
  source "https://rubygems.org"
5
5
  git_source(:github) { |repo| "https://github.com/#{repo}" }
6
6
 
7
- group :development, :test do
8
- gem "rspec"
9
- end
10
-
11
- if File.exist? "Gemfile.devel"
12
- eval File.read("Gemfile.devel"), nil, "Gemfile.devel" # rubocop:disable Security/Eval
13
- end
14
-
15
7
  gemspec
8
+
9
+ eval_gemfile("Gemfile.devel") rescue nil
@@ -140,6 +140,14 @@ a.FootnoteRef, span.FootnoteRef {
140
140
  color: red;
141
141
  text-decoration: line-through; }
142
142
 
143
+ ruby {
144
+ ruby-position: over;
145
+ -webkit-ruby-position: before; }
146
+
147
+ ruby ruby {
148
+ ruby-position: under;
149
+ -webkit-ruby-position: after; }
150
+
143
151
  /* code highlighting with line numbers */
144
152
  table.rouge-line-table td.rouge-gutter {
145
153
  -moz-user-select: none;
@@ -87,18 +87,22 @@ module Metanorma
87
87
  end
88
88
 
89
89
  def init_toc(node)
90
- @htmltoclevels = node.attr("htmltoclevels") ||
90
+ @htmltoclevels = node.attr("toclevels-html") ||
91
+ node.attr("htmltoclevels") ||
91
92
  node.attr("toclevels") || toc_default[:html_levels]
92
- @doctoclevels = node.attr("doctoclevels") ||
93
- node.attr("toclevels") || toc_default[:word_levels]
94
- @toclevels = node.attr("toclevels") || toc_default[:word_levels]
93
+ @doctoclevels = node.attr("toclevels-doc") ||
94
+ node.attr("doctoclevels") || node.attr("toclevels") ||
95
+ toc_default[:word_levels]
96
+ @pdftoclevels = node.attr("toclevels-pdf") ||
97
+ node.attr("toclevels") || toc_default[:pdf_levels]
98
+ @toclevels = node.attr("toclevels") || toc_default[:html_levels]
95
99
  @tocfigures = node.attr("toc-figures")
96
100
  @toctables = node.attr("toc-tables")
97
101
  @tocrecommendations = node.attr("toc-recommendations")
98
102
  end
99
103
 
100
104
  def toc_default
101
- { word_levels: 2, html_levels: 2 }
105
+ { word_levels: 2, html_levels: 2, pdf_levels: 2 }
102
106
  end
103
107
 
104
108
  def init_output(node)
@@ -715,27 +715,36 @@
715
715
  </define>
716
716
  <define name="ruby">
717
717
  <element name="ruby">
718
- <zeroOrMore>
719
- <choice>
720
- <ref name="PureTextElement"/>
721
- <ref name="rp"/>
722
- <ref name="rt"/>
723
- </choice>
724
- </zeroOrMore>
718
+ <choice>
719
+ <ref name="ruby_pronunciation"/>
720
+ <ref name="ruby_annotation"/>
721
+ </choice>
722
+ <choice>
723
+ <text/>
724
+ <ref name="ruby"/>
725
+ </choice>
725
726
  </element>
726
727
  </define>
727
- <define name="rp">
728
- <element name="rp">
729
- <zeroOrMore>
730
- <ref name="PureTextElement"/>
731
- </zeroOrMore>
728
+ <define name="ruby_pronunciation">
729
+ <element name="pronunciation">
730
+ <attribute name="value"/>
731
+ <optional>
732
+ <attribute name="script"/>
733
+ </optional>
734
+ <optional>
735
+ <attribute name="lang"/>
736
+ </optional>
732
737
  </element>
733
738
  </define>
734
- <define name="rt">
735
- <element name="rt">
736
- <zeroOrMore>
737
- <ref name="PureTextElement"/>
738
- </zeroOrMore>
739
+ <define name="ruby_annotation">
740
+ <element name="annotation">
741
+ <attribute name="value"/>
742
+ <optional>
743
+ <attribute name="script"/>
744
+ </optional>
745
+ <optional>
746
+ <attribute name="lang"/>
747
+ </optional>
739
748
  </element>
740
749
  </define>
741
750
  <define name="br">
@@ -78,7 +78,7 @@ module Metanorma
78
78
  end
79
79
 
80
80
  def toc_metadata(xmldoc)
81
- @htmltoclevels || @doctoclevels || @toclevels or return
81
+ @htmltoclevels || @doctoclevels || @pdftoclevels || @toclevels or return
82
82
  ins = add_misc_container(xmldoc)
83
83
  toc_metadata1(ins)
84
84
  end
@@ -86,7 +86,8 @@ module Metanorma
86
86
  def toc_metadata1(ins)
87
87
  [[@toclevels, "TOC Heading Levels"],
88
88
  [@htmltoclevels, "HTML TOC Heading Levels"],
89
- [@doctoclevels, "DOC TOC Heading Levels"]].each do |n|
89
+ [@doctoclevels, "DOC TOC Heading Levels"],
90
+ [@pdftoclevels, "PDF TOC Heading Levels"]].each do |n|
90
91
  n[0] and ins << "<presentation-metadata><name>#{n[1]}</name>" \
91
92
  "<value>#{n[0]}</value></presentation-metadata>"
92
93
  end
@@ -22,7 +22,12 @@ module Metanorma
22
22
 
23
23
  def personal_role(node, contrib, suffix)
24
24
  type = node.attr("role#{suffix}")&.downcase || "author"
25
- contrib.role type: type
25
+ desc = node.attr("role-description#{suffix}")
26
+ contrib.role type: type do |r|
27
+ desc and r.description do |d|
28
+ d << desc
29
+ end
30
+ end
26
31
  end
27
32
 
28
33
  def personal_contact(node, suffix, person)
@@ -52,25 +52,32 @@ module Metanorma
52
52
  use_dsl
53
53
  named :ruby
54
54
  parse_content_as :text
55
- option :pos_attrs, %w(rpbegin rt rpend)
56
-
57
- # for example, html5ruby:楽聖少女[がくせいしょうじょ]
58
- def process(_parent, target, attributes)
59
- rpbegin = "("
60
- rpend = ")"
61
- if (attributes.size == 1) && attributes.key?("text")
62
- rt = attributes["text"]
63
- elsif (attributes.size == 2) && attributes.key?(1) &&
64
- attributes.key?("rpbegin")
65
- rt = attributes[1] || ""
66
- else
67
- rpbegin = attributes["rpbegin"]
68
- rt = attributes["rt"]
69
- rpend = attributes["rpend"]
55
+
56
+ # ruby:{annotation}[lang=ja,script=Hira,type=pronunciation|annotation,text]
57
+
58
+ def preprocess_attrs(text)
59
+ ret = {}
60
+ while m = /^(?<key>lang|script|type)=(?<val>[^,]+),(?<rest>.+)$/
61
+ .match(text)
62
+ text = m[:rest]
63
+ ret[m[:key].to_sym] = m[:val]
70
64
  end
65
+ ret[:text] = text
66
+ ret[:type] ||= "pronunciation"
67
+ ret[:type] == "annotation" or ret[:type] = "pronunciation"
68
+ ret
69
+ end
71
70
 
72
- "<ruby>#{target}<rp>#{rpbegin}</rp><rt>#{rt}</rt>" \
73
- "<rp>#{rpend}</rp></ruby>"
71
+ def process(parent, target, attributes)
72
+ args = preprocess_attrs(attributes["text"])
73
+ out = Nokogiri::XML(
74
+ create_block(parent, :paragraph, [args[:text]], {},
75
+ subs: [:macros], content_model: :simple).convert,
76
+ ).root.children.to_xml # force recurse macros
77
+ attrs = " value='#{target}'"
78
+ x = args[:lang] and attrs += " lang='#{x}'"
79
+ x = args[:script] and attrs += " script='#{x}'"
80
+ "<ruby><#{args[:type]} #{attrs}/>#{out}</ruby>"
74
81
  end
75
82
  end
76
83
 
@@ -17,8 +17,9 @@ module Metanorma
17
17
  scripts_override: node.attr("scripts-override"),
18
18
  scripts_pdf: node.attr("scripts-pdf"),
19
19
  datauriimage: node.attr("data-uri-image") != "false",
20
- htmltoclevels: node.attr("htmltoclevels") || node.attr("toclevels"),
21
- doctoclevels: node.attr("doctoclevels") || node.attr("toclevels"),
20
+ htmltoclevels: @htmltoclevels,
21
+ doctoclevels: @doctoclevels,
22
+ pdftoclevels: @pdftoclevels,
22
23
  breakupurlsintables: node.attr("break-up-urls-in-tables"),
23
24
  suppressasciimathdup: node.attr("suppress-asciimath-dup") == "true",
24
25
  bare: node.attr("bare"),
@@ -62,8 +63,9 @@ module Metanorma
62
63
  wordintropage: node.attr("wordintropage"),
63
64
  ulstyle: node.attr("ulstyle"),
64
65
  olstyle: node.attr("olstyle"),
65
- htmltoclevels: node.attr("htmltoclevels") || node.attr("toclevels"),
66
- doctoclevels: node.attr("doctoclevels") || node.attr("toclevels"),
66
+ htmltoclevels: @htmltoclevels,
67
+ doctoclevels: @doctoclevels,
68
+ pdftoclevels: @pdftoclevels,
67
69
  breakupurlsintables: node.attr("break-up-urls-in-tables"),
68
70
  suppressasciimathdup: node.attr("suppress-asciimath-dup"),
69
71
  bare: node.attr("bare"),
@@ -19,6 +19,6 @@ module Metanorma
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "2.7.4".freeze
22
+ VERSION = "2.7.5".freeze
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-standoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.4
4
+ version: 2.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-10 00:00:00.000000000 Z
11
+ date: 2023-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable