How to generate pdf from docbook 5.0 - linux

I've written a docbook 5.0 document with the header:
<?xml version="1.0" encoding="UTF-8"?>
<book version="5.0" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:m="http://www.w3.org/1998/Math/MathML"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:db="http://docbook.org/ns/docbook">
and docbook2pdf on Ubuntu 9.10 prints many error messages and doesn't do any pdf document. The errors are:
openjade:test.xml:2:0:E: prolog can't be omitted unless CONCUR NO and LINK EXPLICIT NO and either IMPLYDEF ELEMENT YES or IMPLYDEF DOCTYPE YES
openjade:test.xml:2:0:E: no document type declaration; will parse without validation
openjade:/usr/share/sgml/docbook/stylesheet/dsssl/modular/print/dbtitle.dsl:18:5:E: flow objects at the root must be all of class scroll or all of class page-sequence or simple-page-sequence
openjade:/usr/share/sgml/docbook/stylesheet/dsssl/modular/print/dbbibl.dsl:704:4:E: flow objects at the root must be all of class scroll or all of class page-sequence or simple-page-sequence
docbook2pdf for document in the docbook 4.5 format with normal header like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
works quite OK.
Is there any way to generate pdf from docbook 5.0?

I see three options (available in Debian/Ubuntu) to generate pdf from docbook:
jade, which provides the docbook2pdf command the asker used. jade is ancient and works with SGML, which predates XML and does not support Unicode; it also lacks support for docbook 5.
the docbook-xsl stylesheets which go through XSL-FO. docbook-xsl is for docbook 4.5, docbook-xsl-ns is for docbook5. Use fop to go from XSL-FO to PDF. Pipeline: docbook5 —(xsl)—> xml.fo —(fop)—> pdf . Commands involved: xsltproc, fop.
dblatex, which is primarily targeting docbook4.5 but has been updated for some of docbook5.
xmlto can drive the last two, although it currently defaults to docbook-xsl and not docbook-xsl-ns.
A quick Docbook5 user guide
Prerequisites
sudo aptitude install docbook5 docbook-xsl-ns xsltproc fop xmlto libxml2-utils xmlstarlet
Validation
xmlstarlet val --err --xsd /usr/share/xml/docbook/schema/xsd/5.0/docbook.xsd book.xml
PDF output
xsltproc /usr/share/xml/docbook/stylesheet/docbook-xsl-ns/fo/docbook.xsl book.xml > book.fo
fop -fo book.fo -pdf book.pdf

Apart from the header you gave, did you try a smaller example, like this one from the DocBook 5.0: The Definitive Guide ?
<?xml version="1.0" encoding="UTF-8"?>
<book xmlns='http://docbook.org/ns/docbook'>
<title>An Example Book</title>
<titleabbrev>Example</titleabbrev>
<info>
<legalnotice><para>No notice is required.</para></legalnotice>
<author><personname>
<firstname>Norman</firstname><surname>Walsh</surname>
</personname></author>
</info>
<dedication>
<para>
This book is dedicated to you.
</para>
</dedication>
<preface>
<title>Foreword</title>
<para>
Some content is always required.
</para>
</preface>
<chapter>
<title>A Chapter</title>
<para>
Content is required in chapters too.
</para>
</chapter>
<appendix>
<title>Optional Appendix</title>
<para>
Appendixes are optional.
</para>
</appendix>
</book>
Just rendered it to a PDF through one of my Maven environments. Can you give a small example (or a few separated onces) containing some content, which makes the use of all the additional name spaces necessary.
In case the above example does not work, and you are interested in how I have setup my environment read Making DocBook content available in a Maven project site. Just replace the example with the above DocBook 5.0 example. Only the docbkx-maven-plugin is of interest, in relation to this question. (PS: Some basic knowledge of Java and Maven2 is required for this.)

Publican
You can use Publican to publish your DocBook XML in PDF, html, and html-single formats. Publican is used by Red Hat as part of its internal documentation toolchain, and is an open source application hosted by the Fedora project. The tool uses "brands" to achieve a modularity in applying styles to the content being published. This preset manner simusing a wide variety of CMS or documentation tools.
JBoss Documentation Guide
A good example of the tool in action is the JBoss Press Gang documentation, which is itself a great resource the gives documentation community guidance on the use of DocBook XML in JBoss documentation. The html and PDF versions were generated with Publican.

There are significant differences between Docbook 4.5 and 5.0. And those differences can prevent your document from being transformed.
If you want to check the validity of your 5.0 document, you can use the following command line tool:
it's a java tool, so you need to have a recent java runtime environment.
the tool is Jing. You can download it from thaiopensource web site:
http://www.thaiopensource.com/relaxng/jing.html
you will also need the relax ng file for docbook 5.0. It is provided with the docbook 5 distribution.
run the validation test with the following command line:
java -jar path_to_Jing/jing.jar -t -i path_to_docbook5/docbook.rng document.xml
If there are some failures, they should be returned this way: Error at URL "file:...../document.xml", line number 211, column number 59: bad value for attribute "id" from namespace "http://www.w3.org/XML/1998/namespace"
Elapsed time 968+166=1134 milliseconds

http://docbookpublishing.com supports DocBook 5.0 documents. It is an online service for DocBook to PDF formatting. You can also submit your DocBook documents via the REST API.

Go to Eclipse and install DocBook Editing and Processing for Eclipse (DEP4E) plugin. You can find it by going into marketplace and search for docbook there. This plugin will create an example docbook and can publish in html, pdf, and even ebook.
Or check out the DEP4E web site, read the Quick Starter Guide section 3. Getting Started, to get an idea of it's possibilities.

wordpress post to docbook style posts:
http://hashfold.com/techfold/wordpress-how-to-generate-docbook-style-posts/

Related

What is the equivalent tag for ScriptCollector?

We want to migrate our project from IBM WebSphere 6.1 to Tomcat 6, but in our JSP-JSF UI pages we have extensively used below IBM JSF tags.
ScriptCollector
PanelRowCaregory
PagerWeb
OutPutSelections
InputRowSelect
InputHelperDatePicker
InputHelperAssist
ConvertMask
And to replace above tags, we are trying to find the equivalent tags from Sun JSF or any other open source libraries, but we didn't find any equivalent tags.
I wanted to know whether any body has already worked on this kind of migration project, if yes can you please share the equivalent tags?
or if you solved it differently even that info also will be useful.
Thanks in Advance.
There's no standard JSF equivalent for the <hx:scriptCollector> (although the JSF 2.0 <h:head> comes close). The <hx:scriptCollector> is only required by those IBM-specific <hx:xxx> components. It's designed to collect all JavaScript files required by those <hx:xxx> components and then render the desired <script> tag(s) without potential duplicates when multiple components require the same JS files. It's not required by any standard JSF component.
In other words, just get rid of it without replacement.
As to other tags, just check the available standard components in tag documentation or Java EE tutorial. If none is available, just pick a component library like PrimeFaces or RichFaces. If you still can't figure out, ask an individual question for the particular tag.

Can Asciidoctor render a separate HTML page per chapter?

If I have something like the following:
The Manual
====================
Gregg Bolinger
v1.0, 2014-15
:doctype: book
:icons: font
:imagesdir: images
Preamble paragraph
include::chapter1.ad[]
include::chapter2.ad[]
I'd like so that each chapter renders in its own HTML file and is linked to from the TOC rather than everything being in a single book.html, for example. It seems to generate separate files already, but that's only because they are in the source directory. It is still combining everything into a single HTML page. I'm using the Gradle Asciidoctor plugin, if that helps to know.
Unless there's something in the gradle plugin that does chunked html, asciidoctor does not handle chunked output at the moment. It's on the list of things to do, but it hasn't been done. If you look at the issue, however, someone has create a custom script/converter to do it though, perhaps that will work for your case as well.
Using the asciidoctor-multipage extension, each chapter can be rendered in its own HTML file. The links in the TOC points to the respective HTML chapters rather than everything being in a single book.html. At the end of every HTML page, the extension also adds links to the next or previous page, as seen on this website.
Assuming you have already installed the asciidoctor, just do $ gem install asciidoctor-multipage in your command line to install the multipage extension.
After making your file-name.adoc with various chapters, $ cd to that folder and then do $ asciidoctor -r asciidoctor-multipage -b multipage_html5 -D test/out --backend multipage_html5 -a data-uri file-name.adoc. This command will embed any images in the file-name.adoc to the new .html files which will be saved in newly created test/out folder. I only tested this using Ubuntu 20.04.
As Sam Macharia answered, asciidoctor-multipage can achieve your goal.
Also, most Docbook toolchains let you control how content is "chunked" into HTML pages, including at the book, chapter, and section levels.
Antora is the "official" way to achieve your goal.

Customizing HTML ouput of genhtml

I am using lcov and genhtml for code coverage. The output generated by genhtml has CSS style. The HTML window in wxWidgets 2.8.12 does not support CSS style HTML page.
Is it possible to get a normal HTML page using genhtml.
Regards
Johnnie
I don't know the answer to your question but wxWebView in wxWidgets 2.9 does support CSS so maybe you should consider upgrading to 2.9 and starting to use it.

Joomla 1.7 menu-type adding

I created a 1.7 component using Not Webdesigns Component Creator. They saved me a bunch of time in 1.5 so now Im finally switching to 1.7 coding I used them again for the basic outline of my components.
Now everything works and installs fine. Everything shows up and Joomla finds index.php?option=com_dealers (Its called com_dealers obv.) Just when I hit menu type in the menumanagement, there is no shortcut to my component. How do I add it to that list? A simple xml etc... was enough in 1.5 but it obviously isnt now...
Greetings,
Solution found, so Ill post it here, since I guess a lot of people will have this same problem using the creator.
The creator forgets one xml. Namely default.xml in site/views/COMPONENTNAME/tmpl . Add a default.xml there with the following content
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COMPONENTNAME">
<message>COMPONENTNAMEFront End view</message>
</layout>
</metadata>

Are there “server-side comments” in JSF / Seam / RichFaces?

With the JSF/Seam/RichFaces stack, is there a way to mark up comments (on XHTML pages) so that they will not be included in the HTML output? I.e., something like JSP's <%-- comments --%>, as opposed to normal <!-- comments -->.
I heard that facelets.SKIP_COMMENTS context-param migth do this for normal HTML comments, but is there any other option? (After all, there might be some comments that you want included in the page output and some that you don't.)
Found an answer in a thread on the JSF for nonbelievers forum of IBM developerWorks:
<ui:remove><!--
<tags you want to remove/>
--></ui:remove>
See the official Facelets documentation of ui:remove for more information.
Use the facelets.SKIP_COMMENTS context-param. You won't need comments in the generated pages. They are not meant to be human-readable anyway.

Resources