wendellpiez / JATSKit

oXygen XML Editor framework for NISO JATS 1.1 / NLM BITS 2.0
Apache License 2.0
36 stars 32 forks source link

Support for inserting links #6

Closed raducoravu closed 8 years ago

raducoravu commented 10 years ago

Support to easily insert links to external or internal resources. This would imply a toolbar action which would probably show a dialog to the user allowing him to select a target for the link. I do not know the type of links JATS has. Aare there also links to external resources or only internal IDREF-based links?

wendellpiez commented 9 years ago

JATS has ext-link for external links and xref for internal (IDREF) links.

Also we want file-picker functionality for graphic and inline-graphic if it is not already there. (This is easy enough and I can do it.)

There are a couple of other elements/attributes that have linking semantics, such as external-resource and external-object, but these are underspecified (IMO) so we may have to leave them alone. But they are worth looking at.

(Docs at http://jats.nlm.nih.gov/extensions/bits/tag-library/1.0/ under @xlink:href show the possible parents of this attribute; it is not a short list.)

BITS now has support for XInclude, which may be a complication for xref in BITS-conformant documents.

raducoravu commented 9 years ago
 Also we want file-picker functionality for graphic and inline-graphic if it is not already there. (This is easy enough and I can do it.)

This should already be implemented.

So we would probably need two link actions, one for external links and one for internal ones, right?

wendellpiez commented 9 years ago

I now have this in one of my CSS files (which could be migrated upstream if wanted):

ext-link:after {
    content:
        oxy_urlChooser(        
        edit, "@xlink:href",
        columns 40);
}

Do we need anything more than this?

Internal linking (via xref/@rid) already appears to work.

Formally, xref/@rid is IDREFS and can target multiple ID values -- but this feature is rarely if ever used TMK. Should we worry about that?

raducoravu commented 9 years ago

Yes, this is one way of allowing insertion of external links, via a form control. Another way would be via a toolbar action. The action could avoid using any custom Java operation, it could invoke an existing operation to insert an XML fragment like:

  <ext-link xlink:href="${ask('Paste Link Here:', url, '')}" xmlns:xlink="http://www.w3.org/1999/xlink"/>

That ask editor variable will automatically popup a dialog asking for an URL. Actually if you edit the XHTML document type association in the Preferences->"Document Type Associations" page, in the Author->Actions tab there is an action called "a.href" which again uses the same editor variable to ask for a link target.

wendellpiez commented 9 years ago

Putting editor variables into those fragments is really nice. I will remember that, even if ext-ref stays as it currently is (with the form control) it may be useful elsewhere.

wendellpiez commented 8 years ago

Closing, since what we have appears to be Good Enough.

wendellpiez commented 8 years ago

On the other hand I did use this method on one or two other Actions ...