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

【记录】寻找docbook的通用的css配置

Docbook crifan 2377浏览 0评论

【背景】

之前折腾docbook期间,看过不少个docbook制作的在线html教程。

比如:

(花了好半天才找到:)

第 27 章 docbook 指南 – 使用 CSS 定制外观

而其中的css配置,还是很不错的。

觉得比我自己现在正在用的:

https://www.crifan.com/files/res/docbook/css/common_html.css

要好。

所以打算去使用,这个相对好看的,且比较通用的docbook的css配置。

【折腾过程】

1.但是却没找到对应的该css的代码。

2.后来是看到:

docbook.css.source

http://docbook.sourceforge.net/release/xsl/1.78.0/doc/html/docbook.css.source.html

好像是:

可以通过docbook内置的

去生成对应的,通用的css配置的

这个,也是我之前就一直所要实现的效果:

对于docbook的html相关的(单个html,多个html,chm,webhelp等等),包括pdf(比如表格的背景色,标题加粗等公用设置)

都应该是统一实现,

而且是凡是用docbook,都统一用此单个配置

更容易互相理解含义。

对应的,需要那个:

docbook.css.xml

去找了下,找到:

https://projects.coin-or.org/Coopr/browser/coopr.doc/trunk/docbook/xhtml-1_1/docbook.css.xml?rev=6057

https://github.com/ironbee/libhtp/blob/master/docs/docbook-xsl-ns-1.77.1/xhtml5/docbook.css.xml

后来发现,其实本地就有:

E:\Dev_Root\docbook\tools\docbook-xsl-ns-1.78.1\xhtml\docbook.css.xml

E:\Dev_Root\docbook\tools\docbook-xsl-ns-1.78.1\xhtml-1_1\docbook.css.xml

E:\Dev_Root\docbook\tools\docbook-xsl-ns-1.78.1\xhtml5\docbook.css.xml

抽空,去试试这个。

3.Filelist of package docbook-xsl-doc-html in jessie of architecture all

看到有个:

reference.css

所以去看了看本地的:

D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\docbook\tools\docbook-xsl-ns-1.78.1\docsrc\reference.css

然后去试试:

#HTML_STYLESHEET_LOCAL = file:///$(CSS_PATH_LOCAL)/common_html.css
HTML_STYLESHEET_LOCAL = file:///home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/docsrc/reference.css

结果是:

不是我想要的,通用的docbook的css的配置。

4.搜:

docbook css example

而找到:

CSS for HTML/XHTML

看到有个:

MozBook (example).

但是链接失效了。

自己去搜,而找到的:

http://svn.gna.org/svn/fsmetadata/trunk/demos/docbook/MozBook/

有:

http://svn.gna.org/svn/fsmetadata/trunk/demos/docbook/MozBook/MozBook.css

然后也看到有:

http://svn.gna.org/svn/fsmetadata/trunk/demos/docbook/docbook-css-0.4/

另外也找到:

https://github.com/orbeon/flyingsaucer-old/tree/master/demos/docbook/docbook-css-0.4

但是都还是不知道如何用。

5.从:

A CSS for DocBook

找到:

Cascading Stylesheet for DocBook XML

去下载:

http://www.badgers-in-foil.co.uk/projects/docbook-css/docbook-css-0.4.tar.gz

但是还是不知道如何用。

6.另外从

http://svnweb.freebsd.org/doc/head/share/misc/docbook.css

找到:

http://svnweb.freebsd.org/doc/head/share/misc/docbook.css?view=markup

下载

http://svnweb.freebsd.org/doc/head/share/misc/docbook.css?revision=42538&view=co

得到:

docbook.css

然后去用试试:

#HTML_STYLESHEET_LOCAL = $(CSS_PATH_LOCAL)/common_html.css
#HTML_STYLESHEET_LOCAL = file:///$(CSS_PATH_LOCAL)/common_html.css
#HTML_STYLESHEET_LOCAL = file:///home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/docsrc/reference.css
HTML_STYLESHEET_LOCAL = file:///D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/config/docbook-xsl-ns-1.78.1/html/css/docbook.css

效果是,多贴了些图,以便看清楚效果:

html main title is good and table is background is green

title is dark red and toc with indent

screen is no background

filename is green color is good

example is with light background

 

总体来说,效果还是很不错的。

所以,抽空,继续试试。

7.可以考虑,整合当前的这个docbook.css,再加上自己对于screen等内容加的背景,合并成自己的:

docbook_crl.css

给自己用。

8.后来又在:

http://www.badgers-in-foil.co.uk/projects/docbook-css/

中看到关于使用说明了:

To use, alter your XML file to include a stylesheet directive,

<?xml version="1.0"?>
<?xml-stylesheet href="docbook-css-0.3/driver.css" type="text/css"?>

<book>
...

然后注意到:

D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\docbook\config\docbook-xsl-ns-1.78.1\html\css\docbook-css-0.4\driver.css

中就是导入其他css:

@import "core.css";
@import "tables.css";
@import "styles.css";
@import "l10n.css";
@import "mozilla.css";
@import "opera.css";

所以,可以去直接本地设置css路径,应该也可以试用的:

# current only support single css file
#HTML_STYLESHEET_LOCAL = $(CSS_PATH_LOCAL)/common_html.css
#HTML_STYLESHEET_LOCAL = file:///$(CSS_PATH_LOCAL)/common_html.css
#HTML_STYLESHEET_LOCAL = file:///home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/docsrc/reference.css
#HTML_STYLESHEET_LOCAL = file:///D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/config/docbook-xsl-ns-1.78.1/html/css/docbook.css
HTML_STYLESHEET_LOCAL = file:///D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/config/docbook-xsl-ns-1.78.1/html/css/docbook-css-0.4/driver.css
HTML_STYLESHEET_RELEASE = $(CSS_PATH_RELEASE)/common_html.css

结果是:

没啥效果,所以貌似不能这么用。

9.再去试试:

<!DOCTYPE book
[

<!ENTITY cur_book_name      "docbook_dev_note" >
<!ENTITY publish_date       "2013-09-05" >
<!ENTITY release_version    "1.7" >

<!ENTITY copyrith_year "2013" >
<!ENTITY entity_common_multi_format SYSTEM  "../../entity_common_multi_format.xml">
<!ENTITY entity_common_publish_info SYSTEM  "../../entity_common_publish_info.xml">
]>

<book version="5.0"
    xmlns="http://docbook.org/ns/docbook"
    xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:xl="http://www.w3.org/1999/xlink"

    xml:lang="zh_CN"
    >

<?xml-stylesheet href="D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/config/docbook-xsl-ns-1.78.1/html/css/docbook-css-0.4/driver.css" type="text/css"?>

<info>
    <title>Docbook开发手记</title>
    <subtitle></subtitle>
    <keywordset>
        <keyword>Docbook</keyword>
        <keyword>Docbook5</keyword>
        <keyword>中文</keyword>
        <keyword>开发</keyword>
        <keyword>搭建环境</keyword>
    </keywordset>

结果无效。

10.再去试试:

<?xml version='1.0' encoding="utf-8"?>

<?xml-stylesheet href="D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/config/docbook-xsl-ns-1.78.1/html/css/docbook-css-0.4/driver.css" type="text/css"?>

<!DOCTYPE book
[

<!ENTITY cur_book_name      "docbook_dev_note" >
<!ENTITY publish_date       "2013-09-05" >
<!ENTITY release_version    "1.7" >

<!ENTITY copyrith_year "2013" >
<!ENTITY entity_common_multi_format SYSTEM  "../../entity_common_multi_format.xml">
<!ENTITY entity_common_publish_info SYSTEM  "../../entity_common_publish_info.xml">
]>

<book version="5.0"
    xmlns="http://docbook.org/ns/docbook"
    xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:xl="http://www.w3.org/1999/xlink"

    xml:lang="zh_CN"
    >

结果,还是不行。

11.再去试试:

<?xml version='1.0' encoding="utf-8"?>

<?xml-stylesheet href="file:///D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/config/docbook-xsl-ns-1.78.1/html/css/docbook-css-0.4/driver.css" type="text/css"?>

<!DOCTYPE book
[

结果

还是不行。

11.后来对于:

http://i.linuxtoy.org/docs/guide/ch27s21.html

找到了其css:

http://i.linuxtoy.org/docs/guide/docbook.css

所以下载下来,另存为:

docbook_from_linuxtoy_org.css

去用试试:

# current only support single css file
#HTML_STYLESHEET_LOCAL = $(CSS_PATH_LOCAL)/common_html.css
#HTML_STYLESHEET_LOCAL = file:///$(CSS_PATH_LOCAL)/common_html.css
#HTML_STYLESHEET_LOCAL = file:///home/CLi/develop/docbook/tools/docbook-xsl-ns-1.78.1/docsrc/reference.css
#HTML_STYLESHEET_LOCAL = file:///D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/config/docbook-xsl-ns-1.78.1/html/css/docbook.css
HTML_STYLESHEET_LOCAL = file:///D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/config/docbook-xsl-ns-1.78.1/html/css/docbook_from_linuxtoy_org.css
#HTML_STYLESHEET_LOCAL = file:///D:/tmp/tmp_dev_root/cgwin/home/CLi/develop/docbook/config/docbook-xsl-ns-1.78.1/html/css/docbook-css-0.4/driver.css
HTML_STYLESHEET_RELEASE = $(CSS_PATH_RELEASE)/common_html.css

结果效果也很不错:

docbook main html header part whole background

all toc is black with blue text

sect header is bold look good

link with blue background

filename is light green also good but callout is bad

header title align middle with bold and appendix is good

所以,这个效果也是不错的。

只是细节需要调整。

 

【总结】

不管怎么说,还是抽空,将喜欢的样式,合并为自己的docbook_crl.css再说。

转载请注明:在路上 » 【记录】寻找docbook的通用的css配置

发表我的评论
取消评论

表情

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

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