AsciiDocインストール
をテンプレートにして作成
[
Front page
] [
Page list
|
Search
|
Recent changes
|
RSS of recent changes
]
Start:
#contents
*要件 [#a3ba2fa4]
-Windows
-日本語文書
-pdf, html両方出力可能
*インストール [#v1ee2bae]
**事前準備 [#w580a6c2]
Python2.4以上がインストールされていること。
**asciidoc のインストール [#s5df18f7]
c:\binにディレクトリを掘って配置することにする。
cd c:\bin
mkdir asciidoc
unzip asciidoc-8.5.3.zip -d asciidoc
a2x.pyの修正。PDFを作るときにdblatexはPython版のを使うの...
CONF_DIRとかを書き換えとく必要あり。
--- a2x.py.orig Thu Jan 28 22:26:32 2010
+++ a2x.py Fri Jan 29 21:32:46 2010
@@ -25,7 +25,7 @@
# AsciiDoc global configuration file directory.
# NOTE: CONF_DIR is "fixed up" by Makefile -- don't ren...
-CONF_DIR = '/etc/asciidoc'
+CONF_DIR = 'C:/bin/asciidoc'
#######################################################...
@@ -38,16 +38,16 @@
ENV = None
# External executables.
-ASCIIDOC = 'asciidoc'
+ASCIIDOC = 'C:/bin/asciidoc/asciidoc.py'
XSLTPROC = 'xsltproc'
-DBLATEX = 'dblatex' # pdf generation.
+DBLATEX = 'C:/Python26/Scripts/dblatex' # pdf g...
FOP = 'fop' # pdf generation (--fop opt...
W3M = 'w3m' # text generation.
LYNX = 'lynx' # text generation (if no w3...
-XMLLINT = 'xmllint' # Set to '' to disable.
-EPUBCHECK = 'epubcheck' # Set to '' to disable.
+XMLLINT = '' # Set to '' to disable.
+EPUBCHECK = '' # Set to '' to disable.
# External executable default options.
ASCIIDOC_OPTS = ''
DBLATEX_OPTS = ''
FOP_OPTS = ''
XSLTPROC_OPTS = ''
@@ -533,7 +533,7 @@
docbook_file = self.dst_path('.xml')
xsl = self.asciidoc_conf_file(os.path.join('dbl...
sty = self.asciidoc_conf_file(os.path.join('dbl...
- shell('"%s" -t %s -p "%s" -s "%s" %s "%s"' %
+ shell('python "%s" -t %s -p "%s" -s "%s" %s "%s...
(DBLATEX, self.format, xsl, sty, self.dbla...
def to_dvi(self):
以上でxhtmlは出力できるようになった。PDFはa2xのバッチ処理...
変換させてる。asciidocからはHTML, XHTML, DocBook形式に出...
**xsltproc, xmllintのインストール [#b93ae2d9]
xsltprocは必須だが、xmllintはxmlの構文チェックするだけみ...
**MikTeXのインストール [#b6551b67]
Windows版のTeX一式。インストーラが便利。 http://miktex.or...
必要なパッケージ
changebar, colortbl, fancybox, fancyhdr, fancyvrb, listi...
overpic, rotating, subfigure, titlesec, bibtopic, enumit...
eepic, lm, lastpage, helvetic, times, symbol, courier.
appendix, footmisc, pdfpages, stmaryrd, wasysym
eso-pic, xcolor,
追加パッケージはまだあとで日本語関連で必要になったり、忘...
かもしれないが、とりあえずここまで入れる。
ここで一度MiKTexのbinへパスが通っているか確認。通ってなけ...
**dblatexのインストール [#rccc9c7b]
MiKTeXにもdblatex.exeは入っているが、これは使わないでPyth...
http://dblatex.sourceforge.net/ この辺から最新版の0.2.12...
zipなんかで固めてるのをunzipなどして、
cd dblatex-0.2.12
python setup.py install
でインストールする・・・前に、setup.pyの325行目
-- iroot = root.split(pref + os.path.sep)[1]
++ iroot = root.split(pref + os.path.sep)[0]
直しとかないと、インストールがこける。実行は
python C:/Python26/Scripts/dblatex book.xml
てな感じになる。
もし、
warning: failed to load external entity "file:custom.xsl"
というエラーが出る場合。次のファイルを修正する。~
C:\Python26\lib\site-packages\dbtexmf\core\dbtex.py
--- dbtex.py.orig Thu Jan 28 23:27:39 2010
+++ dbtex.py Thu Jan 28 23:28:40 2010
@@ -256,7 +256,7 @@
xslset = "doclist.xsl"
f = file(xslset, "w")
f.write(self.xsl_header)
- f.write('<xsl:import href="%s"/>\n' % path_to_u...
+ f.write('<xsl:import href="%s"/>\n' % path_to_u...
f.write('<xsl:import href="%s"/>\n' % path_to_u...
f.write('</xsl:stylesheet>\n')
f.close()
**動作確認 [#vda4ba04]
ここまでで、asciidocでHTML,PDFの出力が可能になったはず。...
cd c:/bin/asciidoc
pyhon asciidoc.py doc/asciidoc.txt
これでdoc/asciidoc.htmlができる。ちなみに目次を作るときは...
python asciidoc.py -a toc -a numbered doc/asciidoc.txt
次。PDF。
python a2x.py -f pdf doc/asciidoc.txt
なんか途中でエラーになって止まるときは、-nオプションをつ...
python a2x.py -n -f pdf doc/asciidoc.txt
ここまででasciidocのPlain Textからhtml、pdfを出力できるよ...
**Vim用プラグインのインストール [#m5a00060]
asciidoc用のVimシンタックスプラグインをインストールする。...
cd c:/bin/asciidoc/vim
cp -uR syntax c:/vim/vimfiles
cp -uR ftdetect c:/vim/vimfiles
**dblatex(とpdflatex)の日本語対応化 [#ub42e853]
日本語のDocBookからPDFを出力するためのpdflatexの環境整備...
~
jptest.txt
= タイトル =
== あいうえお ==
12345
まあテストなのでこんなもんで・・・。
で、これをPDFにしてみる。
python a2x.py -f pdf jptest.txt
するとPDFは作られるが、日本語が文字化けしてしまう。ちなみ...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5...
<?asciidoc-toc?>
<?asciidoc-numbered?>
<article lang="en">
<articleinfo>
<title>タイトル</title>
</articleinfo>
<section id="_">
<title>あいうえお</title>
<simpara>12345</simpara>
</section>
</article>
おかしい!DocBookのlang属性がデフォのままのenのままだ。こ...
python a2x.py -a lang=ja -d book -f docbook jptest.txt
jptest.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//E...
<?asciidoc-toc?>
<?asciidoc-numbered?>
<book lang="ja">
<bookinfo>
<title>タイトル</title>
</bookinfo>
<chapter id="_">
<title>あいうえお</title>
<simpara>12345</simpara>
</chapter>
</book>
で、これをdblatexにかけてpdfを作るための環境を整備する。M...
cjk, miktex-cjkutils-bin-2.8, zhmetrics
をインストールする。次にCyberbitフォントをインストールす...
C:/Users/YOURNAME/AppData/Roming/MiKTeX/2.8/fonts/truety...
XPなら(たぶん)
C:/Documents And Settings/YOURNAME/Local Settings/Applic...
として配置する。次におもむろに
mktexlsr
でフォントデータベースを更新。
それから、
C:/Python26/share/dblatex/xsl/lang.xsl
--- lang.xsl.orig Sun Aug 23 08:13:19 2009
+++ lang.xsl Sat Jan 30 03:04:43 2010
@@ -7,7 +7,7 @@
<xsl:param name="latex.encoding">latin1</xsl:param>
<xsl:param name="korean.package">CJK</xsl:param>
-<xsl:param name="cjk.font">cyberbit</xsl:param>
+<xsl:param name="cjk.font">song</xsl:param>
<xsl:param name="xetex.font">
<xsl:text>\setmainfont{DejaVu Serif} </xsl:text>
<xsl:text>\setsansfont{DejaVu Sans} </xsl:text>
cyberbitをsongにz変更する。
以上で作業完了。日本語も正しくPDFで出力できるようになる。...
#htmlinsert(adBigRect)
**コメントをどーぞ [#p4548f90]
#comment
----
[[CategoryTeX]] [[CategoryAsciiDoc]]
End:
#contents
*要件 [#a3ba2fa4]
-Windows
-日本語文書
-pdf, html両方出力可能
*インストール [#v1ee2bae]
**事前準備 [#w580a6c2]
Python2.4以上がインストールされていること。
**asciidoc のインストール [#s5df18f7]
c:\binにディレクトリを掘って配置することにする。
cd c:\bin
mkdir asciidoc
unzip asciidoc-8.5.3.zip -d asciidoc
a2x.pyの修正。PDFを作るときにdblatexはPython版のを使うの...
CONF_DIRとかを書き換えとく必要あり。
--- a2x.py.orig Thu Jan 28 22:26:32 2010
+++ a2x.py Fri Jan 29 21:32:46 2010
@@ -25,7 +25,7 @@
# AsciiDoc global configuration file directory.
# NOTE: CONF_DIR is "fixed up" by Makefile -- don't ren...
-CONF_DIR = '/etc/asciidoc'
+CONF_DIR = 'C:/bin/asciidoc'
#######################################################...
@@ -38,16 +38,16 @@
ENV = None
# External executables.
-ASCIIDOC = 'asciidoc'
+ASCIIDOC = 'C:/bin/asciidoc/asciidoc.py'
XSLTPROC = 'xsltproc'
-DBLATEX = 'dblatex' # pdf generation.
+DBLATEX = 'C:/Python26/Scripts/dblatex' # pdf g...
FOP = 'fop' # pdf generation (--fop opt...
W3M = 'w3m' # text generation.
LYNX = 'lynx' # text generation (if no w3...
-XMLLINT = 'xmllint' # Set to '' to disable.
-EPUBCHECK = 'epubcheck' # Set to '' to disable.
+XMLLINT = '' # Set to '' to disable.
+EPUBCHECK = '' # Set to '' to disable.
# External executable default options.
ASCIIDOC_OPTS = ''
DBLATEX_OPTS = ''
FOP_OPTS = ''
XSLTPROC_OPTS = ''
@@ -533,7 +533,7 @@
docbook_file = self.dst_path('.xml')
xsl = self.asciidoc_conf_file(os.path.join('dbl...
sty = self.asciidoc_conf_file(os.path.join('dbl...
- shell('"%s" -t %s -p "%s" -s "%s" %s "%s"' %
+ shell('python "%s" -t %s -p "%s" -s "%s" %s "%s...
(DBLATEX, self.format, xsl, sty, self.dbla...
def to_dvi(self):
以上でxhtmlは出力できるようになった。PDFはa2xのバッチ処理...
変換させてる。asciidocからはHTML, XHTML, DocBook形式に出...
**xsltproc, xmllintのインストール [#b93ae2d9]
xsltprocは必須だが、xmllintはxmlの構文チェックするだけみ...
**MikTeXのインストール [#b6551b67]
Windows版のTeX一式。インストーラが便利。 http://miktex.or...
必要なパッケージ
changebar, colortbl, fancybox, fancyhdr, fancyvrb, listi...
overpic, rotating, subfigure, titlesec, bibtopic, enumit...
eepic, lm, lastpage, helvetic, times, symbol, courier.
appendix, footmisc, pdfpages, stmaryrd, wasysym
eso-pic, xcolor,
追加パッケージはまだあとで日本語関連で必要になったり、忘...
かもしれないが、とりあえずここまで入れる。
ここで一度MiKTexのbinへパスが通っているか確認。通ってなけ...
**dblatexのインストール [#rccc9c7b]
MiKTeXにもdblatex.exeは入っているが、これは使わないでPyth...
http://dblatex.sourceforge.net/ この辺から最新版の0.2.12...
zipなんかで固めてるのをunzipなどして、
cd dblatex-0.2.12
python setup.py install
でインストールする・・・前に、setup.pyの325行目
-- iroot = root.split(pref + os.path.sep)[1]
++ iroot = root.split(pref + os.path.sep)[0]
直しとかないと、インストールがこける。実行は
python C:/Python26/Scripts/dblatex book.xml
てな感じになる。
もし、
warning: failed to load external entity "file:custom.xsl"
というエラーが出る場合。次のファイルを修正する。~
C:\Python26\lib\site-packages\dbtexmf\core\dbtex.py
--- dbtex.py.orig Thu Jan 28 23:27:39 2010
+++ dbtex.py Thu Jan 28 23:28:40 2010
@@ -256,7 +256,7 @@
xslset = "doclist.xsl"
f = file(xslset, "w")
f.write(self.xsl_header)
- f.write('<xsl:import href="%s"/>\n' % path_to_u...
+ f.write('<xsl:import href="%s"/>\n' % path_to_u...
f.write('<xsl:import href="%s"/>\n' % path_to_u...
f.write('</xsl:stylesheet>\n')
f.close()
**動作確認 [#vda4ba04]
ここまでで、asciidocでHTML,PDFの出力が可能になったはず。...
cd c:/bin/asciidoc
pyhon asciidoc.py doc/asciidoc.txt
これでdoc/asciidoc.htmlができる。ちなみに目次を作るときは...
python asciidoc.py -a toc -a numbered doc/asciidoc.txt
次。PDF。
python a2x.py -f pdf doc/asciidoc.txt
なんか途中でエラーになって止まるときは、-nオプションをつ...
python a2x.py -n -f pdf doc/asciidoc.txt
ここまででasciidocのPlain Textからhtml、pdfを出力できるよ...
**Vim用プラグインのインストール [#m5a00060]
asciidoc用のVimシンタックスプラグインをインストールする。...
cd c:/bin/asciidoc/vim
cp -uR syntax c:/vim/vimfiles
cp -uR ftdetect c:/vim/vimfiles
**dblatex(とpdflatex)の日本語対応化 [#ub42e853]
日本語のDocBookからPDFを出力するためのpdflatexの環境整備...
~
jptest.txt
= タイトル =
== あいうえお ==
12345
まあテストなのでこんなもんで・・・。
で、これをPDFにしてみる。
python a2x.py -f pdf jptest.txt
するとPDFは作られるが、日本語が文字化けしてしまう。ちなみ...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5...
<?asciidoc-toc?>
<?asciidoc-numbered?>
<article lang="en">
<articleinfo>
<title>タイトル</title>
</articleinfo>
<section id="_">
<title>あいうえお</title>
<simpara>12345</simpara>
</section>
</article>
おかしい!DocBookのlang属性がデフォのままのenのままだ。こ...
python a2x.py -a lang=ja -d book -f docbook jptest.txt
jptest.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//E...
<?asciidoc-toc?>
<?asciidoc-numbered?>
<book lang="ja">
<bookinfo>
<title>タイトル</title>
</bookinfo>
<chapter id="_">
<title>あいうえお</title>
<simpara>12345</simpara>
</chapter>
</book>
で、これをdblatexにかけてpdfを作るための環境を整備する。M...
cjk, miktex-cjkutils-bin-2.8, zhmetrics
をインストールする。次にCyberbitフォントをインストールす...
C:/Users/YOURNAME/AppData/Roming/MiKTeX/2.8/fonts/truety...
XPなら(たぶん)
C:/Documents And Settings/YOURNAME/Local Settings/Applic...
として配置する。次におもむろに
mktexlsr
でフォントデータベースを更新。
それから、
C:/Python26/share/dblatex/xsl/lang.xsl
--- lang.xsl.orig Sun Aug 23 08:13:19 2009
+++ lang.xsl Sat Jan 30 03:04:43 2010
@@ -7,7 +7,7 @@
<xsl:param name="latex.encoding">latin1</xsl:param>
<xsl:param name="korean.package">CJK</xsl:param>
-<xsl:param name="cjk.font">cyberbit</xsl:param>
+<xsl:param name="cjk.font">song</xsl:param>
<xsl:param name="xetex.font">
<xsl:text>\setmainfont{DejaVu Serif} </xsl:text>
<xsl:text>\setsansfont{DejaVu Sans} </xsl:text>
cyberbitをsongにz変更する。
以上で作業完了。日本語も正しくPDFで出力できるようになる。...
#htmlinsert(adBigRect)
**コメントをどーぞ [#p4548f90]
#comment
----
[[CategoryTeX]] [[CategoryAsciiDoc]]
Page:
HTML convert time: 0.002 sec.