metanorma-ogc 2.4.7 → 2.5.0

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.
@@ -10197,14 +10197,16 @@
10197
10197
 
10198
10198
  <xsl:template match="*[local-name() = 'annex']">
10199
10199
  <fo:block break-after="page"/>
10200
- <fo:block id="{@id}">
10200
+ <fo:block>
10201
10201
 
10202
10202
  <xsl:call-template name="setBlockSpanAll"/>
10203
10203
 
10204
10204
  <xsl:call-template name="refine_annex_style"/>
10205
10205
 
10206
10206
  </fo:block>
10207
- <xsl:apply-templates/>
10207
+ <fo:block id="{@id}">
10208
+ <xsl:apply-templates/>
10209
+ </fo:block>
10208
10210
  </xsl:template>
10209
10211
 
10210
10212
  <xsl:template name="refine_annex_style">
@@ -10905,6 +10907,7 @@
10905
10907
  $namespace = 'mpfd' or $namespace = 'ogc' or $namespace = 'ogc-white-paper' -->
10906
10908
  <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
10907
10909
  <fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-style">
10910
+
10908
10911
  <fo:list-item>
10909
10912
  <fo:list-item-label end-indent="label-end()">
10910
10913
  <fo:block role="SKIP">
@@ -11108,10 +11111,10 @@
11108
11111
 
11109
11112
  <xsl:variable name="toc_level">
11110
11113
  <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
11111
- <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
11114
+ <xsl:variable name="pdftoclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'PDF TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :toclevels-pdf Number of table of contents levels to render in PDF output; used to override :toclevels:-->
11112
11115
  <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
11113
11116
  <xsl:choose>
11114
- <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
11117
+ <xsl:when test="$pdftoclevels != ''"><xsl:value-of select="number($pdftoclevels)"/></xsl:when> <!-- if there is value in xml -->
11115
11118
  <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
11116
11119
  <xsl:otherwise><!-- default value -->
11117
11120
  2
@@ -10197,14 +10197,16 @@
10197
10197
 
10198
10198
  <xsl:template match="*[local-name() = 'annex']">
10199
10199
  <fo:block break-after="page"/>
10200
- <fo:block id="{@id}">
10200
+ <fo:block>
10201
10201
 
10202
10202
  <xsl:call-template name="setBlockSpanAll"/>
10203
10203
 
10204
10204
  <xsl:call-template name="refine_annex_style"/>
10205
10205
 
10206
10206
  </fo:block>
10207
- <xsl:apply-templates/>
10207
+ <fo:block id="{@id}">
10208
+ <xsl:apply-templates/>
10209
+ </fo:block>
10208
10210
  </xsl:template>
10209
10211
 
10210
10212
  <xsl:template name="refine_annex_style">
@@ -10905,6 +10907,7 @@
10905
10907
  $namespace = 'mpfd' or $namespace = 'ogc' or $namespace = 'ogc-white-paper' -->
10906
10908
  <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
10907
10909
  <fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-style">
10910
+
10908
10911
  <fo:list-item>
10909
10912
  <fo:list-item-label end-indent="label-end()">
10910
10913
  <fo:block role="SKIP">
@@ -11108,10 +11111,10 @@
11108
11111
 
11109
11112
  <xsl:variable name="toc_level">
11110
11113
  <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
11111
- <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
11114
+ <xsl:variable name="pdftoclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'PDF TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :toclevels-pdf Number of table of contents levels to render in PDF output; used to override :toclevels:-->
11112
11115
  <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
11113
11116
  <xsl:choose>
11114
- <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
11117
+ <xsl:when test="$pdftoclevels != ''"><xsl:value-of select="number($pdftoclevels)"/></xsl:when> <!-- if there is value in xml -->
11115
11118
  <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
11116
11119
  <xsl:otherwise><!-- default value -->
11117
11120
  2
@@ -9248,14 +9248,16 @@
9248
9248
 
9249
9249
  <xsl:template match="*[local-name() = 'annex']">
9250
9250
  <fo:block break-after="page"/>
9251
- <fo:block id="{@id}">
9251
+ <fo:block>
9252
9252
 
9253
9253
  <xsl:call-template name="setBlockSpanAll"/>
9254
9254
 
9255
9255
  <xsl:call-template name="refine_annex_style"/>
9256
9256
 
9257
9257
  </fo:block>
9258
- <xsl:apply-templates/>
9258
+ <fo:block id="{@id}">
9259
+ <xsl:apply-templates/>
9260
+ </fo:block>
9259
9261
  </xsl:template>
9260
9262
 
9261
9263
  <xsl:template name="refine_annex_style">
@@ -9956,6 +9958,7 @@
9956
9958
  $namespace = 'mpfd' or $namespace = 'ogc' or $namespace = 'ogc-white-paper' -->
9957
9959
  <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
9958
9960
  <fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-style">
9961
+
9959
9962
  <fo:list-item>
9960
9963
  <fo:list-item-label end-indent="label-end()">
9961
9964
  <fo:block role="SKIP">
@@ -10159,10 +10162,10 @@
10159
10162
 
10160
10163
  <xsl:variable name="toc_level">
10161
10164
  <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
10162
- <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
10165
+ <xsl:variable name="pdftoclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'PDF TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :toclevels-pdf Number of table of contents levels to render in PDF output; used to override :toclevels:-->
10163
10166
  <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
10164
10167
  <xsl:choose>
10165
- <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
10168
+ <xsl:when test="$pdftoclevels != ''"><xsl:value-of select="number($pdftoclevels)"/></xsl:when> <!-- if there is value in xml -->
10166
10169
  <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
10167
10170
  <xsl:otherwise><!-- default value -->
10168
10171
  3
@@ -0,0 +1,112 @@
1
+ module IsoDoc
2
+ module Ogc
3
+ class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
4
+ def middle_title(docxml); end
5
+
6
+ def preface_rearrange(doc)
7
+ super
8
+ insert_preface_sections(doc)
9
+ end
10
+
11
+ def insert_preface_sections(doc)
12
+ preface_insert(doc.at(ns("//preface/clause" \
13
+ "[@type = 'executivesummary']")),
14
+ doc.at(ns("//preface/abstract")), doc)
15
+ preface_insert(doc.at(ns("//preface//submitters")),
16
+ submit_orgs_append_pt(doc), doc)
17
+ insert_submitting_orgs(doc)
18
+ preface_insert(doc.at(ns("//preface/clause[@type = 'security']")),
19
+ submit_orgs_append_pt(doc), doc)
20
+ insert_keywords(doc)
21
+ end
22
+
23
+ def preface_init_insert_pt(docxml)
24
+ docxml.at(ns("//preface")) ||
25
+ docxml.at(ns("//sections"))
26
+ .add_previous_sibling("<preface> </preface>").first
27
+ end
28
+
29
+ def preface_insert(clause, after, docxml)
30
+ clause or return
31
+ clause.remove
32
+ if after then after.next = clause
33
+ else
34
+ preface_init_insert_pt(docxml)&.children&.first
35
+ &.add_previous_sibling(clause)
36
+ end
37
+ end
38
+
39
+ def submit_orgs_append_pt(docxml)
40
+ docxml.at(ns("//foreword")) ||
41
+ docxml.at(ns("//preface/clause[@type = 'keywords']")) ||
42
+ docxml.at(ns("//preface/clause[@type = 'executivesummary']")) ||
43
+ docxml.at(ns("//preface/abstract"))
44
+ end
45
+
46
+ def insert_submitting_orgs(docxml)
47
+ orgs = docxml.xpath(ns(submittingorgs_path))
48
+ .each_with_object([]) { |org, m| m << org.text }
49
+ orgs.empty? and return
50
+ if a = submit_orgs_append_pt(docxml)
51
+ a.next = submitting_orgs_clause(orgs)
52
+ else
53
+ preface_init_insert_pt(docxml)&.children&.first
54
+ &.add_previous_sibling(submitting_orgs_clause(orgs))
55
+ end
56
+ end
57
+
58
+ def submitting_orgs_clause(orgs)
59
+ <<~SUBMITTING
60
+ <clause id="_#{UUIDTools::UUID.random_create}" type="submitting_orgs">
61
+ <title>Submitting Organizations</title>
62
+ <p>The following organizations submitted this Document to the Open Geospatial Consortium (OGC):</p>
63
+ <ul>#{orgs.map { |m| "<li>#{m}</li>" }.join("\n")}</ul>
64
+ </clause>
65
+ SUBMITTING
66
+ end
67
+
68
+ def keyword_clause(kwords)
69
+ <<~KEYWORDS
70
+ <clause id="_#{UUIDTools::UUID.random_create}" type="keywords">
71
+ <title>Keywords</title>
72
+ <p>The following are keywords to be used by search engines and document catalogues.</p>
73
+ <p>#{kwords.join(', ')}</p></clause>
74
+ KEYWORDS
75
+ end
76
+
77
+ def insert_keywords(docxml)
78
+ kw = @meta.get[:keywords]
79
+ kw.empty? and return
80
+ if abstract =
81
+ docxml.at(ns("//preface/clause[@type = 'executivesummary']")) ||
82
+ docxml.at(ns("//preface/abstract"))
83
+ abstract.next = keyword_clause(kw)
84
+ else
85
+ preface_init_insert_pt(docxml)&.children&.first
86
+ &.add_previous_sibling(keyword_clause(kw))
87
+ end
88
+ end
89
+
90
+ def annex1(elem)
91
+ lbl = @xrefs.anchor(elem["id"], :label)
92
+ t = elem.at(ns("./title")) and
93
+ t.children = "<strong>#{to_xml(t.children)}</strong>"
94
+ prefix_name(elem, "<br/>", lbl, "title")
95
+ end
96
+
97
+ def clause(docxml)
98
+ super
99
+ docxml.xpath(ns("//foreword | //preface/abstract | " \
100
+ "//submitters | //introduction | //acknowledgements"))
101
+ .each { |f| clause1(f) }
102
+ end
103
+
104
+ def clause1(elem)
105
+ elem.name == "terms" && elem.parent.name == "annex" &&
106
+ elem.parent.xpath(ns("./terms")).size == 1 and return
107
+ elem.name == "clause" && elem["type"] == "toc" and return
108
+ super
109
+ end
110
+ end
111
+ end
112
+ end
@@ -1,6 +1,6 @@
1
1
  require_relative "init"
2
- require "uuidtools"
3
2
  require_relative "../../relaton/render/general"
3
+ require_relative "presentation_sections"
4
4
 
5
5
  module IsoDoc
6
6
  module Ogc
@@ -10,8 +10,6 @@ module IsoDoc
10
10
  super
11
11
  end
12
12
 
13
- def middle_title(docxml); end
14
-
15
13
  def convert1(docxml, filename, dir)
16
14
  info docxml, nil
17
15
  super
@@ -21,123 +19,100 @@ module IsoDoc
21
19
  File.read(File.join(@libdir, "html", "rouge.css"))
22
20
  end
23
21
 
24
- def preface_rearrange(doc)
25
- super
26
- insert_preface_sections(doc)
27
- end
28
-
29
- def insert_preface_sections(doc)
30
- preface_insert(doc.at(ns("//preface/clause" \
31
- "[@type = 'executivesummary']")),
32
- doc.at(ns("//preface/abstract")), doc)
33
- preface_insert(doc.at(ns("//preface//submitters")),
34
- submit_orgs_append_pt(doc), doc)
35
- insert_submitting_orgs(doc)
36
- preface_insert(doc.at(ns("//preface/clause[@type = 'security']")),
37
- submit_orgs_append_pt(doc), doc)
38
- insert_keywords(doc)
39
- end
40
-
41
- def preface_init_insert_pt(docxml)
42
- docxml.at(ns("//preface")) ||
43
- docxml.at(ns("//sections"))
44
- .add_previous_sibling("<preface> </preface>").first
45
- end
46
-
47
- def preface_insert(clause, after, docxml)
48
- clause or return
49
- clause.remove
50
- if after then after.next = clause
51
- else
52
- preface_init_insert_pt(docxml)&.children&.first
53
- &.add_previous_sibling(clause)
22
+ def example1(elem)
23
+ lbl = @xrefs.anchor(elem["id"], :label, false) or return
24
+ prefix_name(elem, block_delim, l10n("#{@i18n.example} #{lbl}"),
25
+ "name")
26
+ end
27
+
28
+ def bibdata(docxml)
29
+ docxml.xpath(ns("//bibdata/contributor[@type = 'author']")).each do |a|
30
+ a.at(ns("./description"))&.text == "contributor" and
31
+ a["type"] = "contributor"
54
32
  end
33
+ super
34
+ dochistory_insert(docxml)
55
35
  end
56
36
 
57
- def submit_orgs_append_pt(docxml)
58
- docxml.at(ns("//foreword")) ||
59
- docxml.at(ns("//preface/clause[@type = 'keywords']")) ||
60
- docxml.at(ns("//preface/clause[@type = 'executivesummary']")) ||
61
- docxml.at(ns("//preface/abstract"))
37
+ UPDATE_RELATIONS = <<~XPATH.freeze
38
+ //bibdata/relation[@type = 'updatedBy' or @type = 'merges' or @type = 'splits' or @type = 'hasDraft']/bibitem
39
+ XPATH
40
+
41
+ def dochistory_insert(docxml)
42
+ updates = docxml.xpath(ns(UPDATE_RELATIONS))
43
+ updates.empty? and return
44
+ fwd = annex_insert_point(docxml)
45
+ generate_dochistory(updates, fwd)
62
46
  end
63
47
 
64
- def insert_submitting_orgs(docxml)
65
- orgs = docxml.xpath(ns(submittingorgs_path))
66
- .each_with_object([]) { |org, m| m << org.text }
67
- orgs.empty? and return
68
- if a = submit_orgs_append_pt(docxml)
69
- a.next = submitting_orgs_clause(orgs)
70
- else
71
- preface_init_insert_pt(docxml)&.children&.first
72
- &.add_previous_sibling(submitting_orgs_clause(orgs))
73
- end
48
+ def annex_insert_point(docxml)
49
+ docxml.at(ns("//annex[last()]")) || docxml.at(ns("//sections"))
74
50
  end
75
51
 
76
- def submitting_orgs_clause(orgs)
77
- <<~SUBMITTING
78
- <clause id="_#{UUIDTools::UUID.random_create}" type="submitting_orgs">
79
- <title>Submitting Organizations</title>
80
- <p>The following organizations submitted this Document to the Open Geospatial Consortium (OGC):</p>
81
- <ul>#{orgs.map { |m| "<li>#{m}</li>" }.join("\n")}</ul>
82
- </clause>
83
- SUBMITTING
84
- end
85
-
86
- def keyword_clause(kwords)
87
- <<~KEYWORDS
88
- <clause id="_#{UUIDTools::UUID.random_create}" type="keywords">
89
- <title>Keywords</title>
90
- <p>The following are keywords to be used by search engines and document catalogues.</p>
91
- <p>#{kwords.join(', ')}</p></clause>
92
- KEYWORDS
93
- end
94
-
95
- def insert_keywords(docxml)
96
- kw = @meta.get[:keywords]
97
- kw.empty? and return
98
- if abstract =
99
- docxml.at(ns("//preface/clause[@type = 'executivesummary']")) ||
100
- docxml.at(ns("//preface/abstract"))
101
- abstract.next = keyword_clause(kw)
102
- else
103
- preface_init_insert_pt(docxml)&.children&.first
104
- &.add_previous_sibling(keyword_clause(kw))
105
- end
52
+ def generate_dochistory(updates, pref)
53
+ ret = updates.map { |u| generate_dochistory_row(u) }.flatten.join("\n")
54
+ pref.next = <<~XML
55
+ <annex id='_#{UUIDTools::UUID.random_create}' obligation='informative'>
56
+ <title>#{@i18n.dochistory}</title>
57
+ <table><thead>
58
+ <tr><th>Date</th><th>Release</th><th>Author</th><th>Paragraph Modified</th><th>Description</th></tr>
59
+ </thead><tbody>
60
+ #{ret}
61
+ </tbody></table></annex>
62
+ XML
106
63
  end
107
64
 
108
- def example1(elem)
109
- lbl = @xrefs.anchor(elem["id"], :label, false) or return
110
- prefix_name(elem, block_delim, l10n("#{@i18n.example} #{lbl}"),
111
- "name")
65
+ def generate_dochistory_row(item)
66
+ e = item.at(ns("./edition")) || item.at(ns("./version/draft"))
67
+ date = dochistory_date(item)
68
+ c = dochistory_contributors(item)
69
+ l = dochistory_location(item)
70
+ desc = dochistory_description(item)
71
+ "<tr><td>#{date}</td><td>#{e&.text}</td><td>#{c}</td>" \
72
+ "<td>#{l}</td><td>#{desc}</td></tr>"
112
73
  end
113
74
 
114
- def annex1(elem)
115
- lbl = @xrefs.anchor(elem["id"], :label)
116
- t = elem.at(ns("./title")) and
117
- t.children = "<strong>#{to_xml(t.children)}</strong>"
118
- prefix_name(elem, "<br/>", lbl, "title")
75
+ def dochistory_date(item)
76
+ d = item.at(ns("./date[@type = 'updated']")) ||
77
+ item.at(ns("./date[@type = 'published']")) ||
78
+ item.at(ns("./date[@type = 'issued']")) or return ""
79
+ d.text.strip
119
80
  end
120
81
 
121
- def clause(docxml)
122
- super
123
- docxml.xpath(ns("//foreword | //preface/abstract | " \
124
- "//submitters | //introduction | //acknowledgements"))
125
- .each { |f| clause1(f) }
82
+ def dochistory_contributors(item)
83
+ item.xpath(ns("./contributor")).map do |c|
84
+ dochistory_contributor(c)
85
+ end.join(", ")
126
86
  end
127
87
 
128
- def clause1(elem)
129
- elem.name == "terms" && elem.parent.name == "annex" &&
130
- elem.parent.xpath(ns("./terms")).size == 1 and return
131
- elem.name == "clause" && elem["type"] == "toc" and return
132
- super
88
+ def dochistory_contributor(contrib)
89
+ ret = contrib.at("./organization/subdivision") ||
90
+ contrib.at("./organization/name") ||
91
+ contrib.at("./person/name/abbreviation") ||
92
+ contrib.at("./person/name/completename")
93
+ ret and return ret.text
94
+ format_personalname(contrib)
133
95
  end
134
96
 
135
- def bibdata(docxml)
136
- docxml.xpath(ns("//bibdata/contributor[@type = 'author']")).each do |a|
137
- a.at(ns("./description"))&.text == "contributor" and
138
- a["type"] = "contributor"
139
- end
140
- super
97
+ def format_personalname(contrib)
98
+ Relaton::Render::Ogc::General
99
+ .new(template: { book: "{{ creatornames }}" })
100
+ .render("<bibitem type='book'>#{contrib.to_xml}</bibitem>",
101
+ embedded: true)
102
+ end
103
+
104
+ def dochistory_description(item)
105
+ d = item.at(ns("./amend/description")) or return ""
106
+ d.children.to_xml
107
+ end
108
+
109
+ def dochistory_location(item)
110
+ t = item.at(ns("./amend/location")) or return "All"
111
+ xpath = "./amend/location/locality | ./amend/location/localityStack"
112
+ r = eref_localities(item.xpath(ns(xpath)), nil, t)
113
+ r.sub!(/^, /, "")
114
+ r == @i18n.wholeoftext and r = "All"
115
+ r
141
116
  end
142
117
 
143
118
  def bibdata_i18n(bib)
@@ -203,7 +178,7 @@ module IsoDoc
203
178
  # else, use both ordinal, as prefix, and ids
204
179
  def biblio_ref_entry_code(ordinal, ids, _id, standard, datefn, _bib)
205
180
  standard and return "[#{ordinal}]<tab/>"
206
- ret = (ids[:ordinal] || ids[:metanorma] || "[#{ordinal}]")
181
+ ret = ids[:ordinal] || ids[:metanorma] || "[#{ordinal}]"
207
182
  prefix_bracketed_ref("#{ret}#{datefn}")
208
183
  end
209
184
 
@@ -95,8 +95,89 @@
95
95
  <ref name="pagebreak"/>
96
96
  <ref name="hr"/>
97
97
  <ref name="bookmark"/>
98
+ <ref name="amend"/>
98
99
  </choice>
99
100
  </define>
101
+ <define name="amend">
102
+ <element name="amend">
103
+ <ref name="AmendType"/>
104
+ </element>
105
+ </define>
106
+ <define name="AmendType">
107
+ <optional>
108
+ <attribute name="id">
109
+ <data type="ID"/>
110
+ </attribute>
111
+ </optional>
112
+ <attribute name="change">
113
+ <choice>
114
+ <value>add</value>
115
+ <value>modify</value>
116
+ <value>delete</value>
117
+ <value>replace</value>
118
+ </choice>
119
+ </attribute>
120
+ <optional>
121
+ <attribute name="path"/>
122
+ </optional>
123
+ <optional>
124
+ <attribute name="path_end"/>
125
+ </optional>
126
+ <optional>
127
+ <attribute name="title"/>
128
+ </optional>
129
+ <optional>
130
+ <element name="location">
131
+ <zeroOrMore>
132
+ <choice>
133
+ <ref name="locality"/>
134
+ <ref name="localityStack"/>
135
+ </choice>
136
+ </zeroOrMore>
137
+ </element>
138
+ </optional>
139
+ <optional>
140
+ <element name="description">
141
+ <zeroOrMore>
142
+ <ref name="BasicBlock"/>
143
+ </zeroOrMore>
144
+ </element>
145
+ </optional>
146
+ <optional>
147
+ <element name="newcontent">
148
+ <optional>
149
+ <attribute name="id">
150
+ <data type="ID"/>
151
+ </attribute>
152
+ </optional>
153
+ <zeroOrMore>
154
+ <ref name="BasicBlock"/>
155
+ </zeroOrMore>
156
+ </element>
157
+ </optional>
158
+ <zeroOrMore>
159
+ <ref name="classification"/>
160
+ </zeroOrMore>
161
+ <zeroOrMore>
162
+ <ref name="contributor"/>
163
+ </zeroOrMore>
164
+ </define>
165
+ <define name="classification">
166
+ <element name="classification">
167
+ <ref name="classification_tag"/>
168
+ <ref name="classification_value"/>
169
+ </element>
170
+ </define>
171
+ <define name="classification_tag">
172
+ <element name="tag">
173
+ <text/>
174
+ </element>
175
+ </define>
176
+ <define name="classification_value">
177
+ <element name="value">
178
+ <text/>
179
+ </element>
180
+ </define>
100
181
  <define name="paragraph">
101
182
  <element name="p">
102
183
  <ref name="ParagraphType"/>
@@ -715,27 +796,36 @@
715
796
  </define>
716
797
  <define name="ruby">
717
798
  <element name="ruby">
718
- <zeroOrMore>
719
- <choice>
720
- <ref name="PureTextElement"/>
721
- <ref name="rp"/>
722
- <ref name="rt"/>
723
- </choice>
724
- </zeroOrMore>
799
+ <choice>
800
+ <ref name="ruby_pronunciation"/>
801
+ <ref name="ruby_annotation"/>
802
+ </choice>
803
+ <choice>
804
+ <text/>
805
+ <ref name="ruby"/>
806
+ </choice>
725
807
  </element>
726
808
  </define>
727
- <define name="rp">
728
- <element name="rp">
729
- <zeroOrMore>
730
- <ref name="PureTextElement"/>
731
- </zeroOrMore>
809
+ <define name="ruby_pronunciation">
810
+ <element name="pronunciation">
811
+ <attribute name="value"/>
812
+ <optional>
813
+ <attribute name="script"/>
814
+ </optional>
815
+ <optional>
816
+ <attribute name="lang"/>
817
+ </optional>
732
818
  </element>
733
819
  </define>
734
- <define name="rt">
735
- <element name="rt">
736
- <zeroOrMore>
737
- <ref name="PureTextElement"/>
738
- </zeroOrMore>
820
+ <define name="ruby_annotation">
821
+ <element name="annotation">
822
+ <attribute name="value"/>
823
+ <optional>
824
+ <attribute name="script"/>
825
+ </optional>
826
+ <optional>
827
+ <attribute name="lang"/>
828
+ </optional>
739
829
  </element>
740
830
  </define>
741
831
  <define name="br">
@@ -930,18 +1020,12 @@
930
1020
  </optional>
931
1021
  <optional>
932
1022
  <attribute name="width">
933
- <choice>
934
- <data type="int"/>
935
- <value>auto</value>
936
- </choice>
1023
+ <ref name="ImageSize"/>
937
1024
  </attribute>
938
1025
  </optional>
939
1026
  <optional>
940
1027
  <attribute name="height">
941
- <choice>
942
- <data type="int"/>
943
- <value>auto</value>
944
- </choice>
1028
+ <ref name="ImageSize"/>
945
1029
  </attribute>
946
1030
  </optional>
947
1031
  <optional>
@@ -956,6 +1040,14 @@
956
1040
  </attribute>
957
1041
  </optional>
958
1042
  </define>
1043
+ <define name="ImageSize">
1044
+ <choice>
1045
+ <data type="string">
1046
+ <param name="pattern">\d+([.]\d+)?(%?)</param>
1047
+ </data>
1048
+ <value>auto</value>
1049
+ </choice>
1050
+ </define>
959
1051
  <define name="video">
960
1052
  <element name="video">
961
1053
  <attribute name="id">