Author mode customization

Post here questions and problems related to editing and publishing DITA content.
tmakita
Posts: 100
Joined: Fri Apr 08, 2011 7:58 am

Author mode customization

Post by tmakita »

I'm not sure whether this topic is appropriate in this forum. I've the request from user to enable external references from DITA topic authoring. They do not need hard PDF to PDF links. But they need other publication's title of a topic using specialized DITA elements "extref".
The story is illustrated below.

1. Prepare the XML file such as following. The contents are filled topic's @id and title contents.

Code: Select all

<?xml version="1.0"?>
<library>
    <book id="id-book-01">
        <chapter id="id-chapter-001">
            <title>1. Location of important labels</title>
        </chapter>
        <chapter id="id-chapter-002">
            <title>2. Safety information</title>
        </chapter>
        <chapter id="id-chapter-003">
            <title>3. Description</title>
        </chapter>
        <chapter id="id-chapter-004">
            <title>4. Special features</title>
        </chapter>
        <chapter id="id-chapter-005">
            <title>5. Instrument and control functions</title>
        </chapter>
        <chapter id="id-chapter-006">
            <title>6. For your safety – pre-operation checks</title>
        </chapter>
        <chapter id="id-chapter-007">
            <title>7. Operation and important riding points</title>
        </chapter>
        <chapter id="id-chapter-008">
            <title>8. Periodic maintenance and adjustment</title>
        </chapter>
        <chapter id="id-chapter-009">
            <title>9. Specifications</title>
        </chapter>
        <chapter id="id-chapter-010">
            <title>10. Consumer information</title>
        </chapter>
    </book>
    <book id="id-book-02">
        <chapter id="id-chapter-001">
            <title>1. And so on</title>
        </chapter>
    </book>
</library>
3. Authoring phase
We want to enable the following topic authoring.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="extref_sample">
    <title>Extref sample</title>
    <abstract>
        <p>We will apply specializtion to DITA DTD and introduce "extref" element to see topic titles in other bookmap.</p>
        <p>No PDF hard links are needed. Only the topic/title is needed at Oxygen authoring time.</p>
        <p>If the author inputs "extref" element, Oxygen XML Author will display the hierarchy of "extref-target.xml" and fetch the @id of book and chapter. Also the title contsnts that the author selects.</p>
        <p>"extref-target.xml" will be updated for each book build. </p>
    </abstract>
    <conbody>
        <p>For details, see <extref id="id-chapter-001" delivable="id-book-01">1. Location of important labels</extref></p>
    </conbody>
</concept>
I will be appreciated if someone give me the pointers to enable this challenge in Oxygen XML Author.
I've downloaded Oxygen SDK. It's active in my Eclipse. But not sure how should I begin.
Regards,
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Author mode customization

Post by Radu »

Hi Toshihiko,

Are these some kind of cross book links? If so, why not use the DITA standard approach of using peer DITA Maps and referencing keys from them?
https://blog.oxygenxml.com/topics/cross_book_links.html

Anyway, coming back to your particular request, let's start with an example, so let's say you have a plain indirect link "<xref keyref>" in the DITA topic, if you place the caret inside it and right click, "Inspect Styles" you will see two selectors which apply for it:

Code: Select all

  *[keyref][keyref][keyref]:empty {
      content: oxy_label(text, oxy_getSomeText(oxy_link-text(), 150, true), background-color, rgb(240, 240, 240));
  }
  *[class~="topic/xref"][keyref] {
    link: oxy_concat("", attr(keyref, keyref));
    -oxy-link-activation-trigger:modifier-click;
}
  
The first selector handles what content is computed and displayed when the link is empty.
The second selector handles what happens when you click the link.

For the first selector which computes the display text, it just calls this Oxygen specific CSS function "oxy_link-text()".
There is a specific java API which gets called to resolved such oxy_link-text calls:
https://www.oxygenxml.com/doc/versions/ ... links.html

Let's say you create a framework extension of the base DITA framework:
https://blog.oxygenxml.com/topics/customizeDITACSS.html
If in the Oxygen Preferences->Document Type Association page you edit your "Custom DITA" framework, in the Classpath tab you can add an extra reference to your own JAR library.
In the "Extensions" tab there is an "Extensions bundle" which points to the "ro.sync.ecss.extensions.dita.DITAExtensionsBundle" implemented in the "OXYGEN_INSTALL_DIR/frameworks/dita/dita.jar".
You need to create your own Java class which extends the base DITAExtensionsBundle and on the "ro.sync.ecss.extensions.dita.DITAExtensionsBundle.createLinkTextResolver()" callback create your own LinkTextResolver over the one in the base class (so that the base functionality remains).
All the Java sources for our extensions (including the dita.jar) can be found here:
https://www.oxygenxml.com/maven/com/oxy ... /25.1.0.1/

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
tmakita
Posts: 100
Joined: Fri Apr 08, 2011 7:58 am

Re: Author mode customization

Post by tmakita »

Thank you for your usual quick reply! I will examine your suggestion and get back.
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
tmakita
Posts: 100
Joined: Fri Apr 08, 2011 7:58 am

Re: Author mode customization

Post by tmakita »

Thank you for your usual quick reply! I will examine your suggestion and get back.
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
Post Reply