ulmul 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ChangeLog +9 -0
- data/Changes +5 -0
- data/README-en +3 -10
- data/README-ja +5 -10
- data/Rakefile +10 -20
- data/index.en.html +11 -19
- data/index.ja.html +13 -19
- data/lib/ulmul.rb +54 -45
- data/ulmul.gemspec +18 -19
- metadata +82 -122
- data/google-code-prettify/CHANGES.html +0 -130
- data/google-code-prettify/COPYING +0 -202
- data/google-code-prettify/README-zh-Hans.html +0 -143
- data/google-code-prettify/README.html +0 -203
- data/google-code-prettify/src/lang-apollo.js +0 -51
- data/google-code-prettify/src/lang-css.js +0 -78
- data/google-code-prettify/src/lang-fortran.js +0 -53
- data/google-code-prettify/src/lang-hs.js +0 -101
- data/google-code-prettify/src/lang-lisp.js +0 -93
- data/google-code-prettify/src/lang-lua.js +0 -59
- data/google-code-prettify/src/lang-ml.js +0 -56
- data/google-code-prettify/src/lang-proto.js +0 -35
- data/google-code-prettify/src/lang-scala.js +0 -54
- data/google-code-prettify/src/lang-sql.js +0 -57
- data/google-code-prettify/src/lang-vb.js +0 -61
- data/google-code-prettify/src/lang-vhdl.js +0 -34
- data/google-code-prettify/src/lang-wiki.js +0 -53
- data/google-code-prettify/src/lang-yaml.js +0 -27
- data/google-code-prettify/src/prettify.css +0 -44
- data/google-code-prettify/src/prettify.js +0 -1508
- data/google-code-prettify/tests/large_input_test.html +0 -122
- data/google-code-prettify/tests/prettify_test.html +0 -2772
- data/google-code-prettify/tests/test_base.js +0 -132
- data/google-code-prettify/tests/test_styles.css +0 -5
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5afa2a8e4a0a259e3b1cc96b5da718b8af01da80
|
4
|
+
data.tar.gz: 17740ba30c27663c64aae6b3f44d402fa6e1f182
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8066ef2229131684b5fc154ac6cd759c598925a1a135c7601cda8bb62016bdfb0c2327034ede1786e5016f0bb0de9deea77cb694f79152322ba03e5a2da1adc2
|
7
|
+
data.tar.gz: 45c18ba87c3beaba64ce8b85487946161dfc58c522ba8d1adcd49170cde1d558b3e8204170d93deae95e5cc0b2e456b10530dd9fc3de905414b51c6555ec74c0
|
data/ChangeLog
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
2013-12-31 16:17 Takeshi Nishimatsu <t_nissie@yahoo.co.jp>
|
2
|
+
|
3
|
+
* lib/ulmul.rb: aasm_initial_state -> aasm.initial_state,
|
4
|
+
aasm_state -> aasm.state, aasm_event -> aasm.event
|
5
|
+
|
6
|
+
2011-04-10 14:56 Takeshi Nishimatsu <t_nissie@yahoo.co.jp>
|
7
|
+
|
8
|
+
* lib/ulmul.rb (HTML#body, LaTeX#body): refs
|
9
|
+
|
1
10
|
2011-04-09 14:50 Takeshi Nishimatsu <t_nissie@yahoo.co.jp>
|
2
11
|
|
3
12
|
* README-en, README-ja: Usage of ulmul2mathjax
|
data/Changes
CHANGED
@@ -1,4 +1,9 @@
|
|
1
1
|
= Changes in each version
|
2
|
+
== 0.5.2
|
3
|
+
* Now, in Japanese, spaces are NOT required before and after "Env:foo".
|
4
|
+
* Preparation for aasm-4.0.0
|
5
|
+
* Use -j https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js
|
6
|
+
|
2
7
|
== 0.5.1
|
3
8
|
* ulmul2mathjax, a new command, converts ulmul texts into MathJax documents.
|
4
9
|
* Way to give @subs_rules is changed.
|
data/README-en
CHANGED
@@ -137,10 +137,8 @@ Start a Code environment with "\Code:baz FILENAME"
|
|
137
137
|
and terminate it with "/Code:baz", where "baz" is a tag for the code.
|
138
138
|
You can write a figure caption between them.
|
139
139
|
You can refer the figure with "Code:baz" as Code:hello.
|
140
|
-
Code will be highlighted with
|
141
|
-
google-code-prettify
|
142
|
-
when options of -s google-code-prettify/src/prettify.css and
|
143
|
-
-j google-code-prettify/src/prettify.js are given.
|
140
|
+
Code will be highlighted with google-code-prettify when
|
141
|
+
-j https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js is given.
|
144
142
|
|
145
143
|
Input:
|
146
144
|
\Code:hello hello.c
|
@@ -189,7 +187,7 @@ ulmul2xhtml will be removed from next version 0.6.x.
|
|
189
187
|
== Usage of ulmul2mathjax
|
190
188
|
It uses MathJax http://www.mathjax.org/ to show equations.
|
191
189
|
$ ulmul2mathjax --help
|
192
|
-
$ ulmul2mathjax -s ulmul2html5.css -
|
190
|
+
$ ulmul2mathjax -s ulmul2html5.css -j https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js \
|
193
191
|
-j 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default' README-en > README-en-mathjax.html
|
194
192
|
|
195
193
|
== Usage of ulmul2latex
|
@@ -229,11 +227,6 @@ http://www.w3.org/Talks/Tools/Slidy/ . You can find
|
|
229
227
|
their licenses at http://www.w3.org/Consortium/Legal/copyright-documents
|
230
228
|
and http://www.w3.org/Consortium/Legal/copyright-software .
|
231
229
|
|
232
|
-
Google Inc. has copyrights for files under google-code-prettify
|
233
|
-
directory. Package prettify-21-Jul-2010.zip is distributed
|
234
|
-
from http://code.google.com/p/google-code-prettify/ under the
|
235
|
-
Apache License, Version 2.0.
|
236
|
-
|
237
230
|
== Author of ULMUL
|
238
231
|
Takeshi Nishimatsu (t_nissie{at}yahoo.co.jp) http://t-nissie.users.sourceforge.net/
|
239
232
|
|
data/README-ja
CHANGED
@@ -79,7 +79,7 @@ EOF と "=end" が出てくると処理が終了します。
|
|
79
79
|
|
80
80
|
=== 数式の書き方
|
81
81
|
文章中の2つのドル記号($)で挟まれた部分がTeX形式からMathML形式に変換されます。
|
82
|
-
|
82
|
+
また、"\Eq:foo"と"/Eq:foo"とで挟まれた行も次の例のように処理されます。
|
83
83
|
|
84
84
|
入力:
|
85
85
|
Mass $m$ can be converted into energy $E$ as
|
@@ -94,7 +94,7 @@ Mass $m$ can be converted into energy $E$ as
|
|
94
94
|
E=mc^2.
|
95
95
|
/Eq:Emc2
|
96
96
|
|
97
|
-
数式は"Eq:Einstein"のように参照します。こんなかんじ
|
97
|
+
数式は"Eq:Einstein"のように参照します。こんなかんじEq:Emc2。
|
98
98
|
|
99
99
|
数式を正しくご覧いただくには
|
100
100
|
* Firefox 4 http://mozilla.jp/firefox/
|
@@ -105,7 +105,7 @@ Mass $m$ can be converted into energy $E$ as
|
|
105
105
|
「図環境」は "\Fig:foo FILENAME.jpg" で始めて "/Fig:foo" で閉じてください。
|
106
106
|
間に図のキャプションを書くことができます。
|
107
107
|
ここで "foo" は図のタグです。
|
108
|
-
"Fig:foo"で図を参照することができます。こんな具合です
|
108
|
+
"Fig:foo"で図を参照することができます。こんな具合ですFig:ruby。
|
109
109
|
|
110
110
|
入力:
|
111
111
|
\Fig:ruby ruby.jpg
|
@@ -128,7 +128,7 @@ Table環境はまだインプリメントされていません。
|
|
128
128
|
「コード環境」は "\Code:baz FILENAME" で始めて "/Code:baz" で閉じてください。
|
129
129
|
間にキャプションを書くことができます。
|
130
130
|
ここで "baz" は図のタグです。
|
131
|
-
"Code:baz"で当該コードを参照することができます。こんな具合です
|
131
|
+
"Code:baz"で当該コードを参照することができます。こんな具合ですCode:hello。
|
132
132
|
|
133
133
|
入力:
|
134
134
|
\Code:hello hello.c
|
@@ -176,7 +176,7 @@ JavaScriptのファイル名を指定します。
|
|
176
176
|
== ulmul2mathjaxの使用方法
|
177
177
|
数式を MathJax http://www.mathjax.org/ で出力します。
|
178
178
|
$ ulmul2mathjax --help
|
179
|
-
$ ulmul2mathjax -s ulmul2html5.css -
|
179
|
+
$ ulmul2mathjax -s ulmul2html5.css -j https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js \
|
180
180
|
-j 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default' README-en > README-en-mathjax.html
|
181
181
|
|
182
182
|
== ulmul2latexの使用方法
|
@@ -210,11 +210,6 @@ http://www.w3.org/Talks/Tools/Slidy/ . You can find
|
|
210
210
|
their licenses at http://www.w3.org/Consortium/Legal/copyright-documents
|
211
211
|
and http://www.w3.org/Consortium/Legal/copyright-software .
|
212
212
|
|
213
|
-
Google Inc. has copyrights for files under google-code-prettify
|
214
|
-
directory. Package prettify-21-Jul-2010.zip is distributed
|
215
|
-
from http://code.google.com/p/google-code-prettify/ under the
|
216
|
-
Apache License, Version 2.0.
|
217
|
-
|
218
213
|
== 作者
|
219
214
|
西松タケシ (t_nissie{at}yahoo.co.jp) http://t-nissie.users.sourceforge.net/
|
220
215
|
|
data/Rakefile
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
#! /usr/bin/env rake
|
2
2
|
# -*-Ruby-*-
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <2014-01-01 16:37:55 takeshi>
|
4
4
|
# Author: Takeshi Nishimatsu
|
5
5
|
##
|
6
6
|
$LOAD_PATH.unshift('lib')
|
7
7
|
|
8
8
|
require 'rubygems'
|
9
|
-
require '
|
9
|
+
require 'rubygems/package_task'
|
10
10
|
require 'rake/testtask'
|
11
11
|
require 'rake/clean'
|
12
12
|
require 'ulmul.rb'
|
13
|
-
require 'archive/tar/minitar'
|
14
13
|
require 'zlib'
|
15
14
|
|
16
15
|
spec = eval(File.read("ulmul.gemspec"))
|
@@ -22,7 +21,7 @@ ULMUL_PACKAGE_DIR = '..'
|
|
22
21
|
|
23
22
|
desc "Build a gem for ulmul"
|
24
23
|
task :gem => [ :test ]
|
25
|
-
|
24
|
+
Gem::PackageTask.new(spec) do |g|
|
26
25
|
g.need_tar = true
|
27
26
|
g.need_zip = true
|
28
27
|
g.package_dir = ULMUL_PACKAGE_DIR
|
@@ -61,27 +60,18 @@ task :rubyforge => ["index.en.html",
|
|
61
60
|
end
|
62
61
|
|
63
62
|
desc "Create presentation.en.html from README-en"
|
64
|
-
file "presentation.en.html" => ["bin/ulmul2html5", "README-en", "ulmul-slidy.css", "
|
65
|
-
"google-code-prettify/src/prettify.js", "ulmul-slidy.js", "lib/ulmul.rb"] do |t|
|
63
|
+
file "presentation.en.html" => ["bin/ulmul2html5", "README-en", "ulmul-slidy.css", "ulmul-slidy.js", "lib/ulmul.rb"] do |t|
|
66
64
|
sh "ruby -I lib #{t.prerequisites[0]} -n 'Takeshi Nishimatsu' -s #{t.prerequisites[2]} -s #{t.prerequisites[3]} \
|
67
65
|
-j #{t.prerequisites[4]} -j #{t.prerequisites[5]} -m 2 -l en #{t.prerequisites[1]} > #{t.name}"
|
68
66
|
end
|
69
67
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
-j #{t.prerequisites[4]} -l en #{t.prerequisites[1]} | \
|
68
|
+
["en", "ja"].each{|lang|
|
69
|
+
desc "Create index.#{lang}.html"
|
70
|
+
file "index.#{lang}.html" => ["bin/ulmul2html5", "README-#{lang}", "ulmul2html5.css", "lib/ulmul.rb"] do |t|
|
71
|
+
sh "ruby -I lib #{t.prerequisites[0]} -n 'Takeshi Nishimatsu' -s #{t.prerequisites[2]} -j https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js -l #{lang} #{t.prerequisites[1]} | \
|
75
72
|
sed -e 's%</h1>%</h1><div class=\"navi\">[<a href=\"index.en.html\">English</a>/<a href=\"index.ja.html\">Japanese</a>]</div>%' > #{t.name}"
|
76
|
-
end
|
77
|
-
|
78
|
-
desc "Create index.ja.html"
|
79
|
-
file "index.ja.html" => ["bin/ulmul2html5", "README-ja", "ulmul2html5.css", "google-code-prettify/src/prettify.css",
|
80
|
-
"google-code-prettify/src/prettify.js", "lib/ulmul.rb"] do |t|
|
81
|
-
sh "ruby -I lib #{t.prerequisites[0]} -n 'Takeshi Nishimatsu' -s #{t.prerequisites[2]} -s #{t.prerequisites[3]} \
|
82
|
-
-j #{t.prerequisites[4]} -l ja #{t.prerequisites[1]} | \
|
83
|
-
sed -e 's%</h1>%</h1><div class=\"navi\">[<a href=\"index.en.html\">English</a>/<a href=\"index.ja.html\">Japanese</a>]</div>%' > #{t.name}"
|
84
|
-
end
|
73
|
+
end
|
74
|
+
}
|
85
75
|
|
86
76
|
desc "Create README-en.tex"
|
87
77
|
file "README-en.tex" => ["bin/ulmul2latex", "README-en", "lib/ulmul.rb", "Rakefile"] do |t|
|
data/index.en.html
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
5
5
|
<title>ULMUL (Ultra Lightweight MarkUp Language)</title>
|
6
6
|
<meta name="author" content="Takeshi Nishimatsu" />
|
7
|
-
<meta name="copyright" content="Copyright © 2011 Takeshi Nishimatsu" />
|
8
7
|
<script type="text/x-mathjax-config">
|
9
8
|
MathJax.Hub.Config({
|
10
9
|
tex2jax: {
|
@@ -13,8 +12,7 @@
|
|
13
12
|
});
|
14
13
|
</script>
|
15
14
|
<link rel="stylesheet" href="ulmul2html5.css" type="text/css" />
|
16
|
-
<
|
17
|
-
<script src="google-code-prettify/src/prettify.js" type="text/javascript"></script>
|
15
|
+
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js" type="text/javascript"></script>
|
18
16
|
<link rel="shortcut icon" href="favicon.ico" />
|
19
17
|
</head>
|
20
18
|
<body onload="prettyPrint()">
|
@@ -198,7 +196,7 @@ Output:
|
|
198
196
|
</p>
|
199
197
|
<p>
|
200
198
|
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
|
201
|
-
<math id="Eq:Emc2" xmlns='http://www.w3.org/1998/Math/MathML' display='block'><mi>E</mi><mo>=</mo><mi>m</mi><msup><mi>c</mi><mn>2</mn></msup><mo>.</mo></math>
|
199
|
+
<math id="Eq:Emc2" xmlns='http://www.w3.org/1998/Math/MathML' display='block'><mi>E</mi><mo stretchy='false'>=</mo><mi>m</mi><msup><mi>c</mi><mn>2</mn></msup><mo stretchy='false'>.</mo></math>
|
202
200
|
</p>
|
203
201
|
<p>
|
204
202
|
You can refer the equation in a way like "Eq:Einstein", as <a href="#Eq:Emc2">Eq. (1)</a>.
|
@@ -237,7 +235,7 @@ Output:
|
|
237
235
|
<figcaption>
|
238
236
|
Figure 1: The is a dummy figure for an example.
|
239
237
|
Cute red logo of Ruby, isn't it?
|
240
|
-
You can write equations even in a caption as <math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><mi>a</mi><msup><mi>x</mi><mn>2</mn></msup><mo>+</mo><mi>b</mi><mi>x</mi><mo>+</mo><mi>c</mi><mo>=</mo><mn>0</mn></math>.
|
238
|
+
You can write equations even in a caption as <math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><mi>a</mi><msup><mi>x</mi><mn>2</mn></msup><mo stretchy='false'>+</mo><mi>b</mi><mi>x</mi><mo stretchy='false'>+</mo><mi>c</mi><mo stretchy='false'>=</mo><mn>0</mn></math>.
|
241
239
|
</figcaption>
|
242
240
|
</figure>
|
243
241
|
<h3 id="LABEL-16">Tables</h3>
|
@@ -272,10 +270,8 @@ Start a Code environment with "\Code:baz FILENAME"
|
|
272
270
|
and terminate it with "/Code:baz", where "baz" is a tag for the code.
|
273
271
|
You can write a figure caption between them.
|
274
272
|
You can refer the figure with "Code:baz" as <a href="#Code:hello">Code 1</a>.
|
275
|
-
Code will be highlighted with
|
276
|
-
|
277
|
-
when options of -s google-code-prettify/src/prettify.css and
|
278
|
-
-j google-code-prettify/src/prettify.js are given.
|
273
|
+
Code will be highlighted with google-code-prettify when
|
274
|
+
-j <a href="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js">https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js</a> is given.
|
279
275
|
</p>
|
280
276
|
<p>
|
281
277
|
Input:
|
@@ -309,8 +305,8 @@ int main()
|
|
309
305
|
<h2 id="LABEL-18">Usage of ulmul2html5</h2>
|
310
306
|
<h3 id="LABEL-19">Examples</h3>
|
311
307
|
<pre>
|
312
|
-
$ ulmul2html5 foo.txt
|
313
|
-
$ ulmul2html5 -n 'Takeshi Nishimatsu' -s ulmul-slidy.css -j ulmul-slidy.js presentation.txt
|
308
|
+
$ ulmul2html5 foo.txt > foo.html
|
309
|
+
$ ulmul2html5 -n 'Takeshi Nishimatsu' -s ulmul-slidy.css -j ulmul-slidy.js presentation.txt > presentation.html
|
314
310
|
</pre>
|
315
311
|
<h3 id="LABEL-20">Command options</h3>
|
316
312
|
<h4 id="LABEL-21">--help</h4>
|
@@ -369,8 +365,8 @@ It uses MathJax <a href="http://www.mathjax.org/">http://www.mathjax.org/</a> to
|
|
369
365
|
</p>
|
370
366
|
<pre>
|
371
367
|
$ ulmul2mathjax --help
|
372
|
-
$ ulmul2mathjax -s ulmul2html5.css -
|
373
|
-
-j 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default' README-en
|
368
|
+
$ ulmul2mathjax -s ulmul2html5.css -j https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js \
|
369
|
+
-j 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default' README-en > README-en-mathjax.html
|
374
370
|
</pre>
|
375
371
|
</div>
|
376
372
|
|
@@ -438,12 +434,6 @@ You can download the original package, slidy.zip, from
|
|
438
434
|
their licenses at <a href="http://www.w3.org/Consortium/Legal/copyright-documents">http://www.w3.org/Consortium/Legal/copyright-documents</a>
|
439
435
|
and <a href="http://www.w3.org/Consortium/Legal/copyright-software">http://www.w3.org/Consortium/Legal/copyright-software</a> .
|
440
436
|
</p>
|
441
|
-
<p>
|
442
|
-
Google Inc. has copyrights for files under google-code-prettify
|
443
|
-
directory. Package prettify-21-Jul-2010.zip is distributed
|
444
|
-
from <a href="http://code.google.com/p/google-code-prettify/">http://code.google.com/p/google-code-prettify/</a> under the
|
445
|
-
Apache License, Version 2.0.
|
446
|
-
</p>
|
447
437
|
</div>
|
448
438
|
|
449
439
|
|
@@ -453,5 +443,7 @@ Apache License, Version 2.0.
|
|
453
443
|
Takeshi Nishimatsu (t_nissie{at}yahoo.co.jp) <a href="http://t-nissie.users.sourceforge.net/">http://t-nissie.users.sourceforge.net/</a>
|
454
444
|
</p>
|
455
445
|
</div>
|
446
|
+
<hr />
|
447
|
+
<address>Copyright © 2014 Takeshi Nishimatsu</address>
|
456
448
|
</body>
|
457
449
|
</html>
|
data/index.ja.html
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
5
5
|
<title>ULMUL取扱説明書</title>
|
6
6
|
<meta name="author" content="Takeshi Nishimatsu" />
|
7
|
-
<meta name="copyright" content="Copyright © 2011 Takeshi Nishimatsu" />
|
8
7
|
<script type="text/x-mathjax-config">
|
9
8
|
MathJax.Hub.Config({
|
10
9
|
tex2jax: {
|
@@ -13,8 +12,7 @@
|
|
13
12
|
});
|
14
13
|
</script>
|
15
14
|
<link rel="stylesheet" href="ulmul2html5.css" type="text/css" />
|
16
|
-
<
|
17
|
-
<script src="google-code-prettify/src/prettify.js" type="text/javascript"></script>
|
15
|
+
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js" type="text/javascript"></script>
|
18
16
|
<link rel="shortcut icon" href="favicon.ico" />
|
19
17
|
</head>
|
20
18
|
<body onload="prettyPrint()">
|
@@ -186,7 +184,7 @@ EOF と "=end" が出てくると処理が終了します。
|
|
186
184
|
<h3 id="LABEL-14">数式の書き方</h3>
|
187
185
|
<p>
|
188
186
|
文章中の2つのドル記号($)で挟まれた部分がTeX形式からMathML形式に変換されます。
|
189
|
-
|
187
|
+
また、"\Eq:foo"と"/Eq:foo"とで挟まれた行も次の例のように処理されます。
|
190
188
|
</p>
|
191
189
|
<p>
|
192
190
|
入力:
|
@@ -202,10 +200,10 @@ Mass $m$ can be converted into energy $E$ as
|
|
202
200
|
</p>
|
203
201
|
<p>
|
204
202
|
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
|
205
|
-
<math id="Eq:Emc2" xmlns='http://www.w3.org/1998/Math/MathML' display='block'><mi>E</mi><mo>=</mo><mi>m</mi><msup><mi>c</mi><mn>2</mn></msup><mo>.</mo></math>
|
203
|
+
<math id="Eq:Emc2" xmlns='http://www.w3.org/1998/Math/MathML' display='block'><mi>E</mi><mo stretchy='false'>=</mo><mi>m</mi><msup><mi>c</mi><mn>2</mn></msup><mo stretchy='false'>.</mo></math>
|
206
204
|
</p>
|
207
205
|
<p>
|
208
|
-
数式は"Eq:Einstein"
|
206
|
+
数式は"Eq:Einstein"のように参照します。こんなかんじ<a href="#Eq:Emc2">Eq. (1)</a>。
|
209
207
|
</p>
|
210
208
|
<p>
|
211
209
|
数式を正しくご覧いただくには
|
@@ -223,7 +221,7 @@ Mass <math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><mi>m</mi
|
|
223
221
|
「図環境」は "\Fig:foo FILENAME.jpg" で始めて "/Fig:foo" で閉じてください。
|
224
222
|
間に図のキャプションを書くことができます。
|
225
223
|
ここで "foo" は図のタグです。
|
226
|
-
"Fig:foo"
|
224
|
+
"Fig:foo"で図を参照することができます。こんな具合です<a href="#Fig:ruby">Fig. 1</a>。
|
227
225
|
</p>
|
228
226
|
<p>
|
229
227
|
入力:
|
@@ -243,7 +241,7 @@ Mass <math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><mi>m</mi
|
|
243
241
|
<figcaption>
|
244
242
|
Figure 1: これは図のキャプションの例です。
|
245
243
|
Rubyのロゴを描いてみました。
|
246
|
-
キャプションに数式を<math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><mi>a</mi><msup><mi>x</mi><mn>2</mn></msup><mo>+</mo><mi>b</mi><mi>x</mi><mo>+</mo><mi>c</mi><mo>=</mo><mn>0</mn></math>と書くこともできます。
|
244
|
+
キャプションに数式を<math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><mi>a</mi><msup><mi>x</mi><mn>2</mn></msup><mo stretchy='false'>+</mo><mi>b</mi><mi>x</mi><mo stretchy='false'>+</mo><mi>c</mi><mo stretchy='false'>=</mo><mn>0</mn></math>と書くこともできます。
|
247
245
|
</figcaption>
|
248
246
|
</figure>
|
249
247
|
<h3 id="LABEL-16">表の挿入方法</h3>
|
@@ -255,7 +253,7 @@ Table環境はまだインプリメントされていません。
|
|
255
253
|
「コード環境」は "\Code:baz FILENAME" で始めて "/Code:baz" で閉じてください。
|
256
254
|
間にキャプションを書くことができます。
|
257
255
|
ここで "baz" は図のタグです。
|
258
|
-
"Code:baz"
|
256
|
+
"Code:baz"で当該コードを参照することができます。こんな具合です<a href="#Code:hello">Code 1</a>。
|
259
257
|
</p>
|
260
258
|
<p>
|
261
259
|
入力:
|
@@ -289,8 +287,8 @@ int main()
|
|
289
287
|
<h2 id="LABEL-18">ulmul2html5の使用方法</h2>
|
290
288
|
<h3 id="LABEL-19">例</h3>
|
291
289
|
<pre>
|
292
|
-
$ ulmul2html5 foo.txt
|
293
|
-
$ ulmul2html5 -n 'Takeshi Nishimatsu' -s ulmul-slidy.css -j ulmul-slidy.js presentation.txt
|
290
|
+
$ ulmul2html5 foo.txt > foo.html
|
291
|
+
$ ulmul2html5 -n 'Takeshi Nishimatsu' -s ulmul-slidy.css -j ulmul-slidy.js presentation.txt > presentation.html
|
294
292
|
</pre>
|
295
293
|
<h3 id="LABEL-20">コマンド・ライン・オプション</h3>
|
296
294
|
<h4 id="LABEL-21">--help</h4>
|
@@ -348,8 +346,8 @@ JavaScriptのファイル名を指定します。
|
|
348
346
|
</p>
|
349
347
|
<pre>
|
350
348
|
$ ulmul2mathjax --help
|
351
|
-
$ ulmul2mathjax -s ulmul2html5.css -
|
352
|
-
-j 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default' README-en
|
349
|
+
$ ulmul2mathjax -s ulmul2html5.css -j https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js \
|
350
|
+
-j 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default' README-en > README-en-mathjax.html
|
353
351
|
</pre>
|
354
352
|
</div>
|
355
353
|
|
@@ -405,12 +403,6 @@ You can download the original package, slidy.zip, from
|
|
405
403
|
their licenses at <a href="http://www.w3.org/Consortium/Legal/copyright-documents">http://www.w3.org/Consortium/Legal/copyright-documents</a>
|
406
404
|
and <a href="http://www.w3.org/Consortium/Legal/copyright-software">http://www.w3.org/Consortium/Legal/copyright-software</a> .
|
407
405
|
</p>
|
408
|
-
<p>
|
409
|
-
Google Inc. has copyrights for files under google-code-prettify
|
410
|
-
directory. Package prettify-21-Jul-2010.zip is distributed
|
411
|
-
from <a href="http://code.google.com/p/google-code-prettify/">http://code.google.com/p/google-code-prettify/</a> under the
|
412
|
-
Apache License, Version 2.0.
|
413
|
-
</p>
|
414
406
|
</div>
|
415
407
|
|
416
408
|
|
@@ -420,5 +412,7 @@ Apache License, Version 2.0.
|
|
420
412
|
西松タケシ (t_nissie{at}yahoo.co.jp) <a href="http://t-nissie.users.sourceforge.net/">http://t-nissie.users.sourceforge.net/</a>
|
421
413
|
</p>
|
422
414
|
</div>
|
415
|
+
<hr />
|
416
|
+
<address>Copyright © 2014 Takeshi Nishimatsu</address>
|
423
417
|
</body>
|
424
418
|
</html>
|
data/lib/ulmul.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# -*- coding: utf-8 -*-
|
3
3
|
# ulmul.rb
|
4
|
-
# Time-stamp: <
|
4
|
+
# Time-stamp: <2013-12-31 17:16:29 takeshi>
|
5
5
|
# Author: Takeshi Nishimatsu
|
6
6
|
##
|
7
7
|
require "rubygems"
|
@@ -32,7 +32,7 @@ module Itemize
|
|
32
32
|
if new_level>@level_of_state+1
|
33
33
|
STDERR << filename << ":#{lnumber}: Illegal jump of itemize level from #{@level_of_state} to #{new_level}: #{line}"
|
34
34
|
exit 1
|
35
|
-
raise
|
35
|
+
raise
|
36
36
|
elsif new_level==@level_of_state+1
|
37
37
|
@body << "\n" << " "*@level_of_state << ITEMIZE_INITIATOR << "\n"
|
38
38
|
@body << " "*(new_level-1) << " " << ITEM_INITIATOR << str
|
@@ -83,27 +83,27 @@ end
|
|
83
83
|
class Ulmul
|
84
84
|
include AASM
|
85
85
|
include Itemize
|
86
|
-
VERSION = '0.5.
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
transitions :from => :st_ground, :to => :st_ground
|
99
|
-
transitions :from => :st_itemize, :to => :st_itemize
|
86
|
+
VERSION = '0.5.2'
|
87
|
+
|
88
|
+
aasm.initial_state :st_ground
|
89
|
+
|
90
|
+
aasm.state :st_ground
|
91
|
+
aasm.state :st_itemize
|
92
|
+
aasm.state :st_verbatim
|
93
|
+
aasm.state :st_paragraph
|
94
|
+
aasm.state :st_env
|
95
|
+
aasm.state :st_equation
|
96
|
+
|
97
|
+
aasm.event :ev_ignore do
|
98
|
+
transitions :from => :st_ground, :to => :st_ground
|
99
|
+
transitions :from => :st_itemize, :to => :st_itemize
|
100
100
|
transitions :from => :st_verbatim, :to => :st_verbatim
|
101
|
-
transitions :from => :st_paragraph, :to => :st_paragraph
|
102
|
-
transitions :from => :st_env, :to => :st_env
|
101
|
+
transitions :from => :st_paragraph, :to => :st_paragraph
|
102
|
+
transitions :from => :st_env, :to => :st_env
|
103
103
|
transitions :from => :st_equation, :to => :st_equation
|
104
104
|
end
|
105
105
|
|
106
|
-
|
106
|
+
aasm.event :ev_asterisk do
|
107
107
|
transitions :from => :st_ground, :to => :st_itemize, :on_transition => [:cb_itemize_begin, :cb_itemize_add_item]
|
108
108
|
transitions :from => :st_itemize, :to => :st_itemize, :on_transition => [:cb_itemize_add_item]
|
109
109
|
transitions :from => :st_verbatim, :to => :st_verbatim, :on_transition => [:cb_verbatim_add]
|
@@ -111,8 +111,8 @@ class Ulmul
|
|
111
111
|
transitions :from => :st_env, :to => :st_env, :on_transition => [:cb_env_continues]
|
112
112
|
transitions :from => :st_equation, :to => :st_equation, :on_transition => [:cb_equation_continues]
|
113
113
|
end
|
114
|
-
|
115
|
-
|
114
|
+
|
115
|
+
aasm.event :ev_offset do
|
116
116
|
transitions :from => :st_ground, :to => :st_verbatim, :on_transition => [:cb_verbatim_begin, :cb_verbatim_add]
|
117
117
|
transitions :from => :st_itemize, :to => :st_itemize, :on_transition => [:cb_itemize_continue_item]
|
118
118
|
transitions :from => :st_verbatim, :to => :st_verbatim, :on_transition => [:cb_verbatim_add]
|
@@ -120,8 +120,8 @@ class Ulmul
|
|
120
120
|
transitions :from => :st_env, :to => :st_env, :on_transition => [:cb_env_continues]
|
121
121
|
transitions :from => :st_equation, :to => :st_equation, :on_transition => [:cb_equation_continues]
|
122
122
|
end
|
123
|
-
|
124
|
-
|
123
|
+
|
124
|
+
aasm.event :ev_heading do
|
125
125
|
transitions :from => :st_ground, :to => :st_ground, :on_transition => [:cb_heading]
|
126
126
|
transitions :from => :st_itemize, :to => :st_ground, :on_transition => [:cb_itemize_end, :cb_heading]
|
127
127
|
transitions :from => :st_verbatim, :to => :st_ground, :on_transition => [:cb_verbatim_end, :cb_heading]
|
@@ -129,8 +129,8 @@ class Ulmul
|
|
129
129
|
transitions :from => :st_env, :to => :st_ground, :on_transition => [:cb_env_in_env_error]
|
130
130
|
transitions :from => :st_equation, :to => :st_equation, :on_transition => [:cb_equation_in_equation_error]
|
131
131
|
end
|
132
|
-
|
133
|
-
|
132
|
+
|
133
|
+
aasm.event :ev_empty do
|
134
134
|
transitions :from => :st_ground, :to => :st_ground
|
135
135
|
transitions :from => :st_itemize, :to => :st_ground, :on_transition => [:cb_itemize_end]
|
136
136
|
transitions :from => :st_verbatim, :to => :st_ground, :on_transition => [:cb_verbatim_end]
|
@@ -139,7 +139,7 @@ class Ulmul
|
|
139
139
|
transitions :from => :st_equation, :to => :st_equation
|
140
140
|
end
|
141
141
|
|
142
|
-
|
142
|
+
aasm.event :ev_env_begin do
|
143
143
|
transitions :from => :st_ground, :to => :st_env, :on_transition => [:cb_env_begin]
|
144
144
|
transitions :from => :st_itemize, :to => :st_env, :on_transition => [:cb_itemize_end, :cb_env_begin]
|
145
145
|
transitions :from => :st_verbatim, :to => :st_env, :on_transition => [:cb_verbatim_end, :cb_env_begin]
|
@@ -147,28 +147,28 @@ class Ulmul
|
|
147
147
|
transitions :from => :st_env, :to => :st_env, :on_transition => [:cb_env_in_env_error]
|
148
148
|
transitions :from => :st_equation, :to => :st_equation, :on_transition => [:cb_equation_in_equation_error]
|
149
149
|
end
|
150
|
-
|
151
|
-
|
150
|
+
|
151
|
+
aasm.event :ev_env_end do
|
152
152
|
transitions :from => [:st_ground, :st_itemize, :st_verbatim, :st_paragraph, :st_equation],
|
153
153
|
:to => :st_ground, :on_transition => [:cb_env_not_in_env_error]
|
154
154
|
transitions :from => :st_env, :to => :st_ground, :on_transition => [:cb_env_end]
|
155
155
|
end
|
156
|
-
|
157
|
-
|
156
|
+
|
157
|
+
aasm.event :ev_equation_begin do
|
158
158
|
transitions :from => :st_ground, :to => :st_equation, :on_transition => [:cb_paragraph_begin, :cb_equation_begin]
|
159
159
|
transitions :from => :st_itemize, :to => :st_equation, :on_transition => [:cb_itemize_end, :cb_paragraph_begin, :cb_equation_begin]
|
160
160
|
transitions :from => :st_verbatim, :to => :st_equation, :on_transition => [:cb_verbatim_end, :cb_paragraph_begin, :cb_equation_begin]
|
161
161
|
transitions :from => :st_paragraph, :to => :st_equation, :on_transition => [:cb_equation_begin]
|
162
162
|
transitions :from => :st_equation, :to => :st_equation, :on_transition => [:cb_equation_in_equation_error]
|
163
163
|
end
|
164
|
-
|
165
|
-
|
164
|
+
|
165
|
+
aasm.event :ev_equation_end do
|
166
166
|
transitions :from => [:st_ground, :st_itemize, :st_verbatim, :st_paragraph, :st_env],
|
167
167
|
:to => :st_ground, :on_transition => [:cb_equation_not_in_equation_error]
|
168
168
|
transitions :from => :st_equation, :to => :st_paragraph, :on_transition => [:cb_equation_end]
|
169
169
|
end
|
170
|
-
|
171
|
-
|
170
|
+
|
171
|
+
aasm.event :ev_normal do
|
172
172
|
transitions :from => :st_ground, :to => :st_paragraph, :on_transition => [:cb_paragraph_begin, :cb_paragraph_add]
|
173
173
|
transitions :from => :st_itemize, :to => :st_paragraph, :on_transition => [:cb_itemize_end, :cb_paragraph_begin, :cb_paragraph_add]
|
174
174
|
transitions :from => :st_verbatim, :to => :st_paragraph, :on_transition => [:cb_verbatim_end, :cb_paragraph_begin, :cb_paragraph_add]
|
@@ -194,7 +194,7 @@ class Ulmul
|
|
194
194
|
end
|
195
195
|
|
196
196
|
def cb_verbatim_add(filename=nil, lnumber=nil, line=nil)
|
197
|
-
@body << line[1..-1]
|
197
|
+
@body << line[1..-1].gsub(/</,'<').gsub(/>/,'>')
|
198
198
|
end
|
199
199
|
|
200
200
|
def cb_verbatim_end(filename=nil, lnumber=nil, line=nil)
|
@@ -321,10 +321,14 @@ module HTML
|
|
321
321
|
|
322
322
|
def body
|
323
323
|
b = @body.dup
|
324
|
-
@equations
|
325
|
-
|
326
|
-
|
327
|
-
|
324
|
+
[@equations, @figures, @tables, @codes].each do |ary|
|
325
|
+
ary.each_with_index do |r,i|
|
326
|
+
s = r.sub(/:.*/,'')
|
327
|
+
if /Eq|Fig/ =~ s then s << '.' end
|
328
|
+
if /Eq/ =~ s then no = "(#{i+1})" else no = "#{i+1}" end
|
329
|
+
b.gsub!(Regexp.new('(?![A-Za-z0-9_"\'#%\\\\])(.)'+r+'(?![A-Za-z0-9_"\'#%])(.)'),"\\1<a href=\"##{r}\">#{s} #{no}</a>\\2")
|
330
|
+
end
|
331
|
+
end
|
328
332
|
if $MAX_TABLE_OF_CONTENTS>=2
|
329
333
|
b.sub(CONTENTS_HERE, "<br />\n<div class=\"table of contents\">\nTable of Contents:" +
|
330
334
|
@toc.body + "</div>\n")
|
@@ -388,7 +392,6 @@ module HTML5
|
|
388
392
|
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
|
389
393
|
<title>#{@title}</title>
|
390
394
|
<meta name=\"author\" content=\"#{name}\" />
|
391
|
-
<meta name=\"copyright\" content=\"Copyright © #{Date.today.year} #{name}\" />
|
392
395
|
<script type=\"text/x-mathjax-config\">
|
393
396
|
MathJax.Hub.Config({
|
394
397
|
tex2jax: {
|
@@ -400,6 +403,8 @@ module HTML5
|
|
400
403
|
</head>
|
401
404
|
<body onload=\"prettyPrint()\">
|
402
405
|
#{body()}
|
406
|
+
<hr />
|
407
|
+
<address>Copyright © #{Date.today.year} #{name}</address>
|
403
408
|
</body>
|
404
409
|
</html>
|
405
410
|
"
|
@@ -421,7 +426,7 @@ module XHTML
|
|
421
426
|
cb_env_end2code()
|
422
427
|
end
|
423
428
|
end
|
424
|
-
|
429
|
+
|
425
430
|
def file(stylesheets=["ulmul2xhtml.css"],javascripts=[],name="",language="en")
|
426
431
|
style_lines=""
|
427
432
|
stylesheets.each{|s| style_lines << " <link rel=\"stylesheet\" href=\"#{s}\" type=\"text/css\" />\n"}
|
@@ -531,10 +536,14 @@ module LaTeX
|
|
531
536
|
|
532
537
|
def body
|
533
538
|
b = @body.dup
|
534
|
-
@equations.each
|
535
|
-
|
536
|
-
|
537
|
-
|
539
|
+
[@equations, @figures, @tables, @codes].each do |ary|
|
540
|
+
ary.each_with_index do |r,i|
|
541
|
+
s = r.sub(/:.*/,'')
|
542
|
+
if /Eq|Fig/ =~ s then s << '.' end
|
543
|
+
if /Eq/ =~ s then no = "(\\ref{#{r}})" else no = "\\ref{#{r}}" end
|
544
|
+
b.gsub!(Regexp.new('(?![A-Za-z0-9_"\'#%\\\\{\=])(.)'+r+'(?![A-Za-z0-9_"\'#%}])(.)'), "\\1#{s}~#{no}\\2")
|
545
|
+
end
|
546
|
+
end
|
538
547
|
return b
|
539
548
|
end
|
540
549
|
end
|