ulmul 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog ADDED
@@ -0,0 +1,4 @@
1
+ 2008-12-27 Takeshi Nishimatsu
2
+
3
+ * lib/ulmul.rb: documents for release.
4
+
data/README-en.xhtml ADDED
@@ -0,0 +1,294 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
3
+ "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" dir="ltr">
6
+ <head>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
+ <title>ULMUL (ulmul.rb)</title>
9
+ <meta name="author" content="takeshi" />
10
+ <meta name="copyright" content="Copyright &#169; 2009 takeshi" />
11
+ <link rel="stylesheet" href="style.css" type="text/css" />
12
+ <link rel="shortcut icon" href="favicon.ico" />
13
+ </head>
14
+ <body>
15
+ <div class="slide cover">
16
+ <h1 id="LABEL-1">ULMUL (ulmul.rb)</h1>
17
+ <p>
18
+ ULMUL (ulmul.rb) is a converter from Ultra Lightweight MarkUp Language to
19
+ (X)HTML. You can create HTML files, Slidy HTML files and MathML XHTML
20
+ files very easily.
21
+ </p>
22
+ <p>
23
+ The author is using ULMUL to generate his web pages.
24
+ <a href="http://loto.sourceforge.net/feram/">http://loto.sourceforge.net/feram/</a> is converted from
25
+ <a href="http://loto.sourceforge.net/feram/README">http://loto.sourceforge.net/feram/README</a> .
26
+ <a href="http://loto.sourceforge.net/feram/doc/film.xhtml">http://loto.sourceforge.net/feram/doc/film.xhtml</a> is converted from
27
+ <a href="http://loto.sourceforge.net/feram/doc/film.txt">http://loto.sourceforge.net/feram/doc/film.txt</a> .
28
+ </p>
29
+ <br />Contents:
30
+ <ul>
31
+ <li><a href="#LABEL-2">Where is the homepage of ULMUL?</a></li>
32
+ <li><a href="#LABEL-3">Where can I download ulmul.rb?</a></li>
33
+ <li><a href="#LABEL-4">How can I install ULMUL?</a>
34
+ <ul>
35
+ <li><a href="#LABEL-5">I. Conservative way; use setup.rb</a></li>
36
+ <li><a href="#LABEL-6">II. RubyGems users can take an easy way</a></li>
37
+ <li><a href="#LABEL-7">Files</a></li>
38
+ </ul></li>
39
+ <li><a href="#LABEL-8">How can I write a ULMUL text?</a>
40
+ <ul>
41
+ <li><a href="#LABEL-9">Events (each input line)</a></li>
42
+ <li><a href="#LABEL-17">Other rules</a></li>
43
+ <li><a href="#LABEL-18">Equations</a></li>
44
+ <li><a href="#LABEL-19">Figures</a></li>
45
+ </ul></li>
46
+ <li><a href="#LABEL-20">Usage</a>
47
+ <ul>
48
+ <li><a href="#LABEL-21">Examples</a></li>
49
+ <li><a href="#LABEL-22">Command options</a></li>
50
+ </ul></li>
51
+ <li><a href="#LABEL-29">TODO</a></li>
52
+ <li><a href="#LABEL-30">Copying</a></li>
53
+ <li><a href="#LABEL-31">Author of ULMUL</a></li>
54
+ </ul>
55
+
56
+ </div>
57
+
58
+
59
+ <div class="slide">
60
+ <h2 id="LABEL-2">Where is the homepage of ULMUL?</h2>
61
+ <p>
62
+ <a href="http://ulmul.rubyforge.org/">http://ulmul.rubyforge.org/</a>
63
+ </p>
64
+ </div>
65
+
66
+
67
+ <div class="slide">
68
+ <h2 id="LABEL-3">Where can I download ulmul.rb?</h2>
69
+ <p>
70
+ Go to <a href="http://rubyforge.org/projects/ulmul">http://rubyforge.org/projects/ulmul</a> .
71
+ </p>
72
+ </div>
73
+
74
+
75
+ <div class="slide">
76
+ <h2 id="LABEL-4">How can I install ULMUL?</h2>
77
+ <p>
78
+ There are two different ways to install ULMUL.
79
+ </p>
80
+ <h3 id="LABEL-5">I. Conservative way; use setup.rb</h3>
81
+ <p>
82
+ ulmul-X.Y.Z.tgz package can be installed as:
83
+ </p>
84
+ <pre> $ tar zxf ulmul-X.Y.Z.tgz
85
+ $ cd ulmul-X.Y.Z
86
+ $ su
87
+ # ruby setup.rb
88
+ </pre>
89
+ <p>
90
+ Note that the eimxml and mathml libraries are required.
91
+ </p>
92
+ <h3 id="LABEL-6">II. RubyGems users can take an easy way</h3>
93
+ <p>
94
+ There is an easy way, if you are a RubyGems user:
95
+ </p>
96
+ <pre> $ su
97
+ # gem install ulmul
98
+ </pre>
99
+ <p>
100
+ If you do not have the eimxml and mathml libraries, gem will download and install the
101
+ library automatically.
102
+ </p>
103
+ <h3 id="LABEL-7">Files</h3>
104
+
105
+ <ul>
106
+ <li>ulmul.rb Ruby script.</li>
107
+ <li>slidy.js JavaScript for Slidy. Slightly modified from the original.</li>
108
+ <li>ulmul-slidy.css CSS file for Slidy. Largely modified from the original.</li>
109
+ <li>style.css Example CSS file for normal web pages.</li>
110
+ </ul>
111
+ <p>
112
+ If you installed ULMUL with gem, you may find these files in
113
+ /usr/local/lib/ruby/gems/1.8/gems/ulmul-X.Y.Z/
114
+ or /usr/lib/ruby/gems/1.8/gems/ulmul-X.Y.Z/ .
115
+ </p>
116
+ </div>
117
+
118
+
119
+ <div class="slide">
120
+ <h2 id="LABEL-8">How can I write a ULMUL text?</h2>
121
+ <p>
122
+ The encode of input file must be utf-8.
123
+ </p>
124
+ <h3 id="LABEL-9">Events (each input line)</h3>
125
+ <h4 id="LABEL-10">empty</h4>
126
+ <p>
127
+ Empty lines devide paragraphs.
128
+ </p>
129
+ <h4 id="LABEL-11">heading</h4>
130
+ <p>
131
+ Starting with "= ", "== ", "=== ", "==== ", "===== ", and "====== ".
132
+ "= " will be used for the title.
133
+ </p>
134
+ <h4 id="LABEL-12">asterisk</h4>
135
+ <p>
136
+ Lines starting with
137
+ </p>
138
+ <pre>" *"
139
+ " *"
140
+ " *"
141
+ " *"
142
+ " *"
143
+ </pre>
144
+ <p>
145
+ become itemize.
146
+ </p>
147
+ <h4 id="LABEL-13">offset</h4>
148
+ <p>
149
+ Lines starting with some spaces but not asterisks become verbatim lines.
150
+ </p>
151
+ <h4 id="LABEL-14">end</h4>
152
+ <p>
153
+ EOF or "=end" end the process.
154
+ </p>
155
+ <h4 id="LABEL-15">ignore</h4>
156
+ <p>
157
+ Lines starting with"#" and "=begin" are ignored.
158
+ </p>
159
+ <h4 id="LABEL-16">normal</h4>
160
+ <p>
161
+ Other lines.
162
+ </p>
163
+ <h3 id="LABEL-17">Other rules</h3>
164
+
165
+ <ul>
166
+ <li>Lines after "=end" are ignored.</li>
167
+ <li>Add your substitution rules to @subs_rules.</li>
168
+ </ul>
169
+ <h3 id="LABEL-18">Equations</h3>
170
+ <p>
171
+ Input:
172
+ </p>
173
+ <pre>Mass $m$ can be converted into energy $E$ as
174
+ Eq. 1
175
+ E=mc^2.
176
+ /Eq.
177
+ </pre>
178
+ <p>
179
+ Output:
180
+ </p>
181
+ <p>
182
+ Mass <math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><mi>m</mi></math> can be converted into energy <math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><mi>E</mi></math> as
183
+ <math xmlns='http://www.w3.org/1998/Math/MathML' display='block'>
184
+ <mi>E</mi>
185
+ <mo>=</mo>
186
+ <mi>m</mi>
187
+ <msup>
188
+ <mi>c</mi>
189
+ <mn>2</mn>
190
+ </msup>
191
+ <mo>.</mo>
192
+ </math>
193
+ </p>
194
+ <h3 id="LABEL-19">Figures</h3>
195
+ <p>
196
+ Input:
197
+ </p>
198
+ <pre>Fig. 1 ruby.jpg
199
+ The is a dummy figure for an example.
200
+ /Fig.
201
+ </pre>
202
+ <p>
203
+ Output:
204
+ </p>
205
+ <div class="figure">
206
+ <img src="ruby.jpg" alt="ruby.jpg" />
207
+ <div class="caption">
208
+ The is a dummy figure for an example.
209
+ </div>
210
+ </div>
211
+ </div>
212
+
213
+
214
+ <div class="slide">
215
+ <h2 id="LABEL-20">Usage</h2>
216
+ <h3 id="LABEL-21">Examples</h3>
217
+ <pre>% ruby ulmul.rb foo.txt
218
+ % ruby ulmul.rb --style=style.css --name="John Smith" foo.ulmul &gt; foo.html
219
+ % ./ulmul.rb --style=ulmul-slidy.css --javascript=slidy.js \
220
+ --name="Takeshi Nishimatsu" presentation.txt &gt; presentation.xhtml
221
+ </pre>
222
+ <h3 id="LABEL-22">Command options</h3>
223
+ <h4 id="LABEL-23">-s, --style</h4>
224
+ <p>
225
+ Specify stylesheet filename.
226
+ </p>
227
+ <h4 id="LABEL-24">-n, --name</h4>
228
+ <p>
229
+ Specify your name for copyright notices.
230
+ </p>
231
+ <h4 id="LABEL-25">-j, --javascript</h4>
232
+ <p>
233
+ Specify JavaScript filename.
234
+ </p>
235
+ <h4 id="LABEL-26">-l, --language</h4>
236
+ <p>
237
+ Specify natural language. Its default is "en".
238
+ </p>
239
+ <h4 id="LABEL-27">-c, --contents-range</h4>
240
+ <p>
241
+ Range of "Contents". Its default is "2..3".
242
+ If you do not need "Contents" at the beginning of the
243
+ output HTML file, set it 3..2.
244
+ </p>
245
+ <h4 id="LABEL-28">--help</h4>
246
+ <p>
247
+ Show a help message.
248
+ </p>
249
+ </div>
250
+
251
+
252
+ <div class="slide">
253
+ <h2 id="LABEL-29">TODO</h2>
254
+
255
+ <ul>
256
+ <li>rescue syntax errors (raises) in an input file and report the
257
+ errors as #{$FILENAME}:#{file.lineno}:...</li>
258
+ <li>Unit test, tests/ulmul_test.rb</li>
259
+ <li>@body must be XML object, not a String.</li>
260
+ <li>Tables.</li>
261
+ <li>References to figures and tables.</li>
262
+ <li>Citation.</li>
263
+ </ul>
264
+ </div>
265
+
266
+
267
+ <div class="slide">
268
+ <h2 id="LABEL-30">Copying</h2>
269
+ <p>
270
+ ulmul.rb is distributed in the hope that
271
+ it will be useful, but WITHOUT ANY WARRANTY.
272
+ You can copy, modify and redistribute ulmul.rb,
273
+ but only under the conditions described in
274
+ the GNU General Public License (the "GPL").
275
+ </p>
276
+ <p>
277
+ W3C has copyrights for slidy.js and ulmul-slidy.css (originally
278
+ named slidy.css). Takeshi Nishimatsu modified them.
279
+ You can download the original package, slidy.zip, from
280
+ <a href="http://www.w3.org/Talks/Tools/Slidy/">http://www.w3.org/Talks/Tools/Slidy/</a> . You can find
281
+ their licenses at <a href="http://www.w3.org/Consortium/Legal/copyright-documents">http://www.w3.org/Consortium/Legal/copyright-documents</a>
282
+ and <a href="http://www.w3.org/Consortium/Legal/copyright-software">http://www.w3.org/Consortium/Legal/copyright-software</a> .
283
+ </p>
284
+ </div>
285
+
286
+
287
+ <div class="slide">
288
+ <h2 id="LABEL-31">Author of ULMUL</h2>
289
+ <p>
290
+ Takeshi Nishimatsu (t_nissie{at}yahoo.co.jp)
291
+ </p>
292
+ </div>
293
+ </body>
294
+ </html>
data/README-ja ADDED
@@ -0,0 +1,162 @@
1
+ # README-ja for ULMUL -*-rd-*-
2
+ = ULMUL (ulmul.rb) 取扱説明書
3
+ ULMUL (ulmul.rb) は独自の軽量マークアップ言語 (Ultra Lightweight MarkUp Language) を
4
+ (X)HTMLファイルへ変換します。文章中のTeXスタイルで書かれた数式をMathMLに変換できるのが特徴です。
5
+ また、ウェブ・ブラウザ+CSS+XHTML+JavaScriptを使ったプレゼン環境
6
+ HTML Slidy http://www.w3.org/Talks/Tools/Slidy/ に対応したhtmlかxhtmlも出力可能です。
7
+ sourceforge.jpのWikiシンタックス http://sourceforge.jp/projects/sourceforge/wiki/Guide%2FWikiSyntax
8
+ と同様なことができるようになることをめざして開発しています。
9
+
10
+ http://ulmul.rubyforge.org/ がホームページです。
11
+ http://rubyforge.org/projects/ulmul/ から関連するファイルをダウンロードすることができます。
12
+
13
+ 作者は作者のwebページと学会発表用のスライドを作るのにULMULを使っています。
14
+ http://loto.sourceforge.net/feram/ のソースは
15
+ http://loto.sourceforge.net/feram/README です。
16
+ http://loto.sourceforge.net/feram/doc/film.xhtml というスライドは
17
+ http://loto.sourceforge.net/feram/doc/film.txt から生成されました。
18
+
19
+
20
+ == 特徴
21
+ * 文章中の2つのドル記号($)で挟まれた部分とEq.…/Eq.で挟まれた行が数式としてTeX形式からMathML形式に変換されます。
22
+ MathMLとはXMLで数式を記述するための規格です。込み入った規格なので人間が直接MathMLを記述する
23
+ ことは想定されていませんが、ULMULでやっているようにTeXなどからの変換により生成することができます。
24
+ Firefoxのバージョン3.0以上で読めるようです。
25
+ math_ml.rb http://www.hinet.mydns.jp/?mathml.rb を使っています。
26
+ * ウェブ・ブラウザ+CSS+XHTML+JavaScriptを使ったプレゼン環境
27
+ Slidy http://www.w3.org/Talks/Tools/Slidy/ に対応したhtmlかxhtmlも出力可能です。
28
+ ただし、PowerPointより優れたプレゼンができるかというと、そうとも限りません。
29
+ * =begin, =end はあってもなくてもかまいません。
30
+ * 行を#ではじめるとコメントになります。
31
+ * ライブラリとしても使えます。
32
+ * subs_rulesに俺ルールを加えることができます。
33
+ * 目次 (Contents) を自動的に生成できます。
34
+ * はじめの「= ABCD EFGH」がタイトルになります。Slidyの表紙にもなります。
35
+ * テキストファイルはutf-8で書きます。自然言語は--language=jaなどとオプションで指定できます。
36
+ などが特徴です。
37
+
38
+ == インストール方法
39
+ 2通りのインストール方法があります。
40
+ === I. setup.rbを使う方法
41
+ パッケージ ulmul-X.Y.Z.tgz を次のようにインストールします:
42
+ $ tar zxf ulmul-X.Y.Z.tgz
43
+ $ cd ulmul-X.Y.Z
44
+ $ su
45
+ # ruby setup.rb
46
+ なお、ULMULを使うにはeimxmlライブラリとmathmlライブラリとが必要です。
47
+ === II. RubyGemsを使えば簡単にインストールができます
48
+ gemでインストールすればeimxmlライブラリとmathmlライブラリとは自動的にインストールされます:
49
+ $ su
50
+ # gem install ulmul
51
+
52
+ == 必要なファイル
53
+ * ulmul.rb Rubyスクリプト。
54
+ * slidy.js Slidy用JavaScript。オリジナルをちょっとだけ改変。
55
+ * ulmul-slidy.css Slidy用CSSファイル。オリジナルを大幅に改変。
56
+ * style.css 普通のウェブページ用CSSファイル。
57
+ もしあなたがULMULをgemでインストールしたなら、上記のファイル
58
+ は /usr/local/lib/ruby/gems/1.8/gems/ulmul-X.Y.Z/
59
+ もしくは /usr/lib/ruby/gems/1.8/gems/ulmul-X.Y.Z/
60
+ 以下にあるかもしれません。
61
+
62
+ == ULMULテキストの書き方
63
+ ULMULテキストのエンコーディングにはutf-8を使ってください。
64
+ === 各行の種類
65
+ ==== 空行 (empty)
66
+ 空行は段落を分割します。
67
+ ==== ヘディング (heading)
68
+ "= ", "== ", "=== ", "==== ", "===== ", または "====== " で始めてください。
69
+ 「= ABCD EFGH」ならABCD EFGHがタイトルになります。Slidyの表紙にもなります。
70
+ ==== アスタリスクで始まる行は箇条書きになります (asterisk)
71
+ 6段までネストした箇条書きが可能です:
72
+ " *"
73
+ " *"
74
+ " *"
75
+ " *"
76
+ " *"
77
+ ==== オフセットされて書かれた行はそのまま出力 (verbatim, pre) されます (offset)
78
+ 1つスペースを置いて書き始めた行はverbatimになります。
79
+ ==== 終わり (end)
80
+ EOF と "=end" が出てくると処理が終了します。
81
+ ==== 無視される行 (ignore)
82
+ Lines starting with"#" and "=begin" are ignored.
83
+ ==== その他の入力行 (normal)
84
+ 地の文になります。
85
+ === その他のルール
86
+ * "=end"より後の行はすべて無視されます。
87
+ * あなたのオリジナル・ルールを @subs_rules に加えることができます。
88
+ === 数式の書き方
89
+ 文章中の2つのドル記号($)で挟まれた部分がTeX形式からMathML形式に変換されます。
90
+ また、Eq.…/Eq.で挟まれた行も次の例のように処理されます
91
+
92
+ 入力:
93
+ Mass $m$ can be converted into energy $E$ as
94
+ Eq. 1
95
+ E=mc^2.
96
+ /Eq.
97
+
98
+ 出力:
99
+
100
+ Mass $m$ can be converted into energy $E$ as
101
+ Eq. 1
102
+ E=mc^2.
103
+ /Eq.
104
+
105
+ === 図の挿入方法
106
+ 入力:
107
+ Fig. 1 ruby.jpg
108
+ The is a dummy figure for an example.
109
+ /Fig.
110
+
111
+ 出力:
112
+ Fig. 1 ruby.jpg
113
+ The is a dummy figure for an example.
114
+ /Fig.
115
+
116
+ == 使用方法
117
+ === 例
118
+ $ ruby ulmul.rb foo.txt
119
+ $ ruby ulmul.rb --style=style.css --name="John Smith" foo.ulmul > foo.html
120
+ $ ./ulmul.rb --style=ulmul-slidy.css --javascript=slidy.js \
121
+ --name="Takeshi Nishimatsu" presentation.txt > presentation.xhtml
122
+ === コマンド・ライン・オプション
123
+ ==== -s, --style
124
+ スタイルシートのファイル名を指定します。--style=style.css などがよいでしょう。
125
+ ==== -n, --name
126
+ あなたの名前を指定します。著作権表示に使われます。
127
+ ==== -j, --javascript
128
+ JavaScriptのファイル名を指定します。
129
+ ==== -l, --language
130
+ 自然言語の種類を指定します。既定値は"en"です。日本語の場合は-l jaとします。
131
+ ==== -c, --contents-range
132
+ 目次の深さを指定します。既定値は"2..3"です。
133
+ 目次が必要なければ-c 3..2とします。
134
+ ==== --help
135
+ ヘルプ情報が表示されます。
136
+
137
+ == ulmul.rbの仕組み
138
+ 入力の各行をイベントとして状態遷移しています。
139
+ class Ulmulの中の定数TABLEが状態遷移表です。
140
+ これが正しい実装方法なのかよくわかりません。
141
+ たぶんオートマトンとかを勉強した方がよいのだと思います。
142
+
143
+ == 著作権表示
144
+ ulmul.rb is distributed in the hope that
145
+ it will be useful, but WITHOUT ANY WARRANTY.
146
+ You can copy, modify and redistribute ulmul.rb,
147
+ but only under the conditions described in
148
+ the GNU General Public License (the "GPL").
149
+
150
+ W3C has copyrights for slidy.js and ulmul-slidy.css (originally
151
+ named slidy.css). Takeshi Nishimatsu modified them.
152
+ You can download the original package, slidy.zip, from
153
+ http://www.w3.org/Talks/Tools/Slidy/ . You can find
154
+ their licenses at http://www.w3.org/Consortium/Legal/copyright-documents
155
+ and http://www.w3.org/Consortium/Legal/copyright-software .
156
+
157
+ == 作者
158
+ 西松タケシ (t_nissie{at}yahoo.co.jp)
159
+
160
+ # Local variables:
161
+ # compile-command: "rake README-ja.xhtml"
162
+ # End: