On 11/30/2016 06:22 PM, nobili, philippe wrote:



For a couple of years we have been using our own DocBook customizations,
with specialized PDF/Webhelp and HTML output styles.  These
customization are bundled within XXE internally for our users.



For HTML/Webhelp rendering, we would need some extra flexibility: for
some products/projects, deliver a customized copy of our stock CSS
(which is copied during the document conversion process).



We are wondering what you be **the simplest way** to provide this
feature to our users, ideally just a parameter they could set in XXE GUI
during documentation conversion and holding the name of their customized
CSS…  We know of course how to do this using a personal XXE
customization, but it is not really practical here.




My answer assumes that you are authoring DocBook 5 documents but the same approach applies to DocBook 4 (or DITA).

How to achieve what you want for a group of users is not well documented, if at all. Sorry for that.

Let's see step by step what to do:

1) Create a directory in the XXE_user_preferences_dir/addon/. Let's call this directory sample_customize_docbook5/. This directory is intended to contain all your customizations of the DocBook v5+ configuration.

("XXE_user_preferences_dir" is explained here http://www.xmlmind.com/xmleditor/_distrib/doc/configure/anatomy_of_a_config.html#xxe_user_preferences_dir)

2) Create in sample_customize_docbook5/ a configuration file called 0docbook5.xxe

As explained in "XMLmind XML Editor - Configuration and Deployment, 5. Customizing an existing configuration" (http://www.xmlmind.com/xmleditor/_distrib/doc/configure/customizing.html), this file must contain:

---
<configuration name="DocBook v5+" mimeType="application/x-docbook-5+xml"
  icon="xxe-config:common/mime_types/docbook.png"
  xmlns="http://www.xmlmind.com/xmleditor/schema/configuration";
  xmlns:cfg="http://www.xmlmind.com/xmleditor/schema/configuration";
  xmlns:db="http://docbook.org/ns/docbook";
  xmlns:svg="http://www.w3.org/2000/svg";
  xmlns:xi="http://www.w3.org/2001/XInclude";
  xmlns:xlink="http://www.w3.org/1999/xlink";
  xmlns:html="http://www.w3.org/1999/xhtml";>

  <include location="docbook5-config:docbook5.xxe"/>

</configuration>
---

3) Create in sample_customize_docbook5/ one or more CSS files customizing the WebHelp output.

It's possible to completely restyle the WebHelp output or to refer to the stock style as follows:

---
@import (__stock_webhelp.css);

h1,
h2,
h3,
h4,
h5,
h6 {
    color: #800000;
    border-bottom: 1px solid #800000;
    padding-bottom: 0.25em;
}
---

Let's call the above custom CSS file maroon_webhelp.css.

To make things even clearer, I've also created a second custom CSS file called navy_webhelp.css:

---
@import (__stock_webhelp.css);

h1,
h2,
h3,
h4,
h5,
h6 {
    color: #000080;
    border-bottom: 3px double #000080;
    padding-bottom: 0.25em;
}
---


4) Now let's tell XXE about these custom CSS files for use for WebHelp output. This is done by adding these properties in sample_customize_docbook5/0docbook5.xxe

---
  <!-- Format is one or more CSS label/CSS URI pairs
       separated by newlines. -->

  <property name="db5.toWebHelp.alternateCSS">Maroon, underlined, headings
maroon_webhelp.css
Navy, underlined, headings
navy_webhelp.css</property>

  <!-- Required to let XXE find maroon_webhelp.css and
       navy_webhelp.css -->

  <property name="db5.toWebHelp.alternateCSS.base"
            url="true">maroon_webhelp.css</property>
---

5) Delete XXE_user_preferences_dir/cache/ to be sure that XXE will see your sample_customize_docbook5/

6) Start XXE and open a DocBook 5 document. Select "Options|Customize Configuration|Customize Document Conversion Stylesheets" (see http://www.xmlmind.com/xmleditor/_distrib/doc/help/ConversionStylesheetsEditor_reference.html). Then select "Convert to Web Help".

You'll see attached screenshot1.png.

The end user may now select the CSS file she/he prefers from the "CSS stylesheet" comboxbox. See screenshot2.png.

After that, there is nothing else for the end user to do (I mean, CSS file copies to Web Help output directory is automatic). Moreover, the CSS choice made by the end user is persistent across editing sessions.

Please find attached to this email sample_customize_docbook5.tar.gz which will let you experiment with this facility.



---
PS: There are probably other ways to achieve what you want (e.g. <property name="db5.toWebHelp.resource.css"> as explained in http://www.xmlmind.com/xmleditor/_distrib/doc/configure/customize_html_css.html) but what's explained here is the cleanest way to do it and also the nicest to use by the end user. Moreover the explained method is guaranteed to survive XXE upgrades.





Attachment: sample_customize_docbook5.tar.gz
Description: application/gzip

--
XMLmind XML Editor Support List
xmleditor-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to