Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Presentation XML for terms, PDF #632

Open
opoudjis opened this issue Dec 29, 2024 · 18 comments
Open

Refactor Presentation XML for terms, PDF #632

opoudjis opened this issue Dec 29, 2024 · 18 comments
Assignees
Labels
enhancement New feature or request

Comments

@opoudjis
Copy link
Contributor

Follow-on from #630

I am incrementally doing the refactoring of terms in Presentation XML. As with the other refactoring, this is going to be one flavour at a time, and I've just done the base flavour implementation. You can see it in #631

The basic point of this is that

  • semx is used to link Presentation XML back to the Semantic XML originals
  • Ignore all of preferred alternative deprecated related definition termsource in favour of fmt-preferred fmt-alternative fmt-deprecated fmt-related fmt-definition fmt-termsource
  • Unlike before, when we had multiple instances of preferred alternative deprecated related, there is only a single instance of fmt-preferred fmt-alternative fmt-deprecated fmt-related. The latter now contain paragraphs, and multiple paragraphs within fmt-preferred are used instead of multiple preferred terms for the purposes of rendering.

Downstream flavours are going to arrange these terms quite differently, e.g. inserting the preferred terms inside of the definition at the start of the paragraph for ITU.

You can see samples of what the new Presentation XML looks like in https://github.com/metanorma/isodoc/pull/631/files#diff-a8f22a60cfd3fb8aedb49cf416629cbee802bbf4cd0225b7a221419a3ac68b88 , in spec/isodoc/terms_spec.rb

@opoudjis opoudjis added the enhancement New feature or request label Dec 29, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in Metanorma Dec 29, 2024
@opoudjis
Copy link
Contributor Author

metanorma-iso done

Intelligent2013 added a commit to metanorma/mn-native-pdf that referenced this issue Jan 1, 2025
@Intelligent2013
Copy link
Contributor

@opoudjis 1. to be on the same page,

alternative

do you mean the element admitted?

deprecated

do you mean the element deprecates?

  1. related

I didn't find the processing for this element in the XSLTs. Could you provide how to encode the 'related' term and the rendering rules?

  1. missing data in the element fmt-definition.
<definition id="_d0912479-1b3d-40d7-99b7-d8f7af6994dd">
	<verbal-definition>
		<p original-id="_22b2b44a-2066-78d3-9916-b66401fc9014">
			<em>paddy</em> (<xref target="term-paddy">
				<span class="citesec">
					<semx element="autonum" source="_terms_and_definitions">3</semx>
					<span class="fmt-autonum-delim">.</span>
					<semx element="autonum" source="term-paddy">1</semx>
				</span>
			</xref>) from which the husk only has been removed</p>
	</verbal-definition>
</definition>
<fmt-definition>
	<semx element="definition" source="_d0912479-1b3d-40d7-99b7-d8f7af6994dd">
		<p id="_22b2b44a-2066-78d3-9916-b66401fc9014">paddy from which the husk only has been removed</p>
	</semx>
</fmt-definition>

The fmt-definition//p is paddy from which the husk only has been removed only. The missing data:

  • em around paddy
  • no reference to 3.1
  1. the element domain doesn't contain the attribute hidden="true":
<domain id="_8817ef17-ec60-4d1a-b288-8ab03f7efb2d">rice</domain>

The previous generated Presentation XML:

<domain hidden="true">rice</domain>

@opoudjis
Copy link
Contributor Author

opoudjis commented Jan 1, 2025

@opoudjis 1. to be on the same page,

alternative

do you mean the element admitted?

deprecated

do you mean the element deprecates?

Yes, and yes.

  1. related

I didn't find the processing for this element in the XSLTs. Could you provide how to encode the 'related' term and the rendering rules?

Huh, so I had resolved it before to just paragraphs I guess.

Treat "related" by default like "admitted". It is cross-references to other terms, and I was resolving it as just a paragraph:

Semantic XML:

      <term id="C">
      <preferred language='fr' script='Latn' type='prefix'>
                <expression>
                  <name>First Designation</name>
                  </expression></preferred>
        <related type='contrast'>
          <preferred>
            <expression>
              <name>Fifth Designation</name>
              <grammar>
                <gender>neuter</gender>
              </grammar>
            </expression>
          </preferred>
          <xref target='second'/>
        </related>
        <related type='see'>
          <preferred>
            <expression>
              <name>Fifth Designation</name>
              <grammar>
                <gender>neuter</gender>
              </grammar>
            </expression>
          </preferred>
        </related>
        <related type='seealso'>
          <xref target='second'/>
        </related>
        <definition><verbal-definition>Definition 2</verbal-definition></definition>
      </term>

Previous Presentation XML:

          <term id="C">
             <fmt-name>
                <span class="fmt-caption-label">
                   <semx element="autonum" source="A">1</semx>
                   <span class="fmt-autonum-delim">.</span>
                   <semx element="autonum" source="C">2</semx>
                   <span class="fmt-autonum-delim">.</span>
                </span>
             </fmt-name>
             <fmt-xref-label>
                <span class="fmt-element-name">Clause</span>
                <semx element="autonum" source="A">1</semx>
                <span class="fmt-autonum-delim">.</span>
                <semx element="autonum" source="C">2</semx>
             </fmt-xref-label>
             <preferred language="fr" script="Latn" type="prefix">
                <strong>First Designation</strong>
             </preferred>
             <p>
                <strong>CONTRAST:</strong>
                <em>
                   <preferred>
                      <strong>Fifth Designation</strong>
                      , n
                   </preferred>
                </em>
                (
                <xref target="second">
                   <span class="fmt-element-name">Clause</span>
                   <semx element="autonum" source="A">1</semx>
                   <span class="fmt-autonum-delim">.</span>
                   <semx element="autonum" source="second">1</semx>
                </xref>
                )
             </p>
             <p>
                <strong>SEE:</strong>
                <strong>**RELATED TERM NOT FOUND**</strong>
             </p>
             <p>
                <strong>SEE ALSO:</strong>
                <strong>**RELATED TERM NOT FOUND**</strong>
             </p>
             <definition>Definition 2</definition>
          </term>

As you can see, the Related content was rendered as just paragraphs. Now those paragraphs are going to be contained inside a single fmt-related element:

             <fmt-related>
                <semx element="related" source="_">
                   <p>
                      <strong>CONTRAST:</strong>
                      <em>
                         <fmt-preferred>
                            <semx element="preferred" source="_">
                               <strong>Fifth Designation</strong>
                               , n
                            </semx>
                         </fmt-preferred>
                      </em>
                      (
                      <xref target="second">
                         <span class="fmt-element-name">Clause</span>
                         <semx element="autonum" source="A">1</semx>
                         <span class="fmt-autonum-delim">.</span>
                         <semx element="autonum" source="second">1</semx>
                      </xref>
                      )
                   </p>
                </semx>
                <semx element="related" source="_">
                   <p>
                      <strong>SEE:</strong>
                      <strong>**RELATED TERM NOT FOUND**</strong>
                   </p>
                </semx>
                <semx element="related" source="_">
                   <p>
                      <strong>SEE ALSO:</strong>
                      <strong>**RELATED TERM NOT FOUND**</strong>
                   </p>
                </semx>
             </fmt-related>
  1. the element domain doesn't contain the attribute hidden="true":
<domain id="_8817ef17-ec60-4d1a-b288-8ab03f7efb2d">rice</domain>

The previous generated Presentation XML:

<domain hidden="true">rice</domain>

Deliberate. The "hidden" attribute is not to be used, because the domain element is not to be rendered ever, just like definition and preferred. Its contents will turn up as <semx element="domain"> inside fmt-preferred or fmt-definition

@opoudjis
Copy link
Contributor Author

opoudjis commented Jan 1, 2025

  1. missing data in the element fmt-definition.
<definition id="_d0912479-1b3d-40d7-99b7-d8f7af6994dd">
	<verbal-definition>
		<p original-id="_22b2b44a-2066-78d3-9916-b66401fc9014">
			<em>paddy</em> (<xref target="term-paddy">
				<span class="citesec">
					<semx element="autonum" source="_terms_and_definitions">3</semx>
					<span class="fmt-autonum-delim">.</span>
					<semx element="autonum" source="term-paddy">1</semx>
				</span>
			</xref>) from which the husk only has been removed</p>
	</verbal-definition>
</definition>
<fmt-definition>
	<semx element="definition" source="_d0912479-1b3d-40d7-99b7-d8f7af6994dd">
		<p id="_22b2b44a-2066-78d3-9916-b66401fc9014">paddy from which the husk only has been removed</p>
	</semx>
</fmt-definition>

The fmt-definition//p is paddy from which the husk only has been removed only. The missing data:

  • em around paddy
  • no reference to 3.1

Thank you for catching that. That is indeed an omission. Will try to resolve now.

@opoudjis
Copy link
Contributor Author

opoudjis commented Jan 1, 2025

Change coming up, I will be leaving fmt-termsource inside of fmt-preferred where the choice of term designation is attributed to a source. Before, I was moving termsource after preferred. So you will find fmt-termsource inside of any of preferred admitted deprecates definition as well as term itself—although I don't think that's going to have much of an impact on you, you just output its contents where you find them, and there will be no implicit paragraphs anywhere for you to insert, I am taking care of those.

@opoudjis
Copy link
Contributor Author

opoudjis commented Jan 1, 2025

Yup, I realise what happened: concepts in terms are a special case in ISO: only the first instance is hyperlinked, but that's the first rendered instance. Which means I need to leave concept in definition alone, and only process concept under fmt-definition. So there is an ISO-specific change after all.

@opoudjis
Copy link
Contributor Author

opoudjis commented Jan 1, 2025

Fixed:

<definition id="_294f62b0-41df-4328-a2d6-90d6ac7badc4"><verbal-definition><p original-id="_22b2b44a-2066-78d3-9916-b66401fc9014"><concept><refterm>paddy</refterm><renderterm>paddy</renderterm><xref target="term-paddy"/></concept> from which the husk only has been removed</p></verbal-definition></definition><fmt-definition><semx element="definition" source="_294f62b0-41df-4328-a2d6-90d6ac7badc4"><p id="_22b2b44a-2066-78d3-9916-b66401fc9014"><em>paddy</em> (<xref target="term-paddy"><span class="citesec"><semx element="autonum" source="terms">1</semx><span class="fmt-autonum-delim">.</span><semx element="autonum" source="term-paddy">1</semx></span></xref>) from which the husk only has been removed</p></semx></fmt-definition>

@opoudjis
Copy link
Contributor Author

opoudjis commented Jan 3, 2025

Metanorma-IEEE ready

Intelligent2013 added a commit to metanorma/mn-native-pdf that referenced this issue Jan 4, 2025
Intelligent2013 added a commit to metanorma/mn-native-pdf that referenced this issue Jan 4, 2025
@Intelligent2013
Copy link
Contributor

Intelligent2013 added a commit to metanorma/mn-native-pdf that referenced this issue Jan 4, 2025
@Intelligent2013
Copy link
Contributor

Metanorma-IEEE ready

@opoudjis in the fmt-definition there are xref immediately after fmt-preferred. How should I process them - ignore xref or ignore the preceding fmt-preferred? Or it's a bug in the Presentation XML?

<term id="term-acceleration-insensitive-drift-rate">
	...
	<fmt-definition>
		<p>
			<semx element="preferred" source="_7180a9d8-eabd-46e6-ae62-b7e2c411effa">
				<strong>acceleration-insensitive drift rate</strong>
			</semx>: <semx element="definition" source="_87074daf-1bfa-424b-b784-cd68750c8733">The component of…​</semx>
			<em>See also:</em>
			<semx element="related" source="_59f0e153-1ee6-4828-aa43-dee2d69610f7">
				...
				<fmt-preferred>
					<semx element="preferred" source="_f9d4baba-d4ac-4a49-8239-689258d11efc">
						<strong>drift rate</strong>
					</semx>
				</fmt-preferred>
				<xref target="term-drift-rate">drift rate</xref>
			</semx>; <semx element="related" source="_f4b74950-583e-4578-a973-222b15cd39fb">
				...
				<fmt-preferred>
					<semx element="preferred" source="_66c162c9-7c10-4c59-83ad-97b906ce9627">
						<strong>systematic drift rate</strong>
					</semx>
				</fmt-preferred>
				<xref target="term-systematic-drift-rate">systematic drift rate</xref>
			</semx>. </p>
	</fmt-definition>

PDF rendering with double drift ratedrift rate:
image

@Intelligent2013
Copy link
Contributor

  1. missing data in the element fmt-definition.
    Fixed:
<definition id="_294f62b0-41df-4328-a2d6-90d6ac7badc4"><verbal-definition><p original-id="_22b2b44a-2066-78d3-9916-....</fmt-definition>

@opoudjis confirmed, thank you.

@opoudjis
Copy link
Contributor Author

opoudjis commented Jan 5, 2025

metanorma-itu ready.

Will come back to xref issue, I'm out the door...

Intelligent2013 added a commit to metanorma/mn-native-pdf that referenced this issue Jan 7, 2025
@Intelligent2013
Copy link
Contributor

common.xsl updated for ITU.

@opoudjis
Copy link
Contributor Author

opoudjis commented Jan 7, 2025

metanorma-nist ready

@opoudjis
Copy link
Contributor Author

opoudjis commented Jan 7, 2025

<fmt-preferred>
					<semx element="preferred" source="_f9d4baba-d4ac-4a49-8239-689258d11efc">
						<strong>drift rate</strong>
					</semx>
				</fmt-preferred>
				<xref target="term-drift-rate">drift rate</xref>
			</semx>

Those appear to be specific to related. They are redundant, and I'll get rid of them.

@opoudjis
Copy link
Contributor Author

opoudjis commented Jan 7, 2025

Yes, in IEEE, the xref of where the related term is is ignored.

opoudjis added a commit to metanorma/metanorma-ieee that referenced this issue Jan 7, 2025
@opoudjis
Copy link
Contributor Author

opoudjis commented Jan 7, 2025

metanorma-ogc ready

@opoudjis
Copy link
Contributor Author

opoudjis commented Jan 8, 2025

metanorma-iho ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants