org-modeの原稿をpukiwiki形式に変換するためのパッケージとして ox-pukiwiki があります。
非常に便利なのですが #+BEGIN_SRC と #+END_SRC で囲んだ ソースコードを出力しようとしても #+BEGIN_SRC と #+END_SRC そのものが出力されてしまいます。
#+BEGIN_EXAMPLE と #+END_EXAMPLE で囲んだ部分は整形済みテキストとして出力されます。
そこでox-pukiwiki.elのソースコードを調べたところ
(org-export-define-backend 'pukiwiki '((babel-call . org-pukiwiki-identity) (中略) (example-block . org-pukiwiki-example-block) (中略) (src-block . org-pukiwiki-identity) (中略) (verse-block . org-pukiwiki-identity)) :menu-entry '(?p "Export to Pukiwiki" ((?p "As Pukiwiki buffer" (lambda (a s v b) (org-pukiwiki-export-as-pukiwiki a s v))) (?P "As Pukiwiki file" (lambda (a s v b) (org-pukiwiki-export-to-pukiwiki a s v))) (?o "As Pukiwiki file and open" (lambda (a s v b) (if a (org-pukiwiki-export-to-pukiwiki t s v) (org-open-file (org-pukiwiki-export-to-pukiwiki nil s v))))))))
のように定義されていました。
したがって、
(src-block . org-pukiwiki-identity)
を
(src-block . org-pukiwiki-example-block)
に変更したところ、 #+BEGIN_SRC と #+END_SRC で囲んだ部分も整形済みテキストとして出力されるようになりました。
以下、設定です。
(require 'ox-pukiwiki) (org-export-define-backend 'pukiwiki '((babel-call . org-pukiwiki-identity) (bold . org-pukiwiki-bold) (center-block . org-pukiwiki-identity) (clock . org-pukiwiki-identity) (code . org-pukiwiki-code) (comment . org-pukiwiki-comment) (comment-block . (lambda (&rest args) "")) (diary-sexp . org-pukiwiki-identity) (drawer . (lambda (&rest args) "")) (dynamic-block . org-pukiwiki-identity) (entity . org-pukiwiki-identity) (example-block . org-pukiwiki-example-block) (fixed-width . org-pukiwiki-identity) (footnote-definition . org-pukiwiki-identity) (footnote-reference . org-pukiwiki-identity) (headline . org-pukiwiki-headline) (horizontal-rule . org-pukiwiki-identity) (inline-babel-call . org-pukiwiki-identity) (inline-src-block . org-pukiwiki-identity) (inlinetask . org-pukiwiki-identity) (italic . org-pukiwiki-italic) (item . org-pukiwiki-item) (keyword . org-pukiwiki-keyword) (latex-environment . org-pukiwiki-identity) (latex-fragment . org-pukiwiki-identity) (line-break . org-pukiwiki-identity) (link . org-pukiwiki-link) (node-property . org-pukiwiki-identity) (paragraph . org-pukiwiki-identity) (plain-list . org-pukiwiki-plain-list) (planning . org-pukiwiki-identity) (property-drawer . (lambda (&rest args) "")) (quote-block . org-pukiwiki-identity) (quote-section . org-pukiwiki-identity) (radio-target . org-pukiwiki-identity) (section . org-pukiwiki-identity) (special-block . org-pukiwiki-identity) (src-block . org-pukiwiki-example-block) (statistics-cookie . org-pukiwiki-identity) (strike-through . org-pukiwiki-strike-through) (subscript . org-pukiwiki-identity) (superscript . org-pukiwiki-identity) (table . org-pukiwiki-table) (table-cell . org-pukiwiki-table-cell) (table-row . org-pukiwiki-table-row) (target . org-pukiwiki-identity) (timestamp . org-pukiwiki-identity) (underline . org-pukiwiki-underline) (verbatim . org-pukiwiki-verbatim) (verse-block . org-pukiwiki-identity)) :menu-entry '(?p "Export to Pukiwiki" ((?p "As Pukiwiki buffer" (lambda (a s v b) (org-pukiwiki-export-as-pukiwiki a s v))) (?P "As Pukiwiki file" (lambda (a s v b) (org-pukiwiki-export-to-pukiwiki a s v))) (?o "As Pukiwiki file and open" (lambda (a s v b) (if a (org-pukiwiki-export-to-pukiwiki t s v) (org-open-file (org-pukiwiki-export-to-pukiwiki nil s v))))))))
コメントを残す