Page 1 of 1

Author mode CSS: any way to do this?

Posted: Thu Apr 04, 2019 8:32 pm
by martindholmes
Hi all,

This may be an impossible goal, but it's worth asking:

I have documents which are tagged in stand-off mode, using anchor elements, like this:

Code: Select all


...This discussion covers <anchor next="#v2j_ht4_1hb" ana="e:institution" />institutional repositories<anchor xml:id="v2j_ht4_1hb"/> and library support....
where the first anchor marks the start of a range of text and the second marks the end of it. I would really like to be able to underline the text between the two anchors in a specific colour based on the @ana value of the first attribute. I've been looking at the oxy_xpath function and trying to imagine how I might do this, but I can't figure out a way. Can anyone suggest how this might be done? If it were possible, it would make Author mode a really fabulous tool for stand-off markup.

All help appreciated,
Martin

Re: Author mode CSS: any way to do this?

Posted: Thu Apr 04, 2019 10:55 pm
by arcuous
I found this answer which suggests it's not possible: https://stackoverflow.com/questions/716 ... een-2-tags, and which also suggests the more obvious use of your <anchor> elements to wrap the text. I'm assuming they may overlap though, so your kind of marker tags are required instead.

Re: Author mode CSS: any way to do this?

Posted: Fri Apr 05, 2019 10:52 am
by Radu
Hi Martin,

We have Java API to add non-persistent highlights to Oxygen's Author page:

https://www.oxygenxml.com/InstData/Edit ... hlighter--

Besides adding highlight ranges you also configure the painter which will take care of painting over each highlighted area.

For example this is an open source plugin (based on the Workspace Access plugin extension) which adds support for a custom spell checker in Oxygen:

https://github.com/danielnaber/oxygen-l ... ool-plugin

Regards,
Radu

Re: Author mode CSS: any way to do this?

Posted: Fri Apr 05, 2019 10:54 pm
by martindholmes
Ah! I hadn't noticed that. I guess I should be able to use it with a caret listener to highlight ranges when the caret hits an anchor.

Thanks indeed,
Martin

Re: Author mode CSS: any way to do this?

Posted: Sat Apr 06, 2019 12:35 am
by martindholmes
Looking at the AuthorCaretListener, I'm going to have to instantiate it when the editor is activated, of course. Is there any way to do this through a Document Type configuration in JavaScript, as I can do with regular Author actions, or will this have to be done through a plugin? It looks as though the extensions page of the Document Type configuration only allows Java classes.

Cheers,
Martin

Re: Author mode CSS: any way to do this?

Posted: Mon Apr 08, 2019 7:54 am
by Radu
Hi Martin,

Indeed the "Extensions" tab in the Document Type Association configuration dialog allows only Java extension classes to be added.
So you either need to implement a Java extension and add it in a JAR library referenced in the "Claspath" tab or from a plugin when an editor is opened and the current page is Author or when an editor page changes (and the current page is author) you would need to add the caret listener.

Regards,
Radu