Live data from Hacker News

Show HN: A Python script to convert DocBook books to QtHelp

github.com

1–6 of 6 posts

Show HN: A Python script to convert DocBook books to QtHelp

#1
I usually write my user documentation using DocBook. For my recent applications built on top of Qt (e.g. PaletteWB (www.palettewb.com)), I needed something that generates in-app help pages. db2qthelp does this.

Any criticism or interest is appreciated.

Show HN: A Python script to convert DocBook books to QtHelp
github.com

Re: Show HN: A Python script to convert DocBook books to QtHelp

#3
post #2

I suggest using XSLT to transform Docbook to other XML. It’s purpose-built for that task. Saxonica offers a Python plug-in, though truth is that the XSLT solution can do everything you need.

Yes, I know. But DocBook generates fine HTML and HTML is what QtHelp shows.

Re: Show HN: A Python script to convert DocBook books to QtHelp

#4
post #3
post #2

I suggest using XSLT to transform Docbook to other XML. It’s purpose-built for that task. Saxonica offers a Python plug-in, though truth is that the XSLT solution can do everything you need.

Yes, I know. But DocBook generates fine HTML and HTML is what QtHelp shows.

And you should then use XSLT to transform the docbook-generated html to Qt html. It is designed for that task, no weird Python regexes and string-splitting and indentation-tracking required. IOW, choosing the right tool for the job.

Re: Show HN: A Python script to convert DocBook books to QtHelp

#5
post #4
post #3

Earlier quoted context omitted.

Yes, I know. But DocBook generates fine HTML and HTML is what QtHelp shows.

And you should then use XSLT to transform the docbook-generated html to Qt html. It is designed for that task, no weird Python regexes and string-splitting and indentation-tracking required. IOW, choosing the right tool for the job.

:-) You insist...

Yeah, look, it's hacky, yes, and maybe runs only with a certain setting.

But, well, you may be right, when I think a second time about this. Thanks...

Re: Show HN: A Python script to convert DocBook books to QtHelp

#6
post #5
post #4

Earlier quoted context omitted.

And you should then use XSLT to transform the docbook-generated html to Qt html. It is designed for that task, no weird Python regexes and string-splitting and indentation-tracking required. IOW, choosing the right tool for the job.

:-) You insist... Yeah, look, it's hacky, yes, and maybe runs only with a certain setting. But, well, you may be right, when I think a second time about this. Thanks...

I should note that XPath is really the key here: it’s an elegant language to get and transform tree-structured and sequential data, so it could be well-used in a Pythonic template pipeline.

XSLT is a functional programming language that leans heavily on XPath to support transformation of tree-based structures. XQuery is another in the same vein. But you can accomplish the same things using an imperative language like Python, calling into XPath for data.