Page 1 of 1
Display xreflabel attribute contents in link text
Posted: Sat Aug 01, 2009 1:18 am
by xsaero00
According to DocBook docs, (
http://www.docbook.org/tdg5/en/html/xref.html) when a link (xref, link, ... ) is pointing to an element that has xreflabel attribute defined, the link text should match the content of the xreflabel attribute.
I cannot seem to find a way to do that in Author view. The CSS does not seem to allow something like that. Is there a way to do it with extension/plugins?
Re: Display xreflabel attribute contents in link text
Posted: Mon Aug 03, 2009 12:33 pm
by sorin_ristache
Hello,
That is not possible in the current version. We will consider that for a future version.
Regards,
Sorin
Re: Display xreflabel attribute contents in link text
Posted: Mon Aug 03, 2009 5:49 pm
by xsaero00
OK. Thanks for reply.
Is there some sort of substring function in CSS. Using function like those i could format my xref links to look like xreflabel.
Re: Display xreflabel attribute contents in link text
Posted: Tue Aug 04, 2009 10:26 am
by sorin_ristache
Hello,
There is no substring function in CSS. We will consider adding a CSS extension function for finding the substring of a string but the problem will be solved by xref taking the display text from the xreflabel attribute of the target element.
Regards,
Sorin
Re: Display xreflabel attribute contents in link text
Posted: Tue Aug 04, 2009 5:46 pm
by xsaero00
I guess we'll just wait for that feature. It is not a show stopper, but it is highly desired. Any idea on when you will work on it.
Re: Display xreflabel attribute contents in link text
Posted: Wed Aug 05, 2009 9:22 am
by sorin_ristache
It was not planned for a version number. It will be probably implemented in one of the future versions.
Regards,
Sorin
Re: Display xreflabel attribute contents in link text
Posted: Wed Aug 26, 2009 6:30 pm
by xsaero00
I was reading the development docs and it seems like I should be able to do this by implementing AuthorReferenceResolver interface. It seems suited exactly for that purpose.
Re: Display xreflabel attribute contents in link text
Posted: Thu Aug 27, 2009 2:36 pm
by sorin_ristache
You can set the
content property of the link element using a
ro.sync.ecss.extensions.api.StylesFilter implementation that you provide with
ro.sync.ecss.extensions.api.ExtensionsBundle.createAuthorStylesFilter(). You call
setProperty(KEY_MIXED_CONTENT, yourInstanceOf_StringContent) on the ro.sync.ecss.css.Styles parameter of
StylesFilter.filter() for overriding the
content property of the link element specified in the CSS stylesheet.
yourInstanceOf_StringContent is an object of type
ro.sync.ecss.css.StringContent that contains the displayed text of the link element when it is rendered in Author mode. In your case the displayed text should be the
xreflabel attribute of the target element which you find with an XPath expression executed with
ro.sync.ecss.extensions.api.AuthorAccess.getDocumentController().findNodesByXPath(). You get an
AuthorAccess object in a listener of type
ro.sync.ecss.extensions.api.AuthorExtensionStateListener that you provide in the method
ro.sync.ecss.extensions.api.ExtensionsBundle.createAuthorExtensionStateListener().
It seems complicated but there are just a few lines of code because the
Author API provides the entire infrastructure and hook points. Please let me know if it is not clear.
Regards,
Sorin
Re: Display xreflabel attribute contents in link text
Posted: Thu Aug 27, 2009 2:57 pm
by sorin_ristache
We will add this to the Simple Documentation Framework included in
Author SDK as another example of using the Author API.
Regards,
Sorin
Re: Display xreflabel attribute contents in link text
Posted: Thu Aug 27, 2009 5:50 pm
by xsaero00
Thanks I think that will work. StyleFilter seems to be more suited for my purpose.