Skip to content

Commit 545f7ca

Browse files
committed
Presentation XML terms refactor: metanorma/isodoc#630
1 parent 3a13d95 commit 545f7ca

File tree

2 files changed

+53
-59
lines changed

2 files changed

+53
-59
lines changed

grammars/isodoc-presentation.rnc

+52-58
Original file line numberDiff line numberDiff line change
@@ -285,15 +285,19 @@ TermSource =
285285
## Concatenate all consecutive term sources and block sources into a single semicolon delimited expression
286286
termsource?
287287

288-
termsource = element termsource {
288+
## Concatenate all consecutive term sources and block sources into a single semicolon delimited expression
289+
fmt_termsource = element fmt-termsource {
289290
attribute status { SourceStatusType },
290291
attribute type { SourceTypeType },
291292
origin,
292-
## UNWRAP: Replace modification with a commma, then text representing the status, then a dash, then text representing the modification
293+
## Replace modification with a commma, then text representing the status, then a dash, then text representing the modification
293294
## e.g.
294295
## <termsource status="adapted"><origin>...</origin><modification>enhanced</modification></termsource>
295296
## becomes:
296-
## <termsource status="adapted"><origin>...</origin>, adapted – enhanced</termsource>
297+
## <fmt-termsource status="adapted"><semx element='termsource'>
298+
## <origin>...</origin>,
299+
## adapted – <semx element='modification'>enhanced</semx>
300+
## </semx></fmt-termsource>
297301
TextElement*
298302
}
299303

@@ -326,18 +330,17 @@ concept = element concept {
326330
)
327331
}
328332

329-
## UNWRAP: replace <related> with the crossreference to the term being related to
330-
related =
331-
## paragraph is:
332-
## <p><strong>{related/@type}:</strong> <em>{related/preferred}</em>
333-
## ({related/xref | related/eref | related/termref})</p>
334-
## e.g.
335-
## <related type='contrast'><preferred><expression><name>Fifth Designation</name></expression></preferred>
336-
## <xref target='second'/></related>
337-
## becomes:
338-
## <p><strong>CONTRAST:</strong> <em><preferred><strong>Fifth Designation</strong></preferred></em>
339-
## (<xref target='second'>Clause 1.1</xref>)</p>
340-
paragraph
333+
## replace <related> with the crossreference to the term being related to (wrapped in semx for related)
334+
## paragraph is:
335+
## <p><strong>{related/@type}:</strong> <em>{related/preferred}</em>
336+
## ({related/xref | related/eref | related/termref})</p>
337+
## e.g.
338+
## <related type='contrast'><preferred><expression><name>Fifth Designation</name></expression></preferred>
339+
## <xref target='second'/></related>
340+
## becomes:
341+
## <p><strong>CONTRAST:</strong> <em><semx element="preferred"><strong>Fifth Designation</strong></semx></em>
342+
## (<xref target='second'>Clause 1.1</xref>)</p>
343+
fmt_related = element fmt-related { paragraph }
341344

342345
erefAttributes =
343346
attribute normative { xsd:boolean }?,
@@ -424,10 +427,10 @@ attribution-para = element p {
424427
TextElement* & quote-author & quote-source
425428
}
426429

427-
## TODO the same has been done for term definitions: we are inserting domain as a Semantic XML into the first definition
428-
## paragraph, rather than leaving that to the renderer. In the future, we will make that instead a span with class fmt-domain,
429-
## pointing to the source domain element. I'm not updating the grammar for now, because it would be nightmarish to and will not persist.
430-
termdefinition &= empty
430+
## The term domain may be inserted into fmt_termdefinition via semx.
431+
## Multiple termdefinitions are replaced with a single definition, consiting of an ordered list of definitions
432+
## As normal, each Semantic XML definition is referenced via semx.
433+
fmt_termdefinition = element fmt-termdefinition { TextElement+ }
431434

432435
quote-source =
433436
element source { erefType }
@@ -580,49 +583,26 @@ term = element term {
580583
BlockAttributes,
581584
## Clause number of term
582585
tname,
583-
## UNWRAP: Consecutive preferred designations are concatenated into a single designation, delimited by semicolon,
586+
## Consecutive preferred designations are concatenated into a single designation, delimited by semicolon,
584587
## if they are both verbal designations, in the same language and locale, and neither has pronunciation or grammar information
585588
preferred+,
586-
## In some flavours, admited designations are prefixed with the i18n of "ADMITTED:"
589+
fmt_preferred?,
587590
admitted*,
588-
## Deprecated designations are prefixed with the i18n of "DEPRECATED:"
591+
fmt_admitted?,
589592
deprecates*,
593+
fmt_deprecates?,
590594
related*,
595+
fmt_related?,
591596
termdomain?,
592597
termsubject?,
593-
## UNWRAP: multiple termdefinitions are replaced with a single definition, consiting of an ordered list of definitions
594598
termdefinition,
599+
fmt_termdefinition?,
595600
termnote*,
596601
termexample*,
597-
TermSource
602+
TermSource,
603+
fmt_termsource
598604
}
599605

600-
## Indicate that domain display is to be suppressed if it is being rendered inside of a definition
601-
## TODO will rescind that and put in a pattern that crossreferences rendered Semantic XML elements and their original
602-
termdomain &=
603-
attribute hidden { xsd:boolean }
604-
605-
## UNWRAP: The designation is replaced with a string concatenating its data:
606-
## The designation name, then field-of-application and usage-info comma-delimited and in angle brackets,
607-
## then expression/grammar information comma-delimited, then language, script and locale comma-delimited,
608-
## then expression/pronunciation comma-delimited and in slashes.
609-
## Bookmarks inside the designation are removed. Preferred designations are boldfaced.
610-
## Any termsources within the designation are moved after it
611-
Designation =
612-
attribute absent { xsd:boolean }?,
613-
attribute geographic-area { text }?,
614-
PureTextElement+
615-
616-
## UNWRAP: remove verbaldefinition wrapper
617-
verbaldefinition =
618-
(paragraph | dl | ol | ul | table | figure | formula)+,
619-
TermSource
620-
621-
## UNWRAP: remove nonverbalrep wrapper
622-
nonverbalrep =
623-
( table | figure | formula )+,
624-
TermSource
625-
626606
DisplayOrder =
627607
## The top-level clauses and blocks of the document are numbered in the order in which they should be rendered,
628608
## taking floating titles into account.
@@ -714,6 +694,9 @@ date_inline |= text
714694
## * fmt-conn is used to annotate Boolean conjunctions introduced in auto-generated text, such as of multiple cross-references,
715695
## e.g. "Clauses 2, 3 *and* 5".
716696
## * fmt-obligation is used to annotate the indication of obligation in annex titles ("normative", "informative").
697+
## * fmt-designation-field is used to annotate grammatical and usage annotations of designations, including their
698+
## delimiers, in order to enable easy deletion; e.g.
699+
## <strong>paddy</strong><span class="fmt-designation-field">, &lt;<semx element="field-of-application" source="_">in agriculture</semx>&gt;</span>
717700
span &= empty
718701

719702
## UNWRAP: Number formatting is applied to stem/mathml expressions: inline stem, and if number formatting is specified
@@ -770,14 +753,25 @@ btitle &= empty
770753
## Adjust title/@depth accordingly
771754
annex-subsection &= empty
772755

773-
## Any termsources within the designation are moved after it
774-
preferred &= TermSource
775-
776-
## Any termsources within the designation are moved after it
777-
admitted &= TermSource
778-
779-
## Any termsources within the designation are moved after it
780-
deprecates &= TermSource
756+
## The designation is replaced with a string concatenating its data:
757+
## The designation name, then field-of-application and usage-info comma-delimited and in angle brackets,
758+
## then expression/grammar information comma-delimited, then language, script and locale comma-delimited,
759+
## then expression/pronunciation comma-delimited and in slashes.
760+
## Bookmarks inside the designation are removed. Preferred designations are boldfaced.
761+
### The verbaldefinition and nonverbalrep wrappers are removed.
762+
## <semx> is used to reference the Semantic XML designations and their components; and the elements expression, name, name, abbreviation-type,
763+
## pronunciation, grammar are resolved to text.
764+
## Consecutive preferred designations are concatenated into a single designation, delimited by semicolon,
765+
## if they are both verbal designations, in the same language and locale, and neither has pronunciation or grammar information.
766+
## Separate designations are wrapped in paragraphs; if designations are concatenated, they occur within a single paragraph.
767+
## In some flavours, the fmt_preferred element is not used, as the designations appear within fmt_definition instead, as a single paragraph.
768+
fmt_preferred = element fmt-preferred { TextElement+ }
769+
770+
## As for fmt_preferred. In some flavours, admited designations are prefixed with the i18n of "ADMITTED:"
771+
fmt_admitted = element fmt-admitted { TextElement+ }
772+
773+
## As for fmt_preferred. Deprecated designations are prefixed with the i18n of "DEPRECATED:"
774+
fmt_deprecates = element fmt-deprecates { TextElement+ }
781775

782776
## In some flavours, the index section is not rendered.
783777
## In others, e.g. ISO, it is populated with a list of cross-references, each representing an index entry

grammars/relaton-models

0 commit comments

Comments
 (0)