Drkcore

26 09 2012 Python Sphinx Tweet

SphinxでMSWord(docx)ファイルを出力する

sphinx-quickstart でスキャフォールドを作成したら、sphinx-docxbuilderエクステンションを使えるようにするためクローンする

mkdir exts
cd exts/
hg clone https://bitbucket.org/haraisao/sphinx-docxbuilder

conf.pyの15-30行目あたりを編集

sys.path.insert(0, os.path.abspath('exts'))

# -- General configuration -----------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 
extensions = ['sphinx-docxbuilder']

Makefileにdocx用の設定を追加

docx:
    $(SPHINXBUILD) -b docx $(ALLSPHINXOPTS) $(BUILDDIR)/docx
    @echo
    @echo"Build finished. now you can process the docx file. $(BUILDDIR)/docx."

文書を作成してみる

make docx

おお!

sphinxでdocx

業務の文書をMSWordで提出しないとだめいうカルチャーの会社は多いと思うが、文書がフォルダに収められた後に、実際に再利用されるのを見たことがある人は少ないはず(探すの面倒だし)。

そういう場合にはReSTで書けるWIKIなんかを使うと常に参照できるうえに必要に応じてレポーティング出来ていいよねと思うのだが。僕はそういうスタイルでやっていたが超快適だった。

この快適さをmoin2+Sphinxで再現したい。

About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021