metanorma / metanorma-iso

Metanorma processor for ISO standards
BSD 2-Clause "Simplified" License
14 stars 5 forks source link

(URGENT) PDF+Word: concept mentions cross-references showing extra space between parentheses #852

Closed ronaldtse closed 1 year ago

ronaldtse commented 1 year ago
Screen Shot 2022-11-17 at 8 28 19 PM
Intelligent2013 commented 1 year ago

In the source presentation XML there line-breaks around <span class="citesec">3.3.1</span>:

<definition><p id="_1bc8afcb-d7ac-5e5c-e192-c5d7d6f0c957">set of <em>concepts</em> (<xref target="term-concept">
  <span class="citesec">3.3.1</span>
</xref>) structured according
to the concept relations among its concepts</p></definition>

In the generated XSL-FO also:

<fo:block text-align="justify" margin-bottom="8pt" id="_1bc8afcb-d7ac-5e5c-e192-c5d7d6f0c957">set of <fo:inline font-style="italic">concepts</fo:inline> (<fo:basic-link color="blue" text-decoration="underline" fox:alt-text="term-concept" internal-destination="term-concept">
  3.3.1
</fo:basic-link>) structured according
to the concept relations among its concepts</fo:block>

FOP reduces line break to space (https://stackoverflow.com/a/53523028). From http://www.herongyang.com/XSL-FO/Block-Control-White-Space-Characters.html:

By default, white space characters are collapsed and linefeed characters are converted to space.

If we set linefeed-treatment="ignore", then the space between according and to is disappear and spaces before 3.3.1 remain: image

<xsl:strip-space elements="iso:xref"/> solves the issue:

image

ronaldtse commented 1 year ago

Actually this is also a Word problem:

Screen Shot 2022-11-17 at 11 30 50 PM

What happened?

Intelligent2013 commented 1 year ago

I've found the old presentation XML (was generated for another issue, Oct 23) - there aren't line breaks inside xref:

<definition><p id="_955b52d9-8330-8681-6efc-32fcbeff0f5e">set of <em>concepts</em> (<xref target="term-concept"><span class="citesec">3.1.1</span></xref>) structured according
to the concept relations among its concepts</p></definition>
opoudjis commented 1 year ago

What happened is that I tried to pretty print the XML output more consistently, and that's resulted in unwanted spaces.

Given how everything is currently blowing up, I am likely going to delay release by a couple of days.

opoudjis commented 1 year ago

No, I thought that it was that functionality https://github.com/metanorma/metanorma-iso/issues/513, but it isn't it, that does not put tags each to its own line.

opoudjis commented 1 year ago

Right: I've already fixed this in https://github.com/metanorma/metanorma-ieee/issues/170. @Intelligent2013, pull latest isodoc to confirm.

Intelligent2013 commented 1 year ago

Right: I've already fixed this in metanorma/metanorma-ieee#170. @Intelligent2013, pull latest isodoc to confirm.

@opoudjis no changes, unfortunately.

Resulted presentation xml:

<definition><p id="_1bc8afcb-d7ac-5e5c-e192-c5d7d6f0c957">set of <em>concepts</em> (<xref target="term-concept">
  <span class="citesec">3.3.1</span>
</xref>) structured according
to the concept relations among its concepts</p></definition>

Gemfile:

source "https://rubygems.org"

gem "metanorma-cli"
gem "metanorma-iso", git: "https://github.com/metanorma/metanorma-iso"
gem "metanorma-utils", git: "https://github.com/metanorma/metanorma-utils"
gem "metanorma-standoc", git: "https://github.com/metanorma/metanorma-standoc"
gem "isodoc", git: "https://github.com/metanorma/isodoc"
gem "mn-requirements", git: "https://github.com/metanorma/mn-requirements", branch: "main"
gem "sassc"

From Gemfile.lock:

GIT
  remote: https://github.com/metanorma/isodoc
  revision: 87b489deb6c0f55f4dfc4060b6644b8bedba91c3
  specs:
    isodoc (2.3.5)
...

The document source: https://github.com/metanorma/iso-19135/tree/main/sources/iso-19135-2021

opoudjis commented 1 year ago

OK, I'll deal with this on Tuesday....

opoudjis commented 1 year ago

Fix in https://github.com/metanorma/metanorma-ieee/issues/170 did not work. Will need to revert.

opoudjis commented 1 year ago

The issue is continued in https://github.com/metanorma/metanorma-ieee/issues/170