Page 1 of 1

Tool-tip Acronym Expansions

Posted: Tue Sep 20, 2016 2:58 am
by cjboorman
I'm creating a document that contains many acronyms. As I'm reading through the document, I continually have to look up the acronym I'm currently readying (my memory isn't good enough to remember so many acronyms). It would be nice if I could simply hover my cursor over an acronym, and have the definition pop-up. I suspect this might not be too difficult to accomplish in HTML, but I'm wondering if oXygen XML Editor includes support for this. If it doesn't, then could you add support for it? Also, is there an oXygen SDK that I could use to program support for this?

Re: Tool-tip Acronym Expansions

Posted: Tue Sep 20, 2016 8:37 am
by Radu
Hi,

It would be great if you could give us more details:

What Oxygen version are you using?
What XML vocabulary are you using?
Are you editing in the Text mode or in the Author visual editing mode?

Regards,
Radu

Re: Tool-tip Acronym Expansions

Posted: Thu Sep 22, 2016 1:32 am
by cjboorman
I'm using oXygen XML Editor v18.

I'm using the DITA framework.

I'm editing in both XML and Author modes.

Re: Tool-tip Acronym Expansions

Posted: Thu Sep 22, 2016 10:26 am
by Radu
Hi,

So, as an overview, you are using the DITA <abbreviated-form> element with a keyref to refer to glossentries.
And when you hover over the abbreviated form (which already renders the term) in the Author mode you are interested in having a tooltip which shows the larger description of the abbreviated form, right?
This would make an interesting future improvement in Oxygen so I will add an issue on my side, we will update this thread when we manage to implement this.

If you want to do this yourself, in Oxygen 18.0 (latest version on web site) we added support to control the tooltips via the API:

Our Maven-based SDK is located here, you need to register for free to access it:
https://www.oxygenxml.com/oxygen_sdk_maven.html

There is a type of Oxygen plugin extension called Workspace Access plugin. There is a sample in the SDK.
This type of plugin extension receives a callback when the application starts, then it can add a listener and when a new XML file is opened in the Author visual editing mode, add on it a tooltip customizer. The code would look something like:

Code: Select all

          /**
* @see ro.sync.exml.workspace.api.listeners.WSEditorChangeListener#editorOpened(java.net.URL)
*/
@Override
public void editorOpened(final URL editorLocation) {
WSEditor openedEditor = pluginWorkspaceAccess.getEditorAccess(editorLocation, PluginWorkspace.MAIN_EDITING_AREA);
WSEditorPage currentEditingPage = openedEditor.getCurrentPage();
if(currentEditingPage instanceof WSAuthorEditorPage){
((WSAuthorEditorPage)currentEditingPage).addTooltipCustomizer(new AuthorTooltipCustomizer() {
@Override
public void customizeTooltip(AuthorAccess authorAccess, TooltipInformation tooltipInformation) {
if(tooltipInformation.getHoveredNode() instanceof AuthorElement){
AuthorElement hovered = ((AuthorElement)tooltipInformation.getHoveredNode());
if("abbreviated-form".equals(hovered.getLocalName())){
AttrValue keyrefAttr = hovered.getAttribute("keyref");
if(keyrefAttr != null){
String keyref = keyrefAttr.getValue();
KeyInfo keyInfo = DITAAccess.getKeys(editorLocation).get(keyref);
if(keyInfo != null){
URL locationOfGlossaryFile = keyInfo.getHrefLocation();
//TODO Now you can parse the glossary file, extract that information from it.
tooltipInformation.setDescription("NEW TOOLTIP MESSAGE COMPUTED BY YOUR CODE...");
}
}
}
}
}
});
}
}
}, PluginWorkspace.MAIN_EDITING_AREA);
}
Regards,
Radu

Re: Tool-tip Acronym Expansions

Posted: Thu Sep 22, 2016 8:09 pm
by cjboorman
I don't want the tooltip in the Author mode. I want it in the transformed result. E.g., In the resulting WebHelp version of the documentation. The tooltip is for my audience, not for me (the author). :-)

Re: Tool-tip Acronym Expansions

Posted: Thu Sep 22, 2016 8:41 pm
by cjboorman
I think I've discovered the way to accomplish this. It is to use glossary entries http://oxygenxml.com/doc/m/dita1.2_spec ... entry.html.

In this topic, it says "One possible implementation of a glossary in online processing is to associate a hotspot for mentions of terms in <term> elements and display the definition on hover or click."

Can you please provide me with an example that shows exactly how to do this?


Thanks,

Chris.

Re: Tool-tip Acronym Expansions

Posted: Fri Sep 23, 2016 8:48 am
by Radu
Hi Chris,

The DITA specification has an example:

https://www.oxygenxml.com/dita/1.3/spec ... -form.html

which shows how the glossentry topic looks like, how it's referred in the DITA Map and how the abbreviated-form is used in a topic.

Regards,
Radu

Re: Tool-tip Acronym Expansions

Posted: Fri Sep 23, 2016 9:34 pm
by cjboorman
I checked the example that you referred me to, but I'm afraid it doesn't do what I want.

When I hover my mouse over the abbreviation "ABS", I want a fly-out to appear that says "Anti-lock Brakes". How can I make that happen?

Re: Tool-tip Acronym Expansions

Posted: Mon Sep 26, 2016 12:39 pm
by Radu
Hi,
When I hover my mouse over the abbreviation "ABS", I want a fly-out to appear that says "Anti-lock Brakes". How can I make that happen?
I tested the ABS example, published to XHTML and to WebHelp using the DITA OT 2.x publishing engine bundled with Oxygen (Preferences->DITA page) and when hovering over the ABS link I get the small description.
Are you publishing using an external DITA Open Toolkit engine? If so, what version is it?
Or are you publishing with your own HTML plugin customizations which might have interfered with the default functionality?

Regards,
Radu

Re: Tool-tip Acronym Expansions

Posted: Mon Sep 26, 2016 7:52 pm
by cjboorman
Thanks. Is the example published? Can you send me a pointer to it so I can check it out for myself?

Re: Tool-tip Acronym Expansions

Posted: Tue Sep 27, 2016 11:27 am
by Radu
Hi,

I uploaded a small sample DITA project here:

files/abbreviated-form-sample.zip

If you publish the map to XHTML or to WebHelp, the sample_topic.html should have two references to the abbreviated-form, the first occurrence should be expanded and the second should be collapsed (only acronym). On both links, hovering should show the acronym definition.

Regards,
Radu

Re: Tool-tip Acronym Expansions

Posted: Tue Sep 27, 2016 8:17 pm
by cjboorman
Yes, your example works perfectly. Thank you very much!