最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【记录】docbook的docbook-xls-ns-1.78.1中的webhelp:优化使得共享webhelp的(css和js等)模板文件

Docbook crifan 2593浏览 0评论

【背景】

折腾:

【记录】使用docbook的docbook-xsl-ns-1.78.1替换旧的ant改用make去编译webhelp

期间,已经使得在本地,使用docbook-xsl-ns-1.78.1,可以正常编译webhelp了。

现在接着去:

确保,本地和在线,都只有一份webhelp\template\common的内容

  • 其下包含很多子文件夹和公用文件的,比如:
  • css
    • ie.css
    • positioning.css
  • images
    • admon\
    • callouts\
  • jquery
    • jquery-1.7.2.min.js
    • jquery-ui-1.8.2.custom.min.js
  • browserDetect.js
  • main.js
  • splitterInit.js

 

【折腾过程】

1.去看了看当前生成的:

D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\docbook\books\docbook_dev_note\output\webhelp\index.html

中的内容,关于common方面的路径,都是类似于:

<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"></link><link rel="stylesheet" type="text/css" href="common/css/positioning.css"></link><link rel="stylesheet" type="text/css" href="common/jquery/theme-redmond/jquery-ui-1.8.2.custom.css"></link><link rel="stylesheet" type="text/css" href="common/jquery/treeview/jquery.treeview.css"></link><style type="text/css">

然后又看到官网的解释:

webhelp.common.dir

所以,去加了对应参数:

WEBHELP_OTHER_XSLTPROC_ARGS = \
    --stringparam webhelp.base.dir $(OUTPUT_DIR_WEBHELP) \
    --stringparam webhelp.common.dir $(TOOLS_XSL_NS_WEBHELP)/common

然后也不拷贝common了:

webhelp_copyfiles:
	-rm -rf $(OUTPUT_DIR_WEBHELP)
	mkdir -p $(OUTPUT_DIR_WEBHELP)
	@#cp -r $(TOOLS_XSL_NS_WEBHELP)/template/common ${OUTPUT_DIR_WEBHELP}

结果是:

生成的html中,地址变成需要的本地的路径了:

<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"></link><link rel="stylesheet" type="text/css" href="D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/commoncss/positioning.css"></link><link rel="stylesheet" type="text/css" href="D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/commonjquery/theme-redmond/jquery-ui-1.8.2.custom.css"></link><link rel="stylesheet" type="text/css" href="D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/commonjquery/treeview/jquery.treeview.css"></link><style type="text/css">

但是由于不小心,少了个斜杠:

D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/commonjquery/theme-redmond/jquery-ui-1.8.2.custom.css

应该是:

D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/common/jquery/theme-redmond/jquery-ui-1.8.2.custom.css

 

所以去改makefile为:

WEBHELP_OTHER_XSLTPROC_ARGS = \
    --stringparam webhelp.base.dir $(OUTPUT_DIR_WEBHELP) \
    --stringparam webhelp.common.dir $(TOOLS_XSL_NS_WEBHELP)/common/

然后结果是:

地址又搞错了:

D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/common/css/positioning.css

应该是:

D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/template/common/css/positioning.css

再去makefile改为:

WEBHELP_OTHER_XSLTPROC_ARGS = \
    --stringparam webhelp.base.dir $(OUTPUT_DIR_WEBHELP) \
    --stringparam webhelp.common.dir $(TOOLS_XSL_NS_WEBHELP)/template/common/

结果是:

(1)Firefox还是无法正常显示侧边栏目录

firefox can not show webhelp normal_thumb

原因:

猜测是之前就遇到的:

Firefox中不支持本地css文件地址,

需要加上:

file冒号三个斜杠

的前缀才可以的。

(2)IE中,提示js被禁了

ie note JavaScript is disabled on your browser_thumb

然后去Allow Blocked content,结果:

IE也是可以正常显示侧边栏的目录的:

after allow js IE also can show ok_thumb

(3)chrome则最好,直接就支持了,可以正常显示:

chrome is ok show webhelp without notice_thumb

 

2.然后,就去为本地地址,加上

file冒号三个斜杠

前缀:

WEBHELP_OTHER_XSLTPROC_ARGS = \
    --stringparam webhelp.base.dir $(OUTPUT_DIR_WEBHELP) \
    --stringparam webhelp.common.dir file冒号三个斜杠$(TOOLS_XSL_NS_WEBHELP)/template/common/

结果是:

地址就变成:

file冒号三个斜杠D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/template/common/css/positioning.css

了。

(1)firefox可以正常显示了:

file 3 slash prefix firefox can show ok_thumb

(2)IE还是要开启js才可以正常显示,chrome还是正常无压力的打开。

3.然后再去看看,

原先的docbook的webhelp的生成的,本地的:

D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\docbook\tools\docbook-xsl-ns-1.78.1\webhelp\docs\index.html

其结果是:

(1)Firefox可以正常显示

注意到,对应的js等文件,是:

common/css/positioning.css

的地址,即:

相对地址,所以直接显示,无需:

file冒号三个斜杠

前缀;

 

(2)IE中,也是需要提醒开启js:

docbook webhelp sample also ie js notice_thumb

然后才能正常显示的:

after enable js can show sidebar ok for ie_thumb

(3)chrome可以正常打开。

 

另外,对于在线的:

http://snapshots.docbook.org/xsl/webhelp/docs/

(其中:

  • 也是用的类似的webhelp的配置
  • 内部的js和css,也是相对路径

但是是:

firefox中也是可以正常显示的;

且IE也可以,不会有js被禁止的提示,直接正常显示:

docbook snapshot firefox can show webhelp_thumb

由此推断:

之后,再把webhelp上传到自己的网站时,也是会把对应的js和css等文件,都弄成相对地址的。

这样:

Firefox:js是css是相对地址,可以直接正常显示;

IE:无需被提醒js被禁止,也可以正常显示;

chrome:本身就可以正常显示;

如此以实现,可以同时支持三种浏览器;

而且无需用户去设置什么参数,无需点击运行js运行等等麻烦的操作;

4.然后继续去增加,当make编译 for 在线的webhelp,需要修改对应的路径的。

最后是用如下核心的makefile代码:

#===============================================================================
# Webhelp related
#===============================================================================

# A list of files to exclude from indexing
INDEXER_EXCLUDED_FILES = ix01.html

# Use this variable to pass in other stringparams
# to the xsltproc pass that generates DocBook output.
# For example:
# WEBHELP_OTHER_XSLTPROC_ARGS = --stringparam example.param ""

#http://docbook.sourceforge.net/release/xsl/1.78.1/doc/html/webhelp.base.dir.html
#if not set, default will be docs under current docbook book src directory
WEBHELP_OTHER_XSLTPROC_ARGS_COMMON = \
    --stringparam webhelp.base.dir $(OUTPUT_DIR_WEBHELP)

WEBHELP_OTHER_XSLTPROC_ARGS_LOCAL = \
    --stringparam webhelp.common.dir file:///$(TOOLS_XSL_NS_WEBHELP)/template/common/

WEBHELP_OTHER_XSLTPROC_ARGS_RELEASE = \
    --stringparam webhelp.common.dir https://www.crifan.com/files/res/docbook/webhelp/template/common/
#default set to local
WEBHELP_OTHER_XSLTPROC_ARGS = $(WEBHELP_OTHER_XSLTPROC_ARGS_COMMON)
WEBHELP_OTHER_XSLTPROC_ARGS += $(WEBHELP_OTHER_XSLTPROC_ARGS_LOCAL)

# Profiling params. For more information on 
# profiling (conditional text) and DocBook documents, see
# http://www.sagehill.net/docbookxsl/Profiling.html
PROFILE.ARCH = ""
PROFILE.AUDIENCE = ""
PROFILE.CONDITION = ""
PROFILE.CONFORMANCE = ""
PROFILE.LANG = ""
PROFILE.OS = ""
PROFILE.REVISION = ""
PROFILE.REVISIONFLAG = ""
PROFILE.ROLE = ""
PROFILE.SECURITY = ""
PROFILE.STATUS = ""
PROFILE.USERLEVEL = ""
PROFILE.VENDOR = ""
PROFILE.WORDSIZE = ""
PROFILE.ATTRIBUTE = ""
PROFILE.VALUE = ""

# =================================================
# You probably don't need to change anything below
# unless you choose to add a validation step.
# ================================================
INDEXER_JAR         := $(TOOLS_XSL_NS_EXTENSIONS)/webhelpindexer.jar
TAGSOUP_JAR         := $(TOOLS_XSL_NS_EXTENSIONS)/tagsoup-1.2.1.jar
LUCENE_ANALYZER_JAR := $(TOOLS_XSL_NS_EXTENSIONS)/lucene-analyzers-3.0.0.jar
LUCENE_CORE_JAR     := $(TOOLS_XSL_NS_EXTENSIONS)/lucene-core-3.0.0.jar

#WEBHELP_CLASSPATH := $(INDEXER_JAR):$(TAGSOUP_JAR):$(LUCENE_ANALYZER_JAR):$(LUCENE_CORE_JAR)
#under Windows(Cygwin), (java classpath)
#(1)path seperator is semicolon ';' (not Linux's colon ':')
#(2) command contain semicolon means multile command, so need quote
# so become -> "path1;path2;path3"
#detail can refer:
#【已解决】docbook中去make webhelp编译webhelp结果出错:Error: Could not find or load main class com.nexwave.nquindexer.IndexerMain
#https://www.crifan.com/docbook_make_webhelp_error__could_not_find_or_load_main_class_com_nexwave_nquindexer_indexermain/
ifeq ($(OS_NAME_LOWCASE), cygwin)
WEBHELP_CLASSPATH := "$(INDEXER_JAR);$(TAGSOUP_JAR);$(LUCENE_ANALYZER_JAR);$(LUCENE_CORE_JAR)"
else
WEBHELP_CLASSPATH := $(INDEXER_JAR):$(TAGSOUP_JAR):$(LUCENE_ANALYZER_JAR):$(LUCENE_CORE_JAR)
endif


################################################################################
# webhelp
################################################################################
# webhelp:
#	@echo "=============================== generating ${PROJECT_NAME} webhelp =============================="
#	ant webhelp

#above has set this value
#webhelp: WEBHELP_OTHER_XSLTPROC_ARGS = $(WEBHELP_OTHER_XSLTPROC_ARGS_COMMON)
#webhelp: WEBHELP_OTHER_XSLTPROC_ARGS += $(WEBHELP_OTHER_XSLTPROC_ARGS_LOCAL)
webhelp: $(MAIN_SRC_FILE) $(SUB_SRC_FILES) $(MAKE_FILE) webhelp_copyfiles webhelp_chunk webhelp_index
	@echo "=============================== generating ${PROJECT_NAME} webhelp =============================="

webhelp_copyfiles:
	-rm -rf $(OUTPUT_DIR_WEBHELP)
	mkdir -p $(OUTPUT_DIR_WEBHELP)
	@#cp -r $(TOOLS_XSL_NS_WEBHELP)/template/common ${OUTPUT_DIR_WEBHELP}
	cp -a $(IMG_DIR) $(OUTPUT_DIR_WEBHELP)
	test ! -d $(IMG_DIR)/ || cp -a $(IMG_DIR)/ ${OUTPUT_DIR_WEBHELP}
	cp $(TOOLS_XSL_NS_WEBHELP)/template/favicon.ico ${OUTPUT_DIR_WEBHELP}/

webhelp_chunk:
	xsltproc \
        --xinclude --output xincluded-profiled.xml  \
          --stringparam  profile.arch ${PROFILE.ARCH} \
          --stringparam  profile.audience ${PROFILE.AUDIENCE} \
          --stringparam  profile.condition ${PROFILE.CONDITION} \
          --stringparam  profile.conformance ${PROFILE.CONFORMANCE} \
          --stringparam  profile.lang ${PROFILE.LANG} \
          --stringparam  profile.os ${PROFILE.OS} \
          --stringparam  profile.revision ${PROFILE.REVISION} \
          --stringparam  profile.revisionflag ${PROFILE.REVISIONFLAG} \
          --stringparam  profile.role ${PROFILE.ROLE} \
          --stringparam  profile.security ${PROFILE.SECURITY} \
          --stringparam  profile.status ${PROFILE.STATUS} \
          --stringparam  profile.userlevel ${PROFILE.USERLEVEL} \
          --stringparam  profile.vendor ${PROFILE.VENDOR} \
          --stringparam  profile.wordsize ${PROFILE.WORDSIZE} \
          --stringparam  profile.attribute ${PROFILE.ATTRIBUTE} \
          --stringparam  profile.value ${PROFILE.VALUE} \
          $(TOOLS_XSL_NS_PROFILING)/profile.xsl  \
          $(MAIN_SRC_FILE)
	xsltproc ${WEBHELP_OTHER_XSLTPROC_ARGS} $(TOOLS_XSL_NS_WEBHELP)/xsl/webhelp.xsl xincluded-profiled.xml 
	rm xincluded-profiled.xml

webhelp_index:
	java \
        -DhtmlDir=$(OUTPUT_DIR_WEBHELP) \
        -DindexerLanguage=en \
        -DhtmlExtension=html \
        -DdoStem=true \
        -DindexerExcludedFiles=$(INDEXER_EXCLUDED_FILES) \
        -Dorg.xml.sax.driver=org.ccil.cowan.tagsoup.Parser \
        -Djavax.xml.parsers.SAXParserFactory=org.ccil.cowan.tagsoup.jaxp.SAXFactoryImpl \
        -classpath $(WEBHELP_CLASSPATH) \
        com.nexwave.nquindexer.IndexerMain
	mkdir -p ${OUTPUT_DIR_WEBHELP}/search
	cp -r $(TOOLS_XSL_NS_WEBHELP)/template/search/* ${OUTPUT_DIR_WEBHELP}/search

clean_webhelp:
	@echo "=============================== cleaning ${PROJECT_NAME} webhelp =============================="
	@#ant clean
	-rm -rf $(OUTPUT_DIR_WEBHELP)

#overwrite default from local to release
release_webhelp: WEBHELP_OTHER_XSLTPROC_ARGS = $(WEBHELP_OTHER_XSLTPROC_ARGS_COMMON)
release_webhelp: WEBHELP_OTHER_XSLTPROC_ARGS += $(WEBHELP_OTHER_XSLTPROC_ARGS_RELEASE)
release_webhelp: webhelp
	@echo "=============================== release ${PROJECT_NAME} webhelp =============================="
	mkdir -p $(RELEASE_DIR_WEBHELP)
	- cp -a $(OUTPUT_DIR_WEBHELP)/* $(RELEASE_DIR_WEBHELP)
	- $(COMPRESS_TOOL) $(COMPRESS_FLAG) $(RELEASE_DIR_WEBHELP)/$(PROJECT_NAME).$(subst release_,,$@).$(COMPRESS_SUF) $(OUTPUT_DIR_WEBHELP)/*

clean_release_webhelp:
	@echo "=============================== cleaning ${PROJECT_NAME} webhelp release =============================="
	rm -rf $(RELEASE_DIR_WEBHELP)/*

然后可以正常的各种编译和删除:

CLi@PC-CLI-1 ~/develop/docbook/books/docbook_dev_note/src
$ make webhelp
rm -rf ../output/webhelp
mkdir -p ../output/webhelp
cp -a ./images ../output/webhelp
test ! -d ./images/ || cp -a ./images/ ../output/webhelp
cp D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/template/favicon.ico ../output/webhelp/
xsltproc \
        --xinclude --output xincluded-profiled.xml  \
          --stringparam  profile.arch "" \
          --stringparam  profile.audience "" \
          --stringparam  profile.condition "" \
          --stringparam  profile.conformance "" \
          --stringparam  profile.lang "" \
          --stringparam  profile.os "" \
          --stringparam  profile.revision "" \
          --stringparam  profile.revisionflag "" \
          --stringparam  profile.role "" \
          --stringparam  profile.security "" \
          --stringparam  profile.status "" \
          --stringparam  profile.userlevel "" \
          --stringparam  profile.vendor "" \
          --stringparam  profile.wordsize "" \
          --stringparam  profile.attribute "" \
          --stringparam  profile.value "" \
          D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/profiling/profile.xsl  \
          ./docbook_dev_note.xml
xsltproc --stringparam webhelp.base.dir ../output/webhelp --stringparam webhelp.common.dir file:///D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/template/common/ D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/xsl/webhelp.xsl xincluded-profiled.xml
language: en
Writing ../output/webhelp/background_docbook_come.html for sect2(background_docbook_come)
Writing ../output/webhelp/screenshot_docbook_one_in_multi_out.html for sect3(screenshot_docbook_one_in_multi_out)
Writing ../output/webhelp/what_is_the_docbook.html for sect2(what_is_the_docbook)
Writing ../output/webhelp/what_is_docbook.html for sect1(what_is_docbook)
Writing ../output/webhelp/why_use_docbook.html for sect1(why_use_docbook)
Writing ../output/webhelp/preface.html for preface(preface)
Writing ../output/webhelp/our_target.html for sect2(our_target)
Writing ../output/webhelp/format_convert_knowledge.html for sect2(format_convert_knowledge)
Writing ../output/webhelp/should_know_before_docbook.html for sect1(should_know_before_docbook)
Writing ../output/webhelp/ch01s02s01.html for sect2
Writing ../output/webhelp/download_xsltproc_win.html for sect2(download_xsltproc_win)
Writing ../output/webhelp/download_xsl_ns.html for sect2(download_xsl_ns)
Writing ../output/webhelp/download_fop.html for sect3(download_fop)
Writing ../output/webhelp/config_fop_home.html for sect3(config_fop_home)
Writing ../output/webhelp/add_fop_xconf.html for sect3(add_fop_xconf)
Writing ../output/webhelp/download_fop_add_conf.html for sect2(download_fop_add_conf)
Writing ../output/webhelp/prepare_docbook_src_xml.html for sect2(prepare_docbook_src_xml)
Writing ../output/webhelp/prepare_xml_config.html for sect3(prepare_xml_config)
Writing ../output/webhelp/convert_xml_to_html.html for sect3(convert_xml_to_html)
Writing ../output/webhelp/from_xml_generate_html.html for sect2(from_xml_generate_html)
Writing ../output/webhelp/prepare_pdf_config.html for sect3(prepare_pdf_config)
Writing ../output/webhelp/convert_xml_to_fo.html for sect3(convert_xml_to_fo)
Writing ../output/webhelp/convert_fo_to_pdf.html for sect3(convert_fo_to_pdf)
Writing ../output/webhelp/from_xml_generate_pdf.html for sect2(from_xml_generate_pdf)
Writing ../output/webhelp/pure_win_docbook_dev_env.html for sect1(pure_win_docbook_dev_env)
Writing ../output/webhelp/install_cygwin.html for sect2(install_cygwin)
Writing ../output/webhelp/download_fop_for_cygwin.html for sect2(download_fop_for_cygwin)
Writing ../output/webhelp/cygwin_docbook_dev_env.html for sect1(cygwin_docbook_dev_env)
Writing ../output/webhelp/ch01_build_env.html for chapter(ch01_build_env)
Writing ../output/webhelp/docbook4_vs_docbook5.html for sect1(docbook4_vs_docbook5)
Writing ../output/webhelp/entity_definition.html for sect1(entity_definition)
Writing ../output/webhelp/qanda_usage.html for sect1(qanda_usage)
Writing ../output/webhelp/fop_font_config.html for sect2(fop_font_config)
Writing ../output/webhelp/fop_notes.html for sect1(fop_notes)
Writing ../output/webhelp/docbook_some_concept.html for sect1(docbook_some_concept)
Writing ../output/webhelp/docbook_id_abbrev.html for sect3(docbook_id_abbrev)
Writing ../output/webhelp/docbook_best_practice.html for sect2(docbook_best_practice)
Writing ../output/webhelp/docbook_dev_notes.html for sect1(docbook_dev_notes)
Writing ../output/webhelp/example_docbook_debug_pdf.html for sect2(example_docbook_debug_pdf)
Writing ../output/webhelp/docbook_debug.html for sect1(docbook_debug)
Writing ../output/webhelp/docbook_focus_content.html for sect2(docbook_focus_content)
Writing ../output/webhelp/docbook_vs_building.html for sect2(docbook_vs_building)
Writing ../output/webhelp/docbook_summary.html for sect1(docbook_summary)
Writing ../output/webhelp/dobook_evolution_process.html for sect1(dobook_evolution_process)
Writing ../output/webhelp/ch02_notes.html for chapter(ch02_notes)
Writing ../output/webhelp/ch03_faq.html for chapter(ch03_faq)
Writing ../output/webhelp/intro_explain_docbook_materials.html for sect1(intro_explain_docbook_materials)
Writing ../output/webhelp/docbook_refer_materials.html for sect1(docbook_refer_materials)
Writing ../output/webhelp/ch04_materials.html for chapter(ch04_materials)
Writing ../output/webhelp/unknown_code_syntax_highlight.html for sect1(unknown_code_syntax_highlight)
Writing ../output/webhelp/unknown_zhcn_hypernate.html for sect1(unknown_zhcn_hypernate)
Writing ../output/webhelp/unknown_callout_co_re_number.html for sect1(unknown_callout_co_re_number)
Writing ../output/webhelp/ch05_issues.html for chapter(ch05_issues)
Writing ../output/webhelp/example_chapter_section.html for sect1(example_chapter_section)
Writing ../output/webhelp/example_para.html for sect1(example_para)
Writing ../output/webhelp/example_figure.html for sect1(example_figure)
Writing ../output/webhelp/example_table.html for sect1(example_table)
Writing ../output/webhelp/example_callout.html for sect1(example_callout)
Writing ../output/webhelp/example_link_xref.html for sect1(example_link_xref)
Writing ../output/webhelp/example_equation.html for sect1(example_equation)
Writing ../output/webhelp/example_list.html for sect1(example_list)
Writing ../output/webhelp/example_simplelist_literallayout.html for sect1(example_simplelist_literallayout)
Writing ../output/webhelp/example_xinclude.html for sect1(example_xinclude)
Writing ../output/webhelp/example_filename.html for sect1(example_filename)
Writing ../output/webhelp/example_admonitions_note.html for sect2(example_admonitions_note)
Writing ../output/webhelp/example_admonitions_caution.html for sect2(example_admonitions_caution)
Writing ../output/webhelp/example_admonitions_warning.html for sect2(example_admonitions_warning)
Writing ../output/webhelp/example_admonitions_tip.html for sect2(example_admonitions_tip)
Writing ../output/webhelp/example_admonitions_important.html for sect2(example_admonitions_important)
Writing ../output/webhelp/example_admonitions.html for sect1(example_admonitions)
Writing ../output/webhelp/ch06_examples.html for chapter(ch06_examples)
Writing ../output/webhelp/docbook_released_basic.html for sect1(docbook_released_basic)
Writing ../output/webhelp/docbook_released_embedded.html for sect1(docbook_released_embedded)
Writing ../output/webhelp/docbook_released_upper.html for sect1(docbook_released_upper)
Writing ../output/webhelp/docbook_released_other.html for sect1(docbook_released_other)
Writing ../output/webhelp/appendix.html for appendix(appendix)
Writing ../output/webhelp/index.html for book
Writing ../output/webhelp/search/l10n.js
rm xincluded-profiled.xml
java \
        -DhtmlDir=../output/webhelp \
        -DindexerLanguage=en \
        -DhtmlExtension=html \
        -DdoStem=true \
        -DindexerExcludedFiles=ix01.html \
        -Dorg.xml.sax.driver=org.ccil.cowan.tagsoup.Parser \
        -Djavax.xml.parsers.SAXParserFactory=org.ccil.cowan.tagsoup.jaxp.SAXFactoryImpl \
        -classpath "D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/extensions/webhelpindexer.jar;D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/extensions/tagsoup-1.2.1.jar;D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/extensions/lucene-analyzers-3.0.0.jar;D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/extensions/lucene-core-3.0.0.jar" \
        com.nexwave.nquindexer.IndexerMain
Stemming enabled
The created index files are located in ..\output\webhelp\search
Indexed the contents in 1 seconds
mkdir -p ../output/webhelp/search
cp -r D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/template/search/* ../output/webhelp/search
=============================== generating docbook_dev_note webhelp ==============================

CLi@PC-CLI-1 ~/develop/docbook/books/docbook_dev_note/src
$ make release_webhelp
rm -rf ../output/webhelp
mkdir -p ../output/webhelp
cp -a ./images ../output/webhelp
test ! -d ./images/ || cp -a ./images/ ../output/webhelp
cp D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/template/favicon.ico ../output/webhelp/
xsltproc \
        --xinclude --output xincluded-profiled.xml  \
          --stringparam  profile.arch "" \
          --stringparam  profile.audience "" \
          --stringparam  profile.condition "" \
          --stringparam  profile.conformance "" \
          --stringparam  profile.lang "" \
          --stringparam  profile.os "" \
          --stringparam  profile.revision "" \
          --stringparam  profile.revisionflag "" \
          --stringparam  profile.role "" \
          --stringparam  profile.security "" \
          --stringparam  profile.status "" \
          --stringparam  profile.userlevel "" \
          --stringparam  profile.vendor "" \
          --stringparam  profile.wordsize "" \
          --stringparam  profile.attribute "" \
          --stringparam  profile.value "" \
          D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/profiling/profile.xsl  \
          ./docbook_dev_note.xml
xsltproc --stringparam webhelp.base.dir ../output/webhelp --stringparam webhelp.common.dir https://www.crifan.com/files/res/docbook/webhelp/template/common/ D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/xsl/webhelp.xsl xincluded-profiled.xml
language: en
Writing ../output/webhelp/background_docbook_come.html for sect2(background_docbook_come)
Writing ../output/webhelp/screenshot_docbook_one_in_multi_out.html for sect3(screenshot_docbook_one_in_multi_out)
Writing ../output/webhelp/what_is_the_docbook.html for sect2(what_is_the_docbook)
Writing ../output/webhelp/what_is_docbook.html for sect1(what_is_docbook)
Writing ../output/webhelp/why_use_docbook.html for sect1(why_use_docbook)
Writing ../output/webhelp/preface.html for preface(preface)
Writing ../output/webhelp/our_target.html for sect2(our_target)
Writing ../output/webhelp/format_convert_knowledge.html for sect2(format_convert_knowledge)
Writing ../output/webhelp/should_know_before_docbook.html for sect1(should_know_before_docbook)
Writing ../output/webhelp/ch01s02s01.html for sect2
Writing ../output/webhelp/download_xsltproc_win.html for sect2(download_xsltproc_win)
Writing ../output/webhelp/download_xsl_ns.html for sect2(download_xsl_ns)
Writing ../output/webhelp/download_fop.html for sect3(download_fop)
Writing ../output/webhelp/config_fop_home.html for sect3(config_fop_home)
Writing ../output/webhelp/add_fop_xconf.html for sect3(add_fop_xconf)
Writing ../output/webhelp/download_fop_add_conf.html for sect2(download_fop_add_conf)
Writing ../output/webhelp/prepare_docbook_src_xml.html for sect2(prepare_docbook_src_xml)
Writing ../output/webhelp/prepare_xml_config.html for sect3(prepare_xml_config)
Writing ../output/webhelp/convert_xml_to_html.html for sect3(convert_xml_to_html)
Writing ../output/webhelp/from_xml_generate_html.html for sect2(from_xml_generate_html)
Writing ../output/webhelp/prepare_pdf_config.html for sect3(prepare_pdf_config)
Writing ../output/webhelp/convert_xml_to_fo.html for sect3(convert_xml_to_fo)
Writing ../output/webhelp/convert_fo_to_pdf.html for sect3(convert_fo_to_pdf)
Writing ../output/webhelp/from_xml_generate_pdf.html for sect2(from_xml_generate_pdf)
Writing ../output/webhelp/pure_win_docbook_dev_env.html for sect1(pure_win_docbook_dev_env)
Writing ../output/webhelp/install_cygwin.html for sect2(install_cygwin)
Writing ../output/webhelp/download_fop_for_cygwin.html for sect2(download_fop_for_cygwin)
Writing ../output/webhelp/cygwin_docbook_dev_env.html for sect1(cygwin_docbook_dev_env)
Writing ../output/webhelp/ch01_build_env.html for chapter(ch01_build_env)
Writing ../output/webhelp/docbook4_vs_docbook5.html for sect1(docbook4_vs_docbook5)
Writing ../output/webhelp/entity_definition.html for sect1(entity_definition)
Writing ../output/webhelp/qanda_usage.html for sect1(qanda_usage)
Writing ../output/webhelp/fop_font_config.html for sect2(fop_font_config)
Writing ../output/webhelp/fop_notes.html for sect1(fop_notes)
Writing ../output/webhelp/docbook_some_concept.html for sect1(docbook_some_concept)
Writing ../output/webhelp/docbook_id_abbrev.html for sect3(docbook_id_abbrev)
Writing ../output/webhelp/docbook_best_practice.html for sect2(docbook_best_practice)
Writing ../output/webhelp/docbook_dev_notes.html for sect1(docbook_dev_notes)
Writing ../output/webhelp/example_docbook_debug_pdf.html for sect2(example_docbook_debug_pdf)
Writing ../output/webhelp/docbook_debug.html for sect1(docbook_debug)
Writing ../output/webhelp/docbook_focus_content.html for sect2(docbook_focus_content)
Writing ../output/webhelp/docbook_vs_building.html for sect2(docbook_vs_building)
Writing ../output/webhelp/docbook_summary.html for sect1(docbook_summary)
Writing ../output/webhelp/dobook_evolution_process.html for sect1(dobook_evolution_process)
Writing ../output/webhelp/ch02_notes.html for chapter(ch02_notes)
Writing ../output/webhelp/ch03_faq.html for chapter(ch03_faq)
Writing ../output/webhelp/intro_explain_docbook_materials.html for sect1(intro_explain_docbook_materials)
Writing ../output/webhelp/docbook_refer_materials.html for sect1(docbook_refer_materials)
Writing ../output/webhelp/ch04_materials.html for chapter(ch04_materials)
Writing ../output/webhelp/unknown_code_syntax_highlight.html for sect1(unknown_code_syntax_highlight)
Writing ../output/webhelp/unknown_zhcn_hypernate.html for sect1(unknown_zhcn_hypernate)
Writing ../output/webhelp/unknown_callout_co_re_number.html for sect1(unknown_callout_co_re_number)
Writing ../output/webhelp/ch05_issues.html for chapter(ch05_issues)
Writing ../output/webhelp/example_chapter_section.html for sect1(example_chapter_section)
Writing ../output/webhelp/example_para.html for sect1(example_para)
Writing ../output/webhelp/example_figure.html for sect1(example_figure)
Writing ../output/webhelp/example_table.html for sect1(example_table)
Writing ../output/webhelp/example_callout.html for sect1(example_callout)
Writing ../output/webhelp/example_link_xref.html for sect1(example_link_xref)
Writing ../output/webhelp/example_equation.html for sect1(example_equation)
Writing ../output/webhelp/example_list.html for sect1(example_list)
Writing ../output/webhelp/example_simplelist_literallayout.html for sect1(example_simplelist_literallayout)
Writing ../output/webhelp/example_xinclude.html for sect1(example_xinclude)
Writing ../output/webhelp/example_filename.html for sect1(example_filename)
Writing ../output/webhelp/example_admonitions_note.html for sect2(example_admonitions_note)
Writing ../output/webhelp/example_admonitions_caution.html for sect2(example_admonitions_caution)
Writing ../output/webhelp/example_admonitions_warning.html for sect2(example_admonitions_warning)
Writing ../output/webhelp/example_admonitions_tip.html for sect2(example_admonitions_tip)
Writing ../output/webhelp/example_admonitions_important.html for sect2(example_admonitions_important)
Writing ../output/webhelp/example_admonitions.html for sect1(example_admonitions)
Writing ../output/webhelp/ch06_examples.html for chapter(ch06_examples)
Writing ../output/webhelp/docbook_released_basic.html for sect1(docbook_released_basic)
Writing ../output/webhelp/docbook_released_embedded.html for sect1(docbook_released_embedded)
Writing ../output/webhelp/docbook_released_upper.html for sect1(docbook_released_upper)
Writing ../output/webhelp/docbook_released_other.html for sect1(docbook_released_other)
Writing ../output/webhelp/appendix.html for appendix(appendix)
Writing ../output/webhelp/index.html for book
Writing ../output/webhelp/search/l10n.js
rm xincluded-profiled.xml
java \
        -DhtmlDir=../output/webhelp \
        -DindexerLanguage=en \
        -DhtmlExtension=html \
        -DdoStem=true \
        -DindexerExcludedFiles=ix01.html \
        -Dorg.xml.sax.driver=org.ccil.cowan.tagsoup.Parser \
        -Djavax.xml.parsers.SAXParserFactory=org.ccil.cowan.tagsoup.jaxp.SAXFactoryImpl \
        -classpath "D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/extensions/webhelpindexer.jar;D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/extensions/tagsoup-1.2.1.jar;D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/extensions/lucene-analyzers-3.0.0.jar;D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/extensions/lucene-core-3.0.0.jar" \
        com.nexwave.nquindexer.IndexerMain
Stemming enabled
The created index files are located in ..\output\webhelp\search
Indexed the contents in 1 seconds
mkdir -p ../output/webhelp/search
cp -r D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/webhelp/template/search/* ../output/webhelp/search
=============================== generating docbook_dev_note webhelp ==============================
=============================== release docbook_dev_note webhelp ==============================
mkdir -p ../release/webhelp
cp -a ../output/webhelp/* ../release/webhelp
7z a -mx9  ../release/webhelp/docbook_dev_note.webhelp.7z ../output/webhelp/*

7-Zip 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)
Can't load '/usr/lib/p7zip/Codecs/.keep-p7zip' (Permission denied)
Scanning

Creating archive ../release/webhelp/docbook_dev_note.webhelp.7z

Compressing  favicon.ico
Compressing  add_fop_xconf.html
Compressing  appendix.html
Compressing  background_docbook_come.html
Compressing  ch01s02s01.html
Compressing  ch01_build_env.html
Compressing  ch02_notes.html
Compressing  ch03_faq.html
Compressing  ch04_materials.html
Compressing  ch05_issues.html
Compressing  ch06_examples.html
Compressing  config_fop_home.html
Compressing  convert_fo_to_pdf.html
Compressing  convert_xml_to_fo.html
Compressing  convert_xml_to_html.html
Compressing  cygwin_docbook_dev_env.html
Compressing  dobook_evolution_process.html
Compressing  docbook4_vs_docbook5.html
Compressing  docbook_best_practice.html
Compressing  docbook_debug.html
Compressing  docbook_dev_notes.html
Compressing  docbook_focus_content.html
Compressing  docbook_id_abbrev.html
Compressing  docbook_refer_materials.html
Compressing  docbook_released_basic.html
Compressing  docbook_released_embedded.html
Compressing  docbook_released_other.html
Compressing  docbook_released_upper.html
Compressing  docbook_some_concept.html
Compressing  docbook_summary.html
Compressing  docbook_vs_building.html
Compressing  download_fop.html
Compressing  download_fop_add_conf.html
Compressing  download_fop_for_cygwin.html
Compressing  download_xsltproc_win.html
Compressing  download_xsl_ns.html
Compressing  entity_definition.html
Compressing  example_admonitions.html
Compressing  example_admonitions_caution.html
Compressing  example_admonitions_important.html
Compressing  example_admonitions_note.html
Compressing  example_admonitions_tip.html
Compressing  example_admonitions_warning.html
Compressing  example_callout.html
Compressing  example_chapter_section.html
Compressing  example_docbook_debug_pdf.html
Compressing  example_equation.html
Compressing  example_figure.html
Compressing  example_filename.html
Compressing  example_link_xref.html
Compressing  example_list.html
Compressing  example_para.html
Compressing  example_simplelist_literallayout.html
Compressing  example_table.html
Compressing  example_xinclude.html
Compressing  fop_font_config.html
Compressing  fop_notes.html
Compressing  format_convert_knowledge.html
Compressing  from_xml_generate_html.html
Compressing  from_xml_generate_pdf.html
Compressing  index.html
Compressing  install_cygwin.html
Compressing  intro_explain_docbook_materials.html
Compressing  our_target.html
Compressing  preface.html
Compressing  prepare_docbook_src_xml.html
Compressing  prepare_pdf_config.html
Compressing  prepare_xml_config.html
Compressing  pure_win_docbook_dev_env.html
Compressing  qanda_usage.html
Compressing  screenshot_docbook_one_in_multi_out.html
Compressing  should_know_before_docbook.html
Compressing  unknown_callout_co_re_number.html
Compressing  unknown_code_syntax_highlight.html
Compressing  unknown_zhcn_hypernate.html
Compressing  what_is_docbook.html
Compressing  what_is_the_docbook.html
Compressing  why_use_docbook.html
Compressing  search/stemmers/de_stemmer.js
Compressing  search/stemmers/en_stemmer.js
Compressing  search/stemmers/fr_stemmer.js
Compressing  search/htmlFileInfoList.js
Compressing  search/index-1.js
Compressing  search/index-2.js
Compressing  search/index-3.js
Compressing  search/l10n.js
Compressing  search/nwSearchFnt.js
Compressing  search/default.props
Compressing  search/en-us.props
Compressing  search/es-es.props
Compressing  search/ja-jp.props
Compressing  search/punctuation.props
Compressing  images/copy_out_that_line.gif
Compressing  images/docbook_pdf.gif
Compressing  images/docbook_xml_src.gif
Compressing  images/fo_src_with_indent.gif
Compressing  images/can_found_err_pos.jpg
Compressing  images/coref_in_html.jpg
Compressing  images/ctrl_g_line_7594.jpg
Compressing  images/ctrl_g_offset_441.jpg
Compressing  images/easy_find_line_pos_within_that_simple_error_line.jpg
Compressing  images/easy_to_found_error_line.jpg
Compressing  images/error_line_7594.jpg
Compressing  images/no_hl_fo_source.jpg
Compressing  images/no_indent_one_line_too_content.jpg
Compressing  images/with_hl_fo_src.jpg
Compressing  images/can_eary_find_err_line.png
Compressing  images/ctl_g_input_line_number.png
Compressing  images/ctl_g_input_line_number_with_indent_fo.png
Compressing  images/ctl_g_input_line_offset.png
Compressing  images/docbook_html.png
Compressing  images/docbook_htmls.png
Compressing  images/docbook_multi_format.png
Compressing  images/docbook_rtf.png
Compressing  images/docbook_txt.png
Compressing  images/done_docbook_arch.png
Compressing  images/generated_html_effect.png
Compressing  images/pdf_body_no_indent.png
Compressing  images/pdf_with_bookmark.png
Compressing  images/pdf_with_toc.png
Compressing  images/self_input_offset_within_line.png

Everything is Ok

CLi@PC-CLI-1 ~/develop/docbook/books/docbook_dev_note/src
$ make clean_webhelp
=============================== cleaning docbook_dev_note webhelp ==============================
rm -rf ../output/webhelp

CLi@PC-CLI-1 ~/develop/docbook/books/docbook_dev_note/src
$ make clean_release_webhelp
=============================== cleaning docbook_dev_note webhelp release ==============================
rm -rf ../release/webhelp/*

CLi@PC-CLI-1 ~/develop/docbook/books/docbook_dev_note/src
$

5.另外,再去参考:

webhelp.autolabel

(看到目录中,可以加上章节编号)

webhelp.indexer.language

(看到有zh中文支持)

去加上这些参数:

WEBHELP_OTHER_XSLTPROC_ARGS_COMMON = \
    --stringparam webhelp.base.dir $(OUTPUT_DIR_WEBHELP) \
    --stringparam webhelp.autolabel 1 \
    --stringparam webhelp.indexer.language zh

效果为:

结果经常章节索引编号没生效。

然后语言也没生效。

关于语言部分,看到了:

-DindexerLanguage=en

所以,需要改为统一的配置:

#WEBHELP_INDEX_LANGUAGE = en
WEBHELP_INDEX_LANGUAGE = zh

#http://docbook.sourceforge.net/release/xsl/1.78.1/doc/html/webhelp.base.dir.html
#if not set, default will be docs under current docbook book src directory
WEBHELP_OTHER_XSLTPROC_ARGS_COMMON = \
    --stringparam webhelp.base.dir $(OUTPUT_DIR_WEBHELP) \
    --stringparam webhelp.autolabel 1 \
    --stringparam webhelp.indexer.language $(WEBHELP_INDEX_LANGUAGE)
    

webhelp_index:
	java \
        -DhtmlDir=$(OUTPUT_DIR_WEBHELP) \
        -DindexerLanguage=$(WEBHELP_INDEX_LANGUAGE) \

 

然后效果为:

好像语言部分生效了:

search support zh seem ok

但是目录索引还是没有编号:

toc still no number index

后来看到:

D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\docbook\tools\docbook-xsl-ns-1.78.1\webhelp\xsl\webhelp-common.xsl

中设置了:

    <xsl:param name="section.autolabel" select="0"/>
    <xsl:param name="chapter.autolabel" select="0"/>
    <xsl:param name="appendix.autolabel" select="0"/>
    <xsl:param name="qandadiv.autolabel" select="0"/>
    <xsl:param name="reference.autolabel" select="0"/>
    <xsl:param name="part.autolabel" select="0"/>   

但是其只是去配置正文部分的章节索引。

而对于webhelp的目录的索引,的确是:

                    <xsl:if test="$webhelp.autolabel=1">
                        <xsl:variable name="label.markup">
                            <xsl:apply-templates select="key('id',$rootid)" mode="label.markup"/>
                        </xsl:variable>
                        <xsl:if test="normalize-space($label.markup)">
                            <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
                        </xsl:if>
                    </xsl:if>

等等内容去配置的。

但是不知道此处为何通过命令行给xsltproc传递:

–stringparam webhelp.autolabel 1

没效果。

6.所以去改为:

–stringparam webhelp.autolabel "1"

和:

–stringparam webhelp.indexer.language "zh"

看看效果:

结果问题依旧。

算了,暂时不管这部分了。

还是等后续,再去合并通用的xls配置,到此webhelp的xls的配置中,再去折腾这部分的设置吧。

 

【总结】

至此,算是基本告一段落了:

可以实现根据make编译local和release的不同

而传递xsltproc不同的WEBHELP_OTHER_XSLTPROC_ARGS值,

使得模板(css和js等文件)的路径分别指向本地还是在线的地址。

且都可以正常用三种浏览器,firefox,IE,Chrome,去打开。

 

注:

暂时,由于webhelp部分的template内容,还没上传到网站上,所以此时打开release版本的webhelp,部分js或css加载异常。

需要后续上传上去再去确认才可以的。

转载请注明:在路上 » 【记录】docbook的docbook-xls-ns-1.78.1中的webhelp:优化使得共享webhelp的(css和js等)模板文件

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.207 seconds, using 22.48MB memory