Dev::Coder 在電梯裡遇見雙胞胎
首頁 | 關於我 | 筆記 // 當你開始尋找,你就已經在前往的路上...

Windows

  1. 首先確認 Python 2.4+ 已經安裝

  2. SourceForge.net 下載 asciidoc-<version>.zip,並解壓縮到適當的位置(%ASCIIDOC_HOME%)。

  3. 建立一個 asciidoc.bat%PYTHONHOME%\Scripts 底下:

    @ECHO off
    python %ASCIIDOC_HOME%\asciidoc.py %*

    之後就可以直接執行 asciidoc,例如:

    C:\> asciidoc --version
    asciidoc 8.6.9

Linux

AsciiDoc 相依的套件很多,但系統內建的版本通常遠落後於官方最新版。這裡採取的策略是-先安裝系統套件(目的是安裝相依套件),再手動安裝最新版。

  1. 安裝系統套件 asciidoc

  2. SourceForge.net 下載 asciidoc-<version>.tar.gz

  3. 將壓縮檔解開到 asciidoc-<version>/ 資料夾($ASCIIDOC_HOME)。

  4. 建立一個 symbolic link 指向 $ASCIIDOC_HOME/asciidoc.py,放到 PATH 其中一個目錄。例如:

    ~/bin$ ln -s $ASCIIDOC_HOME/asciidoc.py asciidoc
  5. asciidoc --version 測試安裝。

Mac OS X

  1. 安裝 MacPorts

  2. 安裝 asciidocdblatex 兩個套件。

    $ sudo port install asciidoc
    --->  Computing dependencies for asciidoc
    --->  Dependencies to be installed: docbook-xml-4.5 xmlcatmgr fop libxml2 libiconv xz gettext expat ncurses zlib python27 bzip2 db46 db_select libedit openssl python_select sqlite3
    ...
    --->  Fetching archive for python27
    --->  Attempting to fetch python27-2.7.7_0.darwin_13.x86_64.tbz2 from http://packages.macports.org/python27
    --->  Attempting to fetch python27-2.7.7_0.darwin_13.x86_64.tbz2.rmd160 from http://packages.macports.org/python27
    --->  Installing python27 @2.7.7_0
    --->  Activating python27 @2.7.7_0
    
    To make python 2.7 the default (i.e. the version you get when you run 'python'), please run:
    
    sudo port select --set python python27
    
    --->  Cleaning python27
    ...
    --->  Installing asciidoc @8.6.9_1+python27
    --->  Activating asciidoc @8.6.9_1+python27
    --->  Cleaning asciidoc
    --->  Updating database of binaries
    --->  Scanning binaries for linking errors
    --->  No broken files found.
    
    $ sudo port install dblatex
    Password:
    --->  Computing dependencies for dblatex
    --->  Dependencies to be installed: ImageMagick autoconf m4 perl5 perl5.16 gdbm automake djvulibre jpeg tiff fftw-3 fontconfig freetype libpng ghostscript jbig2dec libidn libpaper libtool pkgconfig xorg-libXext xorg-libX11 xorg-kbproto xorg-libXau xorg-xproto xorg-libXdmcp xorg-libxcb xorg-libpthread-stubs xorg-xcb-proto xorg-xextproto xorg-libXt xorg-libsm xorg-libice lcms2 urw-fonts webp dejavu-fonts docbook-xml docbook-xml-4.1.2 docbook-xml-4.2 docbook-xml-4.3 docbook-xml-4.4 docbook-xml-5.0 docbook-xsl texlive-latex-extra texlive-bin cairo glib2 libffi libpixman xorg-xcb-util xrender xorg-renderproto graphite2 harfbuzz harfbuzz-icu icu libzzip poppler curl curl-ca-bundle gobject-introspection openjpeg15 jbigkit poppler-data t1lib texlive-common xorg-libXaw xorg-libXmu xpm xorg-libXp xorg-printproto texlive-latex-recommended pgf texlive-basic texlive-latex texlive-pictures texlive-math-extra texlive-fonts-recommended
    ...
    --->  Installing dblatex @0.3.4_0+python27
    --->  Activating dblatex @0.3.4_0+python27
    --->  Cleaning dblatex
    --->  Updating database of binaries
    --->  Scanning binaries for linking errors
    --->  No broken files found.
    
    $ which asciidoc a2x
    /opt/local/bin/asciidoc
    /opt/local/bin/a2x
    
  3. artical template 來檢查 AsciiDoc 能否正常產生 HTML 跟 PDF。

    $ cd /tmp
    $ curl -O http://www.methods.co.nz/asciidoc/article.txt
    $ asciidoc article.txt
    $ a2x -f epub article.txt
    

覺得這份文件有幫助?別忘了按個讚並分享給更多的人、留下你/您的意見...

comments powered by Disqus