#!/usr/local/bin/gosh /usr/local/bin/sxmlcnv (define SmartDoc:abbrev-table ;; A table to expand abbreviations ;; It's a fully static table (it uses the quote rather than a quasi-quote) ;; Therefore, the table (the S-expression) can be saved into a file '( (W:sxml (*link "SXML" "http://okmij.org/ftp/Scheme/SXML.html")) (W:xml (*link "XML" "http://www.w3.org/XML/")) (W:xml-infoset (*link "XML Infoset" "http://www.w3.org/TR/xml-infoset/")) (W:smartdoc (*link "SmartDoc" "http://www.asahi-net.or.jp/~dp8t-asm/java/tools/SmartDoc/")) (W:gauche (*link "Gauche" "http://www.shiro.dreamhost.com/scheme/gauche/index.html")) (W:sxml-gauche (*link "SXML-gauche" "http://www.shiro.dreamhost.com/scheme/gauche/packages.html")) (W:ssax (*link "ssax" "http://ssax.sourceforge.net/")) (W:GPL (*link "GNU General Public License (GPL2)" "http://www.gnu.org/licenses/gpl.html")) (W:slib (*link "SLIB(portable scheme library)" "http://www.swiss.ai.mit.edu/~jaffer/SLIB.html")) (W:changelog " [0.1.0] 1. Apply patches and advice from Oleg Kiselyov(Thanks!) 1) local-rules feature applied. 2) And other re-factorings. 2. Sxmlcnv includes a useful style sheet for SmartDoc. (SmartDoc:style-sheet) 3. Added feature : Supported error handling during loading source file. [0.0.4] 1. Apply patches and advice from Oleg Kiselyov(Thanks!) 1) Bug fix: Handling of SXML->XML's `port argument. 2) Bug fix: Better to use eqv? rather than eq? for comparing characters. 3) Advice : Better to define some functions which has no effect at the top level. 4) Advice : Better to use let* form rather than some (set! args ...) modifications. 5) Advice : Better to use an input parsing library to skip simple white-spaces rather than using regular expressions. [0.0.3] 1. Apply patches and advice from Oleg Kiselyov(Thanks!) 1) Patch : string->goodXML() instead of string->goodHTML() 2) Advice: He taught me the way to output a pretty-printed XML. 3) Advice: He taught me the way to output a well-formed XML. 4) Advice: He gave me pretty-printed XML sample code and some advice. 2. Added feature: -p switch ... Enable pretty-print feature. 3. Added feature: -P switch ... Enable pretty-print + indent feature. 4. Added feature: Added `port argument to SXML->XML(). [0.0.2] 1. Added feature: Reading source from stdin 2. Added feature: Handling Japanese character encoding type of the input. 3. Added feature: Adding suitable 'encoding=' attribute to XML Declaration. [0.0.1] first release version " ))) (define (L:body) '(body (center (a (@ (href "mailto:kiyoka@netfort.gr.jp")) "email: Kiyoka Nishiyama")) (*section "Sxmlcnvとは?" "What is Sxmlcnv?" (*ja (ul (li "Sxmlcnvはフリーソフトウェアです。") (li ,W:GPL "のもとで配布されています。") (li ,W:xml "と" ,W:sxml "を相互変換するソフトウェアです。"))) (*en (ul (li "Sxmlcnv is a free software.") (li "You can use and redistribute Sxmlcnv under the terms of the " ,W:GPL) (li "You can convert " ,W:xml " to/from " ,W:sxml " with Sxmlcnv."))) (*subsection "特徴" "Features" (*ja (ul (li ,W:gauche "の全ての機能を使ってプログラマブルなドキュメントを作成できます。"))) (*en (ul (li "You can create programmable documents with whole power of " ,W:gauche ".")))) (*subsection "SXMLとは?" "What is SXML?" (*ja (ul (li ,W:sxml "は" ,W:xml-infoset "の一種で、XMLの持つ情報量を損なわずに" "S式で記述できるようにしたフォーマットです。") (li "本ソフトウェアでは" ,W:ssax "というソフトウェアを使用して、XMLをパースしています。"))) (*en (ul (li ,W:sxml " is a concrete instance of the " ,W:xml-infoset ".") (li "You can describe documents in S-expressions that can keep all information of XML") (li "This software was built up with " ,W:ssax " that parses XML data format"))))) (*section "何をするためのもの?" "Purpose" (*ja (p "個人的には" ,W:smartdoc "という XMLドキュメントフォーマットをもっと書きやすく" "できないかと考えて、これを作るにいたりました。" "SXMLにすることでXMLに比べて以下のようなメリットがあると考えています。")) (*ja (ul (li "プログラマブル") (p "Schemeの強力な言語パワーを使えます") (li "文書構造を持つドキュメントの編集がやりやすい(Lisperの主観あり?)") (p "S式なので 括弧の数さえ調整すれば Emacs が 自動的にインデントしてくれます"))) (*en (p "Personally, I want to write a " ,W:smartdoc " document more easily, " "So I made this software." "I think follows are the merits to use the SXML format comparing to the XML format.")) (*en (ul (li "Programmable") (p "You can use the power of the Scheme language.") (li "Easy editing for structured documents") (p "The Emacs editor helps you with automatic indentation, because it is S-expressions."))) (*subsection "サンプル" "Samples" (*ja (p "このページは Sxmlvncを使って作成しています。" "このページがサンプルとして最適でしょう。")) (*ja (ul (li (*link "scmソース(UTF-8)" "index.scm")) (li (*link "生成したSmartDocソース(UTF-8)" "index.sdoc")))) (*en (p "I made this page using Sxmlcnv." "I think this page is the best way to show you a sample.")) (*en (ul (li (*link "scm source code(UTF-8)" "index.scm")) (li (*link "a generated SmartDoc document(UTF-8)" "index.sdoc")))))) (*section "ソースコード" "Source Code" (*ja (p (*link "sourceforgeのサマリページ" "http://sourceforge.net/projects/sxmlcnv/") "からダウンロードできます。")) (*en (p "It can be downloaded from " (*link "Summary page of development" "http://sourceforge.net/projects/sxmlcnv/") ".")) (*subsection "変更履歴" "Change Log" (program ,W:changelog)) (*subsection "クレジット" "CREDITS" (program " This is at least a partial credits of people that have contributed to the Sxmlcnv project. Formatted in a format that allows for easy grepping and beautification by scripts. The fields are: name (N), email (E), web-address (W), PGP key ID and fingerprint (P), description (D). Thanks, Kiyoka ---------- N: Kiyoka Nishiyama E: kiyoka@netfort.gr.jp D: Author of original sxmlcnv W: http://www.netfort.gr.jp/~kiyoka/ N: Oleg Kiselyov E: oleg@pobox.com D: Contributer of Patches and advice for 0.0.3, 0.0.4., 0.1.0 "))) (*section "使い方" "Usage" (*subsection "必要なソフトウェア" "You must install these software to run Sxmlcnv" (ul (li ,W:gauche " version 0.8.0 or higher") (li ,W:slib))) (*subsubsection "メモ:Cygwin上のgaucheのビルド方法(version 0.8.0)" "Memo:How to build the gauche on Cygwin platform(version 0.8.0)" (*ja (ul (li "slibのインストール") (ul (li "/usr/share/slib にインストールします。")) (li "iconvのインストール") (ul (li "Cygwinで標準でインストールされています。")) (li "configureのスイッチ") (ul (li "次の設定で utf-8,euc,sjisのコンテンツが扱えます") (li "configure --enable-multibyte=utf-8 --with-slib=/usr/share/slib --with-iconv=/usr/lib")))) (*en (ul (li "installation slib") (ul (li "Installing slib archive to /usr/share/slib directory.")) (li "installing iconv") (ul (li "iconv is installed in cygwin system by default.")) (li "specification switches for configure") (ul (li "If you specify follow line, you can handle utf-8,euc,sjis contents.") (li "configure --enable-multibyte=utf-8 --with-slib=/usr/share/slib --with-iconv=/usr/lib"))))) (*subsection "インストール" "How to install" (*ja (ul (li "sxmlcnv を パスの通ったところにコピーしてください。"))) (*en (ul (li "Please copy the 'sxmlcnv' file to path which can be searched by system for execution.")))) (*subsection "コマンドライン" "Command line" (*ja (p "入力を与えると内容を自動判別して変換します。")) (*en (p "If you specify an input for sxmlcnv script, sxmlcnv guesses the encoding from the input data automatically.")) (program "sxmlcnv version 0.x.x Usage: sxmlcnv [switches] < 'sxml-file/xml-file/scm-file' > outfile or sxmlcnv [switches] 'sxml-file/xml-file/scm-file' > outfile Switches: -h ... Display this help message. -p ... Enable pretty-print feature. -P ... Enable pretty-print + indent feature. File: Action: started with # line load and eval as scheme code started with '(' load as s-exp and convert it to XML started with 'XML関数が使える)")) (tr (td "'(' で始まっている") (td "SXMLのS式として XMLに変換する")) (tr (td "'XML function)")) (tr (td "started with '('") (td "load as S-expression and convert it to XML")) (tr (td "started with 'XML local-rules SXML &optional port)"))) (*en (ul (li "This function converts SXML argument to XML and write to stdout.(Sxmlcnv uses local-rules defined as style-sheet)") (program "(SXML->XML local-rules SXML &optional port)")))) (*subsection "ビルトインのスタイルシート" "Built-in style-sheet" (*ja (p "SxmlcnvはSmartDoc文書を簡潔に記述するためのスタイルシートを内蔵しています。")) (*en (p "Sxmlcnv includes built-in style-sheet for writing SmartDoc documents concisely.")) (*subsubsection "準備" "Preparing" (*ja (ul (li "schemeプログラムで '(SXML->XML SmartDoc:style-sheet S式)' のようにスタイルシートを指定して SXML->XML関数を呼び出してください。"))) (*en (ul (li "You must write code '(SXML->XML SmartDoc:style-sheet ssax-exp)' in your scheme program. SmartDoc:style-sheet is a built-in style-sheet.")))) (*subsubsection "SmartDocスタイルシートを使ったドキュメントの書き方" "How to write a document with SmartDoc style-sheet." (*ja (ul (li "sectionの書き方(subsection,subsubsectionも同様)") (ul (li "(*section \"日本語タイトル\" \"英語タイトル\" S式 ... S式)")))) (*en (ul (li "How to write 'section'(subsection and subsubsection is applied the same rules.)") (ul (li "(*section \"Title in Japanese\" \"Title in English\" S-exp ... S-exp)")))) (*ja (ul (li "日本語ロケール部分の書き方") (ul (li "(*ja (S式))")))) (*en (ul (li "How to write a fragment in Japanese locale") (ul (li "(*ja (S-exp))")))) (*ja (ul (li "英語ロケール部分の書き方") (ul (li "(*en (S式))")))) (*en (ul (li "How to write a fragment in English locale") (ul (li "(*en (S-exp))")))) (*ja (ul (li "ファイル内容の挿入の書き方") (ul (li "(*insert-file path)")))) (*en (ul (li "How to insert content of a file.") (ul (li "(*insert-file path)")))) (*ja (ul (li "ハイパーリンクの書き方") (ul (li "(*link keyword url)")))) (*en (ul (li "How to write hyper-link.") (ul (li "(*link keyword url)")))) (*ja (ul (li "短縮キーワードの使い方") (ul (li "事前にテーブルを定義します。") (program "(define SmartDoc:abbrev-table\n" " '( (Keyword-1 (S-exp-1))\n" " (Keyword-2 (S-exp-2))\n" " (Keyword-n (S-exp-n))))\n") (li "使う時は以下のように書きます。") (program ",Keyword-1")))) (*en (ul (li "How to use abbrev keyword") (ul (li "You must prepare the table for abbreviation.") (program "(define SmartDoc:abbrev-table\n" " '( (Keyword-1 (S-exp-1))\n" " (Keyword-2 (S-exp-2))\n" " (Keyword-n (S-exp-n))))\n") (li "You can write abbrev keyword as follows.") (program ",Keyword-1"))))))) (*section "TODO" "TODO" (*ja (ul (li "[done]ソースがどんな文字コードであっても扱えるようにする(出力するXML宣言にも正しい encodingを追加する)") (li "[done]よく使うマクロを、ビルトインライブラリとして用意する"))) (*en (ul (li "[done]Support variety of encodings of input.") (li "[done]Provide useful utility functions as built-in library."))) (native (@ (format "html")) "