BBS水木清华站∶精华区

发信人: long@eagle.ee.ntu.edu.tw (long), 看板: linux 
标  题: 如何用Linuxdoc-SGML撰写并维护Linux Howto(纯文字) 
发信站: National Taiwan University (Sat May 18 00:46:10 1996) 
转信站: maple!news.ee.nthu!news.cis.nctu!news.cc.nctu!spring!netnews.ntu!long 
 
 
  如何用Linuxdoc-SGML撰写并维护Linux Howto 
  吴晓龙, long@eagle.ee.ntu.edu.tw 
  v1.0, 17 July 1996 
  ______________________________________________________________________ 
 
  Table of Contents: 
 
  1.      前言 
 
  2.      安装 
 
  2.1.    安装之前 
 
  2.2.    安装 
 
  3.      为了与中文big5码相容之修改 
 
  3.1.    Script file 的修改 
 
  3.2.    Configuration file(LINUXDOCLIB/rep/xxx/ 
 
  4.      档案的转换 
 
  5.      Further Information 
  ______________________________________________________________________ 
 
  1.  前言 
 
  最近在Linux版上大家开始讨论所谓Taiwan Linux User Group的 
  可能性与其发展方向,我想如果真能产生一些共识与成果, 对於Linux 
  以至於U*ix的推广都是一个好的起头吧. 
  起码每天看tw.bbs.comp.linux时可以少按几下K.......:-) 
  现在大家好像还在讨论阶段,对於应该致力於软体中文化还 是Howto的翻译 
  都还众说纷云.不过我想不管是那个方向, 文件的撰写与维护都是很重要的, 
  因为只有这样, 才能够 使每个人的effort不致於孤芳自赏, 
  也能使经验传承下来. 
 
  由於有这个想法,我就花了一点时间看了一下howto中的Writing 
  发现Linux的howto早就有了一致的政策与文件规格. 
  本土文件的政策还有赖大家讨论,不过他们的文件规格倒是 
  很值得我们来套用.他们是用一种叫SGML(Standard Generalized Markup 
  Language)来写HOWTO的,更精确地来说,他们是用这种语言 
  来定义HOWTO文件的结构,使得每个人都可以轻易地写出格式相同 
  的文件.如果有人看到这里一头雾水,还搞不清楚这是一种什麽 
  语言的话,没关系,我也搞不太懂这是什麽...:-) 
  不过这就是他的优点了,搞不懂也可以照写不误, 大家可以边写边搞, 
  搞搞写写.......我是说这个语言啦....:-) 
  它最强大的地方是可以轻松地转换成一般文字档,LaTeX(ps,dvi), GNU Info, 
  LyX(好像是一种WYSIWYG的LaTeX)与RTF(这我就不知道是 
  什麽了).也就是说,你可以专心於撰写维护一份sgml文件,而不须 
  将心力浪费在文件转换上. 
 
  希望藉著这份文件能够减轻documentation的负担, 
  而使得有更多的人开始将自己的经验与其它linuxer分享, 
  然後不用每天看"我也要,我也是,as title"的文章 
  然後大家能够因此有更多的心力集中在coding上, 
  然後....能够..世界大同,宇宙和平....:-) 
 
  本文的html版可在http://eagle.ee.ntu.edu.tw/$tilde;long/linux/simple- 
  sgml.html存在 
 
  2.  安装 
 
  2.1.  安装之前 
 
  有几个package是必须的 
 
  □ 安装需要 
 
  □ ftp://nctuccca.edu.tw/Operating- 
     Systems/Linux/packages/Utils/text/linuxdoc-sgml-1.5.tar.gz 
 
  □ perl 
 
  □ flex 
 
  □ gcc 
 
  □ Format文件需要 
 
  □ groff 1.08 or 1.09 
 
  □ TeX and LaTeX (包含CJK套件) 
 
  □ gawk 及 GNU info tools 
 
  □ (optional) LyX 
 
  2.2.  安装 
 
  只需run the install script,回答binaries,library,documentation,man 
  pages 安放之处 
 
  3.  为了与中文big5码相容之修改 
 
  假设 LINUXDOCBIN=/usr/local/bin; LINUXDOCLIB=/usr/local/lib/linuxdoc- 
  sgml 
 
  注意:由於本人对中文码不太熟悉, 这些修改只是trial and error的结果, 
  无法保证所有的中文big5 code都能顺利显示, 
  而且修改的部份可能会造成转换後文件的特殊符号(如latex中的_,})无法显示 
 
  3.1.  Script file 的修改 
 
  修改LINUXDOCBIN/sgml2txt 
 
  第17行,将COL=``no''改为COL=``no'' 
 
  第105行,将 latin1) cat $SGMLFILE | sed -f $LINUXDOCLIB/latin1.sed 
 
  $LINUXDOCBIN/sgmls $DASHI $SGMLDECL > 
 
  /tmp/sgml2txt$$tmp;; 
 
  改为latin1) $LINUXDOCBIN/sgmls $DASHI $SGMLDECL $SGMLFILE > 
  /tmp/sgml2txt$$tmp;; 
 
  3.2.  Configuration file(LINUXDOCLIB/rep/xxx/general,mapping)的修改 
 
  □ LINUXDOCLIB/rep/latin1/general:第134行`` ''改为``$tilde;'' 
 
  □ LINUXDOCLIB/rep/latex2e/general:第120行``_''改为``_'', 
     第169行``''改为``}'' 
 
  □ LINUXDOCLIB/rep/latex2e/mapping: 
 
                     第7行将``\\usepackage\[latin1\]{inputenc}\n''替换成``\\usepackage{CJK}\n'' 
                     第12行加入``\\begin{CJK*}{Bg5}{kai}'' 
                     第15行加入``\\end{CJK*}'' 
 
  □ LINUXDOCLIB/rep/html/general:第128行将&nbsp换成~ 
 
  4.  档案的转换 
 
  □ 产生文字档 
 
      sgml2txt -l xxx.sgmL 
 
  □ 产生HTML文件 
 
      sgml2html xxx.sgml 
 
  □ 产生LaTeX文件 
 
      sgml2latex -2e xxx.sgml 
 
  5.  Further Information 
 
  □ The QWERTZ User's Guide is available from 
     ftp://ftp.cs.cornell.edu/pub/mdw/SGML.  QWERTZ (and hence, 
     Linuxdoc-SGML) supports many features such as mathematical 
     formulae, tables, figures, and so forth. I don't recommend using 
     most of these features in the Linux HOWTOs because they won't 
     render well in plain text. If you'd like to write general 
     documentation in SGML, I suggest using the original QWERTZ DTD 
     instead of the hacked-up Linuxdoc-SGML DTD, which I've modified for 
     use particularly by the Linux HOWTOs and other such documentation. 
 
  □ Tom Gordon's original QWERTZ tools can be found at 
     ftp://ftp.gmd.de/GMD/sgml. 
 
  □ More information on SGML can be found at the following WWW pages: 
 
     1. SGML and the Web <http://www.w3.org/hypertext/WWW/MarkUp/SGML/> 
 
     2. SGML Web Page <http://www.sil.org/sgml/sgml.html> 
 
  □ James Clark's sgmls parser, and it's successor nsgmls and other 
     tools can be found at ftp://ftp.jclark.com and at James Clark's WWW 
     Page <http://www.jclark.com>. 
 
  □ You can join the Linuxdoc-SGML mailing list by sending mail to 
     majordomo@via.ecp.fr with subscribe linuxdoc-sgml in the message 
     body.  The list address is linuxdoc-sgml@via.ecp.fr. 
 
  □ More information on LyX can be found at the LyX WWW Page 
     <http://wsiserv.informatik.uni-tuebingen.de/~ettrich/>.  LyX is a 
     high-level word processor frontend to LaTeX. Quasi-WYSIWYG 
     interface, many LaTeX styles and layouts automatically generated. 
     Speeds up learning LaTeX and makes complicated layouts easy and 
     intuitive. 
 

BBS水木清华站∶精华区