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

xref via keyref to external HTML page doesn't work #1439

Closed
blefort opened this issue Jan 19, 2013 · 5 comments · Fixed by #3179
Closed

xref via keyref to external HTML page doesn't work #1439

blefort opened this issue Jan 19, 2013 · 5 comments · Fixed by #3179
Labels
Projects
Milestone

Comments

@blefort
Copy link

blefort commented Jan 19, 2013

Hi,

There was a similar issue reported in the past, but the case is a bit different #1174.

DITA-OT version tested (direct from download): 1.6.3, 1.7.1 both have the issue.

In my understanding, either navtitle element or linktext are not honored in the map resolution (Not sure I use the right vocabulary - sorry - I mean when the map is built in the preprocess stage), when a keyref reference an external html page.
The link text is honored in a context of a topic resolution.

Code

Here is a map using linktext and navtitle

<map>
    <title>Keydef on exernal content</title>
    <keydef keys="ncbi" 
                 href="http://www.ncbi.nlm.nih.gov/" 
                 scope="external" 
                 format="html">
        <topicmeta>
            <navtitle>NCBI web site</navtitle>
            <linktext>NCBI web site</linktext>     
        </topicmeta>
    </keydef>
    <topicref href="concept.dita" type="concept"/>
    <topicref keyref="ncbi"/>
</map>

After preprocess, the @href value seems to replace the element navtitle and link text

<!-- (...) -->
<topicref class="- map/topicref " 
              format="html" 
              href="http://www.ncbi.nlm.nih.gov/"
              keyref="ncbi" 
              scope="external"
              xtrc="topicref:2;12:30" 
              xtrf="/Users/blefort/DITA-OT1.7.1/bugs/DITA-OT/keyref-html/main.ditamap">
        <topicmeta class="- map/topicmeta ">
            <navtitle class="- topic/navtitle ">http://www.ncbi.nlm.nih.gov/</navtitle>
            <?ditaot gentext?>
            <linktext class="- map/linktext ">http://www.ncbi.nlm.nih.gov/</linktext>
        </topicmeta>
    </topicref>

Result

In the navigation, we will see http://www.ncbi.nlm.nih.gov/
In the concept: NCBI web site

Samples

https://dl.dropbox.com/u/14980268/issues/keyref-html.zip

@eerohele
Copy link

This one's a bit tricky.

In the keyref stage, DITA-OT copies all necessary attributes from <keydef keys="ncbi" ...> into <topicref keyref="ncbi"/> so that it becomes:

<topicref keyref="ncbi" class="- map/topicref " href="http://www.ncbi.nlm.nih.gov/" format="html" scope="external"/>

Then, in the mappull stage, DITA-OT generates a <topicmeta> element for <topicref keyref="ncbi"/> because it doesn't yet have one. The keyref stage only copies the attributes from <keydef keys="ncbi" ...> into <topicref keyref="ncbi"/> — it does not copy the <topicmeta> child or any other possible element children. Because <topicref keyref="ncbi"/> has no navtitle, the mappull stage uses the @href value as fallback instead.

One solution might be to modify mappullImpl.xsl to check whether the current element has @keyref and if so, whether the keyref target has a <topicmeta> element it can use. However, it's probably not a good idea to add keyref parsing logic into the mappull stage.

Another option would be to modify keyref parsing (KeyrefPaser.java) so that in addition to copying attributes, the necessary element children (<topicmeta>, <data>, etc.) of the keyref source would be copied into the keyref target. This is probably the way to go, but there might be an even better option. Not sure yet.

In any case, a workaround is to use @navtitle instead of <navtitle>.

@infotexture
Copy link
Member

Ran into a variant of this while building the DITA-OT docs from the 2.3.1 tag, so it looks like the issue still exists in recent versions.

With a key defined in a map as:

<keydef keys="participate" href="http://www.dita-ot.org/participate" 
        scope="external" format="html" locktitle="yes">
  <topicmeta>
    <navtitle>Participate</navtitle>
  </topicmeta>
</keydef>

and referenced in another map via:

<topicref keyref="participate"/>

the @href value is used as link text instead of the <navtitle>.

If the same content is placed directly in the referencing map as a <topicref> without the @keyref, the <navtitle> is honored:

<topicref keys="participate" href="http://www.dita-ot.org/participate" 
          scope="external" format="html" locktitle="yes">
  <topicmeta>
    <navtitle>Participate</navtitle>
  </topicmeta>
</topicref>

@drmacro
Copy link
Member

drmacro commented Jul 9, 2016

What is the expected HTML or PDF rendition result of having a navigation topicref to an external HTML Web page?

It makes sense to have a key like this for use from xrefs but I would not expect that kind of resource to be referenced directly from a navigation topicref.

@robander
Copy link
Member

We had that in the DITA-OT documentation TOC for the first several years - it worked from the TocJS and HTML Help versions, but I don't see any reasonable way to include the info for PDF (apart from, maybe, a link if there is some @collection-type setting that creates it). In those early days, from either TocJS or HTML Help, clicking on that link in the TOC resulted in a new browser window with the target URL.

@infotexture
Copy link
Member

Reproduced with 3.0.2, still present:

@robander robander added this to the 3.2.2 milestone Jan 15, 2019
@robander robander modified the milestones: 3.2.2, 3.3 Feb 19, 2019
@robander robander added this to To do in 3.3 via automation Feb 19, 2019
3.3 automation moved this from To do to Done Feb 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
3.3
  
Done
Development

Successfully merging a pull request may close this issue.

6 participants