加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

什么是建议的工具链格式化XML DocBook?

发布时间:2020-12-16 08:05:17 所属栏目:百科 来源:网络整理
导读:我看过 Best tools for working with DocBook XML documents,但我的问题略有不同。目前推荐的格式化工具链 – 而不是编辑工具 – 用于XML DocBook? 在2003年的Eric Raymond的‘The Art of Unix Programming’(一本很好的书!)中,建议是XML-FO(XML格式化对
我看过 Best tools for working with DocBook XML documents,但我的问题略有不同。目前推荐的格式化工具链 – 而不是编辑工具 – 用于XML DocBook?

在2003年的Eric Raymond的‘The Art of Unix Programming’(一本很好的书!)中,建议是XML-FO(XML格式化对象),但是从这里我看到的建议表明XML-FO不再在开发中(尽管我不能再在StackOverflow上找到这个问题,所以也许是错误的)。

假设我主要对Unix / Linux(包括MacOS X)感兴趣,但是我不会自动忽略仅限Windows的解决方案。

Apache’s FOP是最好的方式吗?有什么办法吗

我已经在cygwin下使用DocBook进行了一些手工编写,以生成一页HTML,多页HTML,CHM和PDF。

我安装了以下内容:

> docbook样式表(xsl)存储库。
> xmllint,以测试xml是否正确。
> xsltproc,使用样式表处理xml。
> Apache’s fop,以生产PDF’。我确保将安装的文件夹添加到PATH。
>微软HTML Help Workshop,生产CHM的。我确保将安装的文件夹添加到PATH。

编辑:在下面的代码中,我使用的文件多于2个。如果有人想要清理版本的脚本和文件夹结构,请与我联系:guscarreno(squiggly / at)googlemail(period / dot)com

然后我使用一个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:

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=== Cleaningn"
@-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 defaultsn"
@-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 entitiesn"
@./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 CHMn"
@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 CHMn"
@"$(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 HTMLn"
@"$(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 PDFn"
@"$(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 PDFn"
@"$(XSLTPROC)" --output ./pdf/manual.fo ./build/pdf.xsl manual.xml

check: manual.xml
@echo -e "n=== Checking correctness of manualn"
@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-xsln"
@cd build && tar xzf docbook-xsl-1.71.0.tar.gz && touch docbook-xsl-1.71.0

自动生成上述文件输出。

我更喜欢使用nix方法来编写脚本,因为工具集更容易找到和使用,更不用说更容易链接了。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读