Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Vex » Custom CSS for DocBook(How can one customize the stylesheet to be used for DocBook authoring?)
Custom CSS for DocBook [message #1279171] Fri, 28 March 2014 10:31 Go to next message
Sergey Ushakov is currently offline Sergey UshakovFriend
Messages: 4
Registered: March 2014
Junior Member
Hi, I have recently installed Vex and succeeded with new document creation wizard Smile

Meanwhile I have trouble in getting the document associated with a custom stylesheet.

The standard approach with <?xml-stylesheet href="my-custom.css"?> as per w3.org 'xml-stylesheet' specification results in an error message reading "Unexpected error opening index.xml. Please report a bug at https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Mylyn%20Docs%20Vex".

On the other hand, the https://wiki.eclipse.org/Vex/UserGuide#CSS_-_StyleSheets user guide section mentions some possibility to get custom stylesheets added, but unfortunately contains no indication of the way to get the customization dialog opened.

Any ideas/guidance would be most appreciated...

Thanks in advance and best regards,
Sergey Ushakov
Re: Custom CSS for DocBook [message #1281156 is a reply to message #1279171] Mon, 31 March 2014 12:48 Go to previous messageGo to next message
Florian Thienel is currently offline Florian ThienelFriend
Messages: 38
Registered: July 2009
Member
Hi Sergey,

there are two ways to extend the functionality of Vex:
1. providing a "conventional" Eclipse bundle that has to be installed
2. using a Vex Plug-in project which resides in your workspace

In both ways an XML file ("plugin.xml" for (1), "vex-plugin.xml" for (2) is used to define the extensions. For a custom stylesheet you have to provide an extension for "org.eclipse.vex.ui.styles":

<plugin>
<extension
id="mydocbook-css"
name="My Custom Docbook Style"
point="org.eclipse.vex.ui.styles">
<style
css="styles/SampleDoc.css">
<doctypeRef publicId="-//OASIS//DTD DocBook XML V4.5//EN"/>
</style>
</extension>
</plugin>

The extension references the document type using its public ID.

I hope this helps. If you're facing further problems, please don't hesitate to ask.

BR Florian


Re: Custom CSS for DocBook [message #1282655 is a reply to message #1281156] Wed, 02 April 2014 16:26 Go to previous messageGo to next message
Sergey Ushakov is currently offline Sergey UshakovFriend
Messages: 4
Registered: March 2014
Junior Member
Thank you Florian.

This gave me an insight into the general approach, but unfortunately I still cannot get the whole thing working. It was only once that I saw in the "Document" / "Style" menu a new item for my new style. It was like a short glimpse, and I cannot reproduce it any more.

What I have is:
1) a new Vex Plug-in project that contains:
- a "vex-plugin.xml" file that reads like this:
<?xml version='1.0'?>
<plugin>
  <extension
      id="docbook-css-pcard"
      name="DocBook 5.0 PCARD"
      point="org.eclipse.vex.ui.styles"
      >
    <style css="styles/pcard.css">
      <doctypeRef publicId="____://docbook.org/xml/5.0/xsd/docbook.xsd" />
      </style>
    </extension>
</plugin>

- a "style" folder that contains a copy of "vex-outline.css" and a copy of "docbook-plain.css" renamed to "pcard.css"

2) another project that has a "WebContent" folder with an XML file starting like this:
<?xml version='1.0' encoding='UTF-8'?>
<book
    xmlns="____://docbook.org/ns/docbook"
    version="5.0"
    xmlns:xl="____://www.w3.org/1999/xlink"
    xmlns:xsi="____://www.w3.org/2001/XMLSchema-instance"
    >


And now when I open my DocBook XML file with "Visual XML Editor" and then open "Document" / "Style" menu, I only see the standard "DocBook Plain" option.

What else may be missing to get my new Vex Plug-in project working?

Thanks in advance and best regards,
Sergey Ushakov

P.S. I had to replace the protocol parts in the URLs with underscores to get my message posted...
Re: Custom CSS for DocBook [message #1282743 is a reply to message #1282655] Wed, 02 April 2014 18:38 Go to previous messageGo to next message
Florian Thienel is currently offline Florian ThienelFriend
Messages: 38
Registered: July 2009
Member
Hi Sergey,

please try this as vex-plugin.xml:

<?xml version='1.0'?>
<plugin>
  <extension
      id="docbook-css-pcard"
      name="DocBook 5.0 PCARD"
      point="org.eclipse.vex.ui.styles"
      >
    <style css="styles/pcard.css">
      <doctypeRef publicId="http://docbook.org/ns/docbook" />
      </style>
    </extension>
</plugin>


~Florian
Re: Custom CSS for DocBook [message #1283399 is a reply to message #1282743] Thu, 03 April 2014 11:21 Go to previous messageGo to next message
Sergey Ushakov is currently offline Sergey UshakovFriend
Messages: 4
Registered: March 2014
Junior Member
Thank you Florian, that got my whole thing working! Smile

Just one more question for cleaning it up.

By the moment my custom stylesheet starts with
@import url("docbook-plain.css");
and I have local copies of "docbook-plain.css" and "vex-outline.css" side-by-side with my custom CSS file in the "styles" subfolder of my Vex Plug-in project.

Is it possible to use some special URL for importing standard stylesheets from the plugin directly without necessity to hold local copies of theirs?

Thanks in advance and best regards,
Sergey
Re: Custom CSS for DocBook [message #1283455 is a reply to message #1283399] Thu, 03 April 2014 12:44 Go to previous messageGo to next message
Florian Thienel is currently offline Florian ThienelFriend
Messages: 38
Registered: July 2009
Member
Yes, you can use an URN that is registered in the XML catalog of Eclipse (see Preferences > XML > XML Catalog). We registered the docbook-plain.css as
urn:org:eclipse:vex:styles:docbook:docbook-plain.css
to make it reusable.

So the following should be working for you:
@import url(urn:org:eclipse:vex:styles:docbook:docbook-plain.css);


See also the our "o.e.vex.projectplan" plug-in, where we reuse the CSS from "o.e.vex.xhtml".

~Florian
Re: Custom CSS for DocBook [message #1283514 is a reply to message #1283455] Thu, 03 April 2014 14:01 Go to previous messageGo to next message
Sergey Ushakov is currently offline Sergey UshakovFriend
Messages: 4
Registered: March 2014
Junior Member
Thank you Florian, that worked perfectly for me!

And one more question, if you don't mind, probably the last one for my beginner's trail Smile

At the moment I have two visual styles available for my documents: "DocBook Plain" and my custom one. "DocBook Plain" is the default one, so I have to re-select my custom style every time a document is opened.

Is it possible to make my custom style more preferable than the standard one in my workspace?

Thanks in advance and best regards,
Sergey
Re: Custom CSS for DocBook [message #1283683 is a reply to message #1283514] Thu, 03 April 2014 18:08 Go to previous message
Florian Thienel is currently offline Florian ThienelFriend
Messages: 38
Registered: July 2009
Member
Hi Sergey,

the selected style is indeed not yet persisted. Please feel free to create a bugzilla (https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Mylyn%20Docs%20Vex) with a feature request.

~Florian

PS: the submission of a potential implementation of this feature to Gerrit is appreciated Very Happy
Previous Topic:Performance issues in VEX based editors.
Next Topic:Vex core api?
Goto Forum:
  


Current Time: Thu Mar 28 08:27:41 GMT 2024

Powered by FUDForum. Page generated in 0.02340 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top