什么是格式化XML的DocBook推荐的工具链? [英] What is the recommended toolchain for formatting XML DocBook?

查看:153
本文介绍了什么是格式化XML的DocBook推荐的工具链?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过的<一个href=\"http://stackoverflow.com/questions/55622/best-tools-for-working-with-docbook-xml-documents\">Best对于DocBook的XML文档工具的,但我的问题略有不同。这是目前建议的格式工具链 - 而不是编辑工具 - ?对XML的DocBook

I've seen Best tools for working with DocBook XML documents, but my question is slightly different. Which is the currently recommended formatting toolchain - as opposed to editing tool - for XML DocBook?

在雷蒙德的 从2003年Unix编程艺术(一本好书!),建议是自这里看到的建议,表示,XML-FO不再是正在开发的XML-FO(XML格式化对象),但我(虽然我再也找不到在计算器上那个问题,所以也许这是错误的)。

In Eric Raymond's 'The Art of Unix Programming' from 2003 (an excellent book!), the suggestion is XML-FO (XML Formatting Objects), but I've since seen suggestions here that indicated that XML-FO is no longer under development (though I can no longer find that question on StackOverflow, so maybe it was erroneous).

假设我在Unix / Linux操作系统(包括MacOSX)主要兴趣,但我不会自动忽略Windows的唯一解决方案。

Assume I'm primarily interested in Unix/Linux (including MacOS X), but I wouldn't automatically ignore Windows-only solutions.

的FOP 以最好的方式去?是否有任何替代方案?

Is Apache's FOP the best way to go? Are there any alternatives?

推荐答案

我一直在做的DocBook有一些手工书写,在Cygwin的,生产单页HTML,多页HTML,CHM和PDF。

I've been doing some manual writing with DocBook, under cygwin, to produce One Page HTML, Many Pages HTML, CHM and PDF.

我安装了以下内容:


  1. docbook的样式表(XSL)资源库。

  2. xmllint,以测试如果XML是正确的。

  3. xsltproc的,处理与样式表的XML。

  4. Apache的FOP ,生产PDF's.I确保已安装的文件夹添加到PATH中。

  5. 微软的<一个href=\"http://www.microsoft.com/downloads/details.aspx?FamilyID=00535334-c8a6-452f-9aa0-d597d16580cc&displaylang=en\"相对=nofollow> HTML Help Workshop的,制作CHM的。我一定要安装的文件夹添加到PATH。

  1. The docbook stylesheets (xsl) repository.
  2. xmllint, to test if the xml is correct.
  3. xsltproc, to process the xml with the stylesheets.
  4. Apache's fop, to produce PDF's.I make sure to add the installed folder to the PATH.
  5. Microsoft's HTML Help Workshop, to produce CHM's. I make sure to add the installed folder to the PATH.

修改:在下面的code我使用超过2档以上。如果有人想脚本和文件夹结构的清理版本,请与我联系:guscarreno(/在波浪)Googlemail电子邮件(周期/点)com

Edit: In the below code I'm using more than the 2 files. If someone wants a cleaned up version of the scripts and the folder structure, please contact me: guscarreno (squiggly/at) googlemail (period/dot) com

然后我用一个configure.in:

I then use a configure.in:

AC_INIT(Makefile.in)

FOP=fop.sh
HHC=hhc
XSLTPROC=xsltproc

AC_ARG_WITH(fop, [  --with-fop  Where to find Apache FOP],
[
    if test "x$withval" != "xno"; then
        FOP="$withval"
    fi
]
)
AC_PATH_PROG(FOP,  $FOP)

AC_ARG_WITH(hhc, [  --with-hhc  Where to find Microsoft Help Compiler],
[
    if test "x$withval" != "xno"; then
        HHC="$withval"
    fi
]
)
AC_PATH_PROG(HHC,  $HHC)

AC_ARG_WITH(xsltproc, [  --with-xsltproc  Where to find xsltproc],
[
    if test "x$withval" != "xno"; then
        XSLTPROC="$withval"
    fi
]
)
AC_PATH_PROG(XSLTPROC,  $XSLTPROC)

AC_SUBST(FOP)
AC_SUBST(HHC)
AC_SUBST(XSLTPROC)

HERE=`pwd`
AC_SUBST(HERE)
AC_OUTPUT(Makefile)

cat > config.nice <<EOT
#!/bin/sh
./configure \
    --with-fop='$FOP' \
    --with-hhc='$HHC' \
    --with-xsltproc='$XSLTPROC' \

EOT
chmod +x config.nice

和一个Makefile.in:

and a Makefile.in:

FOP=@FOP@
HHC=@HHC@
XSLTPROC=@XSLTPROC@
HERE=@HERE@

# Subdirs that contain docs
DOCS=appendixes chapters reference 

XML_CATALOG_FILES=./build/docbook-xsl-1.71.0/catalog.xml
export XML_CATALOG_FILES

all:    entities.ent manual.xml html

clean:
@echo -e "\n=== Cleaning\n"
@-rm -f html/*.html html/HTML.manifest pdf/* chm/*.html chm/*.hhp chm/*.hhc chm/*.chm entities.ent .ent
@echo -e "Done.\n"

dist-clean:
@echo -e "\n=== Restoring defaults\n"
@-rm -rf .ent autom4te.cache config.* configure Makefile html/*.html html/HTML.manifest pdf/* chm/*.html chm/*.hhp chm/*.hhc chm/*.chm build/docbook-xsl-1.71.0
@echo -e "Done.\n"

entities.ent: ./build/mkentities.sh $(DOCS)
@echo -e "\n=== Creating entities\n"
@./build/mkentities.sh $(DOCS) > .ent
@if [ ! -f entities.ent ] || [ ! cmp entities.ent .ent ]; then mv .ent entities.ent ; fi
@echo -e "Done.\n"

# Build the docs in chm format

chm:    chm/htmlhelp.hpp
@echo -e "\n=== Creating CHM\n"
@echo logo.png >> chm/htmlhelp.hhp
@echo arrow.gif >> chm/htmlhelp.hhp
@-cd chm && "$(HHC)" htmlhelp.hhp
@echo -e "Done.\n"

chm/htmlhelp.hpp: entities.ent build/docbook-xsl manual.xml build/chm.xsl
@echo -e "\n=== Creating input for CHM\n"
@"$(XSLTPROC)" --output ./chm/index.html ./build/chm.xsl manual.xml

# Build the docs in HTML format

html: html/index.html

html/index.html: entities.ent build/docbook-xsl manual.xml build/html.xsl
@echo -e "\n=== Creating HTML\n"
@"$(XSLTPROC)" --output ./html/index.html ./build/html.xsl manual.xml
@echo -e "Done.\n"

# Build the docs in PDF format

pdf:    pdf/manual.fo
@echo -e "\n=== Creating PDF\n"
@"$(FOP)" ./pdf/manual.fo ./pdf/manual.pdf
@echo -e "Done.\n"

pdf/manual.fo: entities.ent build/docbook-xsl manual.xml build/pdf.xsl
@echo -e "\n=== Creating input for PDF\n"
@"$(XSLTPROC)" --output ./pdf/manual.fo ./build/pdf.xsl manual.xml

check: manual.xml
@echo -e "\n=== Checking correctness of manual\n"
@xmllint --valid --noout --postvalid manual.xml
@echo -e "Done.\n"

# need to touch the dir because the timestamp in the tarball
# is older than that of the tarball :)
build/docbook-xsl: build/docbook-xsl-1.71.0.tar.gz
@echo -e "\n=== Un-taring docbook-xsl\n"
@cd build && tar xzf docbook-xsl-1.71.0.tar.gz && touch docbook-xsl-1.71.0

实现自动化生产上述文件输出。

to automate the production of the above mentioned file outputs.

我preFER使用尼克斯方法对脚本仅仅因为工具箱更容易查找和使用,更不要说更容易链。

I prefer to use a nix approach to the scripting just because the toolset is more easy to find and use, not to mention easier to chain.

这篇关于什么是格式化XML的DocBook推荐的工具链?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆