Tuesday, April 16, 2019

DITA Oriented Tips And Tricks

Share to Facebook Share to Twitter Email This Share on Google Plus Share on Tumblr

Oxygen XML Editor has about 18 years of development under its wings. During these years we added lots of functionality and anyone of our users may usually not know more than 20-30% of Oxygen's features. So this presentation is intended for technical writers using Oxygen to write DITA content and who may want to find out more about their tool.

Add-ons

There are lots of free add-ons provided by the Oxygen team and which can be installed in an Oxygen standalone version. I will enumerate some of the most interesting one:

  • Git add-on. This plugin adds a side view allowing you to do some common Git operations like pull, commit, push (mostly 90% of what a regular Git user would do).
  • Content Fusion Connector add-on. Collaborate with your peers by sending them links that allow them to give you feedback on your work using a web browser without the need to pre-install anything on their side.
  • Translation package builder. Small plugin which can be used to prepare a zip file containing only the topics which have changed from one version to another.
  • Batch convertor add-on. Converst multiple HTML, Markdown, Excel files to DITA.

Project-related functionality:

The Oxygen Project view is the place where you can organize and apply batch changes to all your DITA resources:

  • Master files support. Enable master files support in the DITA project, add your top level DITA Maps as master files and any structure changes, renaming or moving files will automatically update all links in the DITA Project. Works also for renaming/moving image resources.
  • Store options at project level. Almost all of Oxygen's preferences pages can be saved at project level. Once you do that, you can give the project.xpr file to somebody else and when they open it, they will also get the settings set inside the project.
  • Compare files/folders
  • Refer to multiple folders
  • Batch operations: Select a folder in the project and use the "Transform", "Validate", "Format and Indent", "Find/Replace in Files" or "Spell Check in Files". Or use the "XML Refactoring" action to apply a refactoring stylesheet over all the selected files.
  • Filter files. You can instruct the Project view to hide various file types.

Navigation:

Actions to find opened files, find files containing a certain content or navigate between files.

  • In the main Window menu you can find the Next/Previous Editor actions and their shortcuts. Together with the Switch editor tab action these help you navigate between opened XML documents.
  • The Open/Find Resource view (main menu Window->Show View) allows you to search for file names, search in file contents or search for files containing comments or change tracking.
  • Right click the tab of an opened DITA document and use the Copy location action. Or use the Show in Explorer/Finder action to locate the file.
  • Use the main menu File->Reopen last closed editor action to re-open the last closed file.
  • Open a DITA topic in the Text editing mode, right click, choose Go to definition to open the DTD, XML Schema or RelaxNG Schema at the precise location where that DITA element is defined, something useful for debugging DITA specializations.
  • Use the Navigation toolbar to Go back/forward/last modification.

Find Replace Functionality

The Find/Replace functionality is the bread and butter of any editing application and Oxygen has lots of functionality in this regard:

  • Find/Replace in Files.
    • Restrict to XPath - if you want to make replacements only in certain parts of the XML document, the XPath restriction can be used to focus only on certain attributes or element content.
    • Ignore whitespaces - You should usually check this checkbox as there is always there is a possibility what the words you are searching for may be split on multiple lines in the XML content.
  • The Find menu → Find Next/Previous actions allow you to find the next/previous occurrence of the current selected word(s). Or you can use the Find All action to find and highlight all occurrences of a word or a sequence of words.
  • The Find menu → Find all Elements action shows a dialog allowing you to find elements or attributes containing a sequence of words.
  • The Find menu → Quick find toolbar is a compact toolbar giving you access to search functionality.
  • The XPath allows you to use XPath expression (eg: //comment()[contains(., 'TODO')]) to search the current topic or a set of topics for elements, attributes or comments matching a set of conditions.

DITA Maps Manager

The DITA Maps Manager view's contextual menu gives you quite an impressive array of useful actions:

  • Fast create new topics. Create a set of DITA topics by specifying only their titles.
  • Add references to multiple topics.
  • Create key definition with keyword.
  • Edit Properties - you can even set profiling attributes on multiple selected topic references.
  • Export DITA Map - export your DITA Map to a zip archive ready for translation.
  • Find Unreferenced Resources - find all resources which are no longer used in a DITA project.
  • Refactoring menu
    • Rename/Move topic - renames a topic and all references to it.
    • Rename key - rename a DITA key and all its references in the entire project.
    • Conversions between topics - convert between topics, tasks, concepts and references for multiple selected DITA files.
    • Convert nested sections to new topics - convert all sections located inside a topic to new topics.
    • Convert nested topics to new topic - convert all nested topics to new topic files.
    • Apply custom refactoring scripts - create and apply your own XSLT or XQuery refactoring scripts.
  • Find/Replace in Files
  • Spell Check in Files
  • Search References - search all references to a particular referenced topic.
  • Remove from Disk - check in how many places a topic is referenced and then remove it from disk.
  • Open with resolved topics - open the DITA Map with all topic references expanded, useful if you want to have an overview of the entire publication.
  • Synchronized selection between DITA Maps manager and main editor area - anytime a DITA topic is opened both in the DITA Maps Manager and the main editing area, moving the selection in one instance will also move the selection to the corresponding place in the other.

Editing in the Author visual editing mode

  • Maximize editor area - double click the opened editor's tab to hide all side views and maximize editing space, double click again to show the side views.
  • Increase/decrease editor font - Use Ctrl/CMD +/- to increase or recrease the font in the current edited document.
  • Inserting elements - pressing ENTER in the Author visual editing mode will show you a list with all possible elements which can be inserted. If you choose an invalid element, Oxygen will find a place for it. You can also add custom actions or code templates to the content completion list.
  • Select content then press ENTER to surround the content in a new element.
  • Select multiple intervals - Press the Ctrl/CMD button when selecting text to select multiple text intervals. Once you do that you can use toolbar actions like Bold, Italic or Underline or you can use the Edit Profiling Attributes action to set profiling attributes on all the selected items.
  • In-place attributes editor - Instead of using the Attributes view you can press Alt-Enter to edit attributes for the current element in a small pop-up dialog.
  • Select an entire element - Triple click inside an element's contents to select the entire element. After this you can move the element to a new place.
  • Double click to select by word, then drag the mouse to select the content word by word.
  • Move elements (especially paragraphs, list items) up or down (ALT-UP/DOWN), indent or unindent list items (Tab, Shift-Tab).
  • Select content and then use the Toggle comment action (contextual menu Refactoring submenu) to quickly add an XML comment around it.
  • In the contextual menu the Text submenu contains useful actions to count the number of words in the entire document (or in the selected text), convert the selection to upper, lowercase or sentence case
  • Bookmarks - click the vertical left side bar in the editing area to add a bookmark. Navigate to that bookmark even after the file has been closed using the Ctrl/CMD + number shortcut.
  • Collapse other folds - Click a fold triangle in the Author visual editing mode and you can choose to close all other folds, useful when working with multiple sections in the same file.
  • Code templates - define small fragments of XML content which can be inserted either by defining a shortcut key or by pressing ENTER in the editing area.

  • Editor variables. Certain Oxygen specific macros can be automatically expanded. For example a code template which inserts the current author name can use this editor variable:
    <author>${author.name}</author>
    or a code template which surrounds the selection inside a <keyword> element:
    <keyword>${selection}</keyword>
    or a code template which first asks the end user for their name and then inserts it in the document:
    <author>${ask('Author Name', generic, 'John Doe')}</author>
    Code templates can also be used when creating new file templates.
  • Outline Quick find filter - The Outline view contains a filter which can be used to reduce the number of elements displayed in it, for example display only the contained topics.

DITA-specific editing in the Author visual editing mode

  • DITA Reusable Components view. You can use this side view to quickly search for and insert references to keys or to reusable components.
  • Inserting links to resources. Besides using the toolbar actions you can also:
    • Drop a file from an outside location. Drag a DITA topic or other resource from the Explorer/Finder or from the Oxygen Project and drop it inside an opened DITA topic to insert a reference to it.
    • Paste an URL in the editing area to insert a reference to it.
  • Links to images:
    • Drop images from the Project view in the main editing area to insert references to them.
    • Copy an image and then paste it in the editing area to insert a reference to it.
    • Double click broken image reference to modify attributes.
  • Reuse content:
    • Copy an element which has an ID set on it and then right click some place else and use the "Paste Special → Paste as content reference" to insert a content reference to the element.
  • Select multiple sibling paragraphs and use the Insert list item toolbar item to convert them all to list items. Select multiple list items and use the Insert table toolbar action to convert them to a table.
  • Working with tables:
    • You can right click inside a table and use the Table Properties action to change lots of table-related settings.
    • You can sort tables based on certain criteria.
    • In the contextual menu Refactoring submenu you can find actions to convert between CALS and simple tables.
    • You can select an entire table by clicking its left corner and select an entire row by clicking to the left of it.
  • Add hotspots to images - You can right click any image reference and use the Image Map Editor to configure targer links for various parts of the image.
  • You can right click inside an element and use the About Element contextual menu item to find out more about it.
  • Pasting content from web browsers, Excel spreadsheets or Word documents inside a DITA topic produces the equivalent DITA content.
  • The Styles drop down toolbar menu allows you to choose between different CSS styles to apply while editing, the Hints and Inline actions layers should be interesting for you to experiment with. Or you can add your own.

Preferences:

Oxygen has a lot of global settings which can be configured, I will just list what I consider to be the most important ones:

Menu shortcut keys - you can use this preferences page to assign or to see the shortcut for any action available in Oxygen.

Fonts - this page allows you to change the default fonts used in the application.

Appearance - change the default color theme in Oxygen, the Graphyte theme is quite popular.

Spell check - customize the spell checker settings, use custom spell check dictionaries.

Save - settings to automatically save or to check for errors before saving the file.

External tools - define various command line tools which you can launch from Oxygen.

Annotations - disable the tooltips which appear when hovering over various elements, useful if you have a small screen.

Tools

The Tools main menu it's worth exploring sometimes, you can invoke XML refactoring actions from it or open other small applications like the SVG viewer.

Import

The File menu offers the possibility to import HTML, CSV, Excel files or database content as XML.

Other views and toolbars:

You can right click in the toolbar area and use the Configure Toolbars action to see what toolbars are available or what toolbars can be removed.

The Symbols toolbar is quite interesting if you often want to insert symbols which are not on the current keyboard.

Other small tips:

The main Window menu has actions to tile all opened XML documents and also to enable synchronous scrolling in them, useful if you want to look at similar XML documents and maybe to copy/paste between them.

Keeping in touch

Oxygen's Help menu allows you to use the Report problem action to contact us directly. The Support Tools->Randomize XML Content action allows you to randomize the content of an XML project before sending it to us for tests.

And there are a lot of other ways to get in touch with us or to find various videos or tutorials to read: https://www.oxygenxml.com/technical_support.html.

Friday, March 22, 2019

Oxygen XML Editor DITA Editing solution strong points

Share to Facebook Share to Twitter Email This Share on Google Plus Share on Tumblr

We are sometimes asked which are the differentiating features between Oxygen XML Editor and its competitors when it comes to DITA Editing. So below I tried to list some differentiating features (strong points) that Oxygen has:

Thursday, March 14, 2019

Adding support for embedding Latex equations in DITA content

Share to Facebook Share to Twitter Email This Share on Google Plus Share on Tumblr

LaTeX is a high-quality typesetting system that includes features designed for the production of technical and scientific documentation. LaTeX can also be used to express mathematical formulas in a textual format. By default, web browsers and PDF readers do not have support to show mathematical equations written in LaTeX but there are open source projects that can read LaTeX and convert it to other image types.

Adding support for writing LaTeX equations in DITA topics would imply three stages:
  • Find a way to write the equation in the DITA XML content. You can either create a DITA DTD specialization and add a new element (for example, called <latex> and it extends the DITA <foreign> element). Alternatively, you can use the DITA <foreign> element with a specific @outputclass attribute value directly:
    <!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
    <topic id="testEquation">
        <title>Test equation</title>
        <body>
            <p><foreign outputclass="embed-latex">L' = {L}{\sqrt{1-\frac{v^2}{c^2}}}</foreign></p>
        </body>
    </topic>
  • If you want Oxygen to properly present the LaTeX equation when editing in the Author visual mode, you need an Oxygen plugin that converts the equation content to an image. There is a sample plugin that does that here: https://github.com/oxygenxml/wsaccess-javascript-sample-plugins/tree/master/latex-images-support. You can download and copy the plugin folder latex-images-support to the Oxygen plugins folder, then restart Oxygen.
  • Publishing to HTML-based and PDF outputs. This DITA Open Toolkit plugin automatically converts LaTeX images to SVG when publishing: https://github.com/oxygenxml/dita-latex.

Friday, January 25, 2019

Migrating Various Document Formats to DITA

Share to Facebook Share to Twitter Email This Share on Google Plus Share on Tumblr

Most companies do not start new DITA-based projects from scratch. They already have content written in various other formats and somehow they need that content converted to DITA. In this blog post, I will offer some conversion advice depending on the format of your current project.

Migrating DocBook content to DITA.

Because DocBook content is XML, migrating it to DITA is quite straight forward:
  1. You first convert the DocBook document to a single large DITA composite file and you can do that with the predefined transformation scenario bundled with Oxygen called DocBook to DITA.
  2. There is a utility XSLT stylesheet on the Oxygen XML GitHub account that can convert a DITA composite to a DITA map with separate DITA topic files: https://github.com/oxygenxml/old-userguide-docbookbased/blob/master/split-DITA-topic.xsl

Migrating Microsoft Word content to DITA

The Oxygen XML User Manual has a detailed topic enumerating the possibilities to convert Microsoft Word content to DITA: https://www.oxygenxml.com/doc/versions/20.1/ug-editor/topics/ooxml-to-dita.html?hl=migrate%2Cdita

Migrating Excel content to DITA

You can use Oxygen's Smart Paste functionality to copy content from an Excel spreadsheet and paste it inside an opened DITA topic. Also, as an alternate possibility, the Oxygen Resources Converter add-on was updated to be able to batch convert Excel to DITA: https://github.com/oxygenxml/oxygen-resources-converter

Migrating LibreOffice content to DITA

LibreOffice documents can be saved in Word format, and once you do that, you can convert the Word content to DITA as described above. Alternatively, you can save the LibreOffice documents to DocBook and then apply the DocBook to DITA conversion technique described above.

Migrating Google Docs to DITA

You have three possibilities to convert Google Docs to DITA using Oxygen:
  • Copy/Pasting from Google Docs to a DITA Topic opened in Oxygen in the Author visual editing mode should work and convert the pasted content to DITA.
  • Save the Google document as OpenDocumentFormat (ODF) then save the ODF document as DocBook with Libre Office, then apply the DocBook to DITA transformation scenario shipped in Oxygen to convert DocBook to DITA.
  • Save the Google document as HTML then use the Oxygen batch converter add-on to convert it to DITA: https://github.com/oxygenxml/oxygen-resources-converter

Migrating Markdown content to DITA

The DITA Open Toolkit publishing engine bundled with Oxygen allows you to reference Markdown files directly in a DITA map and either publish them directly or export the Markdown files to DITA one by one: https://www.oxygenxml.com/doc/versions/20.1/ug-editor/topics/markdown-dita-x-dita2.html. If you want to convert multiple Markdown documents at once, you can use the Oxygen Resources Converter add-on: https://github.com/oxygenxml/oxygen-resources-converter

Migrating HTML content to DITA

Using Oxygen's Smart Paste functionality, you can open the HTML documents in a web browser, then copy the contents and paste it in a DITA topic opened in Oxygen's Author visual editing mode. If you want to convert multiple HTML files, you can use the Oxygen Resources Converter add-on: https://github.com/oxygenxml/oxygen-resources-converter

Migrating unstructured FrameMaker to DITA

There is a FrameMaker plugin that can be used for this type of conversion: http://leximation.com/tools/info/fm2dita.php

Migrating MadCap content to DITA

Some recent MadCap versions seem to have facilities to export content directly to DITA. Otherwise, you will need to convert XHTML content to DITA with a custom XSLT stylesheet to preserve variable references.

Migrating other formats to DITA

You may find third-party applications (like Pandoc) that can convert your content to HTML or to some kind of XML format like DocBook. Once you have HTML or DocBook content, you can convert them to DITA using the advice above.