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

filter <indexterm> elements when computing <xref> target text for pdf2 #4030

Merged
merged 1 commit into from
Nov 15, 2022

Conversation

chrispy-snps
Copy link
Contributor

@chrispy-snps chrispy-snps commented Oct 26, 2022

Signed-off-by: chrispy chrispy@synopsys.com

Description

When an <xref> computes target text from content that contains an <indexterm> element, preprocessing filters index term text when computing the target text. However, the pdf2 transformation recomputes new target text, and this recomputation also needed to filter out index term text in a couple more cases.

This probably stems from the fact that these elements don't directly allow <indexterm> in their content models, but they do allow <ph>, which in turn allows <indexterm>.

Motivation and Context

Fixes #4017.

How Has This Been Tested?

I tested the pdf2 transformation with the following topic: topic.zip

The test topic is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="urn:oasis:names:tc:dita:rng:topic.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<topic id="topic">
  <title id="title-id">title<ph><indexterm>FINDME</indexterm></ph></title>
  <body>

    <p>fig: <xref href="#./fig-id"/></p>
    <p>section: <xref href="#./section-id"/>.</p>
    <p>table: <xref href="#./table-id"/>.</p>
    <p>dlentry: <xref href="#./dlentry-id"/>.</p>
    <p>dt: <xref href="#./dt-id"/>.</p>
    <p>title-id: <xref href="#./title-id"/>.</p>
    <p>example-id: <xref href="#./example-id"/>.</p>

    <fig id="fig-id">
      <title>fig<ph><indexterm>FINDME</indexterm></ph></title>
    </fig>
    <section id="section-id">
      <title>section<ph><indexterm>FINDME</indexterm></ph></title>
    </section>
    <table id="table-id">
      <title>table<ph><indexterm>FINDME</indexterm></ph></title>
      <tgroup cols="1">
        <colspec colname="c1" colnum="1" colwidth="1*"/>
        <tbody>
          <row>
            <entry/>
          </row>
        </tbody>
      </tgroup>
    </table>
    <dl>
      <dlentry id="dlentry-id">
        <dt id="dt-id">term<ph><indexterm>FINDME</indexterm></ph></dt>
        <dd>definition</dd>
      </dlentry>
    </dl>
    <example id="example-id">
      <title>example<ph><indexterm>FINDME</indexterm></ph></title>
    </example>

  </body>
</topic>

Type of Changes

  • Bug fix (non-breaking change which fixes an issue)

In links.xsl,

  • The topic/dt template called a mode="text-only" template, but I think this was intended to be mode="dita-ot:text-only". This mode also did not work correctly, but mode="insert-text" (which the other templates used) did.

  • The topic/title template used <xsl:value-of> to perform a plaintext evaluation of the title. This template was updated to use mode="insert-text".

In tables.xsl,

  • The mode="insert-text" template was updated to filter out elements in the opentopic-index:* namespace.

    (Why are the text evaluation templates in a table-related file?)

Documentation and Compatibility

A release notes mention is sufficient.

This change should not adversely affect any existing plugins or flows.

Checklist

I do not think there are any unit tests for pdf2 PDF output.

@robander
Copy link
Member

robander commented Nov 14, 2022

And this missed getting approved/merging for develop as we rushed to close the 4.0 release - can you rebase on 4.0.1 hotfix branch hotfix/4.0.1 and this will go in the first patch? Code looks good to me

Signed-off-by: chrispy <chrispy@synopsys.com>
@chrispy-snps chrispy-snps changed the base branch from develop to hotfix/4.0.1 November 14, 2022 13:35
@chrispy-snps
Copy link
Contributor Author

Rebased onto hotfix/4.0.1.

@robander robander self-requested a review November 15, 2022 12:55
@robander robander merged commit aa2c363 into dita-ot:hotfix/4.0.1 Nov 15, 2022
@robander robander added this to the 4.0.1 milestone Nov 15, 2022
@infotexture
Copy link
Member

infotexture commented Dec 4, 2022

✅ Verified that the changes here indeed resolve the issue as originally reported in #4017, and reverted the workaround commits that were added to the docs repo after the issue was reported:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug plugin/pdf Issue related to PDF plug-in
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PDF2 renders index entries in link text
4 participants