ulmul 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README-en +172 -0
- data/README-ja +56 -45
- data/Rakefile +11 -19
- data/XHTML-vs-HTML5.ja.txt +86 -0
- data/bin/ulmul2html5 +70 -0
- data/bin/ulmul2xhtml +70 -0
- data/index.en.html +330 -0
- data/{README-ja.xhtml → index.ja.html} +115 -90
- data/lib/ulmul.rb +38 -205
- data/ulmul.gemspec +9 -6
- data/{style.css → ulmul2html5.css} +16 -2
- data/ulmul2xhtml.css +79 -0
- metadata +16 -11
- data/README-en.xhtml +0 -294
- data/bin/ulmul.rb +0 -561
- data/index.html +0 -28
data/README-en
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
= ULMUL (Ultra Lightweight MarkUp Language)
|
2
|
+
"ULMUL" is an original Ultra Lightweight MarkUp Language.
|
3
|
+
ULMUL texts can be converted into HTML5 with "ulmul2html5" command
|
4
|
+
and into XHTML with "ulmul2xhtml" command.
|
5
|
+
TeX stile equations are converted into MathML.
|
6
|
+
ULMUL is written in Ruby.
|
7
|
+
You can also use ulmul.rb as a library.
|
8
|
+
|
9
|
+
Homepage of ULMUL: http://ulmul.rubyforge.org/
|
10
|
+
|
11
|
+
Download ULMUL from: http://rubyforge.org/projects/ulmul or http://rubygems.org/gems/ulmul
|
12
|
+
|
13
|
+
== Features
|
14
|
+
* TeX style equations between two dollar marks ($) and between Eq. and /Eq.
|
15
|
+
will be converted into MathML. You can use Firefox version 3.x, IE+MathPlayer,
|
16
|
+
etc. to read MathML.
|
17
|
+
* ulmul2xhtml output is good with the Slidy presentation environment
|
18
|
+
http://www.w3.org/Talks/Tools/Slidy/ using Firefox+CSS+XHTML+JavaScript.
|
19
|
+
* Lines starting from "#" are comments.
|
20
|
+
* You can add your conversion rules to @subs_rules.
|
21
|
+
* List of contents will be automatically generated.
|
22
|
+
* "= ABC EFGH" will be the document title and the cover page of Slidy.
|
23
|
+
* Use utf-8 for ULMUL texts.
|
24
|
+
Specify your natural language with a --language option, e.g. --language=en.
|
25
|
+
|
26
|
+
== Installation of ULMUL
|
27
|
+
There are two different ways to install ULMUL.
|
28
|
+
=== I. Conservative way; use setup.rb
|
29
|
+
ulmul-X.Y.Z.tgz package can be installed as:
|
30
|
+
$ tar zxf ulmul-X.Y.Z.tgz
|
31
|
+
$ cd ulmul-X.Y.Z
|
32
|
+
$ su
|
33
|
+
# ruby setup.rb
|
34
|
+
Note that the eimxml and mathml libraries are required.
|
35
|
+
=== II. RubyGems users can take an easy way
|
36
|
+
There is an easy way, if you are a RubyGems user:
|
37
|
+
$ su
|
38
|
+
# gem install ulmul
|
39
|
+
If you do not have the eimxml and mathml libraries, gem will download and install the
|
40
|
+
library automatically.
|
41
|
+
|
42
|
+
== How to write ULMUL texts
|
43
|
+
The encode of input file must be utf-8.
|
44
|
+
=== lines
|
45
|
+
==== empty
|
46
|
+
Empty lines divide paragraphs.
|
47
|
+
==== heading
|
48
|
+
Starting with "= ", "== ", "=== ", "==== ", "===== ", and "====== ".
|
49
|
+
"= " will be used for the title.
|
50
|
+
==== asterisk
|
51
|
+
Lines starting with
|
52
|
+
" *"
|
53
|
+
" *"
|
54
|
+
" *"
|
55
|
+
" *"
|
56
|
+
" *"
|
57
|
+
become itemize.
|
58
|
+
==== offset
|
59
|
+
Lines starting with some spaces but not asterisks become verbatim lines.
|
60
|
+
==== end
|
61
|
+
EOF or "=end" end the process.
|
62
|
+
==== ignore
|
63
|
+
Lines starting with"#" and "=begin" are ignored.
|
64
|
+
==== normal
|
65
|
+
Other lines.
|
66
|
+
=== Other rules
|
67
|
+
* Lines after "=end" are ignored.
|
68
|
+
* Add your substitution rules to @subs_rules.
|
69
|
+
=== Equations
|
70
|
+
Input:
|
71
|
+
Mass $m$ can be converted into energy $E$ as
|
72
|
+
Eq. 1
|
73
|
+
E=mc^2.
|
74
|
+
/Eq.
|
75
|
+
|
76
|
+
Output:
|
77
|
+
|
78
|
+
Mass $m$ can be converted into energy $E$ as
|
79
|
+
Eq. 1
|
80
|
+
E=mc^2.
|
81
|
+
/Eq.
|
82
|
+
|
83
|
+
To view the equations in MathML correctly, please use
|
84
|
+
* Firefox http://mozilla.jp/firefox/
|
85
|
+
* IE8 + MathPlayer http://www.dessci.com/en/products/mathplayer/
|
86
|
+
* etc.
|
87
|
+
|
88
|
+
=== Figures
|
89
|
+
Input:
|
90
|
+
Fig. 1 ruby.jpg
|
91
|
+
The is a dummy figure for an example.
|
92
|
+
Cute red logo of Ruby, isn't it?
|
93
|
+
/Fig.
|
94
|
+
|
95
|
+
Output:
|
96
|
+
Fig. 1 ruby.jpg
|
97
|
+
The is a dummy figure for an example.
|
98
|
+
Cute red logo of Ruby, isn't it?
|
99
|
+
/Fig.
|
100
|
+
|
101
|
+
== Usage
|
102
|
+
There are ulmul2xhtml and ulmul2html5 commands.
|
103
|
+
|
104
|
+
Use .html extensions even for ulmul2xhtml outputs.
|
105
|
+
|
106
|
+
To view HTML5 documents,
|
107
|
+
change the setting of the "html5.enable" entry to "true" in "about:config".
|
108
|
+
See http://kb.mozillazine.org/About:config for details.
|
109
|
+
|
110
|
+
=== Examples
|
111
|
+
$ ulmul2xhtml without-equations.txt > without-equations.html # XHTML1.0 Transitional
|
112
|
+
$ ulmul2xhtml with-equations.txt > with-equations.html # XHTML1.1 + MathML2.0
|
113
|
+
$ ulmul2xhtml -n 'Takeshi Nishimatsu' -s ulmul-slidy.css -j slidy.js presentation.txt > presentation.xhtml
|
114
|
+
$ ulmul2html5 with-equations.txt > with-equations.html # HTML5
|
115
|
+
|
116
|
+
=== Command options
|
117
|
+
==== --help
|
118
|
+
Show a help message.
|
119
|
+
==== -s, --style
|
120
|
+
Specify stylesheet filename.
|
121
|
+
==== -n, --name
|
122
|
+
Specify your name for copyright notices.
|
123
|
+
==== -j, --javascript
|
124
|
+
Specify JavaScript filename.
|
125
|
+
==== -l, --language
|
126
|
+
Specify natural language. Its default is "en".
|
127
|
+
==== -c, --contents-range
|
128
|
+
Range of "Contents". Its default is "2..3".
|
129
|
+
If you do not need "Contents" at the beginning of the
|
130
|
+
output HTML file, set it 3..2.
|
131
|
+
|
132
|
+
=== ULMUL and Slidy examples
|
133
|
+
* http://loto.sourceforge.net/feram/
|
134
|
+
* Its source is http://loto.sourceforge.net/feram/README
|
135
|
+
* http://loto.sourceforge.net/feram/doc/film.xhtml
|
136
|
+
* It is a Slidy presentation made from http://loto.sourceforge.net/feram/doc/film.txt
|
137
|
+
|
138
|
+
== TODO
|
139
|
+
* rescue syntax errors (raises) in an input file and report the
|
140
|
+
errors as #{$FILENAME}:#{file.lineno}:...
|
141
|
+
* Unit test, tests/ulmul_test.rb
|
142
|
+
* @body must be XML object, not a String.
|
143
|
+
* Tables.
|
144
|
+
* References to figures, tables and code.
|
145
|
+
* Citation.
|
146
|
+
* Include highlighted code between Code.../Code.
|
147
|
+
|
148
|
+
== Subversion repository
|
149
|
+
You can checkout the latest source tree of ULMUL anonymously from RubyForge with svn(1) command:
|
150
|
+
$ svn co svn://rubyforge.org/var/svn/ulmul/ulmul/trunk ulmul
|
151
|
+
|
152
|
+
== Copying
|
153
|
+
ulmul.rb is distributed in the hope that
|
154
|
+
it will be useful, but WITHOUT ANY WARRANTY.
|
155
|
+
You can copy, modify and redistribute ulmul.rb,
|
156
|
+
but only under the conditions described in
|
157
|
+
the GNU General Public License (the "GPL").
|
158
|
+
|
159
|
+
W3C has copyrights for slidy.js and ulmul-slidy.css (originally
|
160
|
+
named slidy.css). Takeshi Nishimatsu modified them.
|
161
|
+
You can download the original package, slidy.zip, from
|
162
|
+
http://www.w3.org/Talks/Tools/Slidy/ . You can find
|
163
|
+
their licenses at http://www.w3.org/Consortium/Legal/copyright-documents
|
164
|
+
and http://www.w3.org/Consortium/Legal/copyright-software .
|
165
|
+
|
166
|
+
== Author of ULMUL
|
167
|
+
Takeshi Nishimatsu (t_nissie{at}yahoo.co.jp)
|
168
|
+
|
169
|
+
# Local variables:
|
170
|
+
# mode: rd
|
171
|
+
# compile-command: "rake index.en.html"
|
172
|
+
# End:
|
data/README-ja
CHANGED
@@ -1,34 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
と同様なことができるようになることをめざして開発しています。
|
1
|
+
= ULMUL取扱説明書
|
2
|
+
ULMULは独自の軽量マークアップ言語 (Ultra Lightweight MarkUp Language) です。
|
3
|
+
コマンドulmul2html5でHTML5に、ulmul2xhtmlでXHTMLに変換できます。
|
4
|
+
文章中のTeXスタイルで書かれた数式をMathMLに変換できるのが特徴です。
|
5
|
+
Rubyで書かれています。ulmul.rbをライブラリとして利用することも可能です。
|
9
6
|
|
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 から生成されました。
|
7
|
+
ホームページ: http://ulmul.rubyforge.org/
|
18
8
|
|
9
|
+
ダウンロード: http://rubyforge.org/projects/ulmul/ または http://rubygems.org/gems/ulmul
|
19
10
|
|
20
11
|
== 特徴
|
21
12
|
* 文章中の2つのドル記号($)で挟まれた部分とEq.…/Eq.で挟まれた行が数式としてTeX形式からMathML形式に変換されます。
|
22
13
|
MathMLとはXMLで数式を記述するための規格です。込み入った規格なので人間が直接MathMLを記述する
|
23
14
|
ことは想定されていませんが、ULMULでやっているようにTeXなどからの変換により生成することができます。
|
24
|
-
Firefoxのバージョン3.0
|
15
|
+
Firefoxのバージョン3.0以上やIE+MathPlayerで読めるようです。
|
25
16
|
math_ml.rb http://www.hinet.mydns.jp/?mathml.rb を使っています。
|
26
17
|
* ウェブ・ブラウザ+CSS+XHTML+JavaScriptを使ったプレゼン環境
|
27
|
-
Slidy http://www.w3.org/Talks/Tools/Slidy/ に対応した
|
28
|
-
ただし、PowerPointより優れたプレゼンができるかというと、そうとも限りません。
|
18
|
+
Slidy http://www.w3.org/Talks/Tools/Slidy/ に対応したxhtmlが出力可能。
|
29
19
|
* =begin, =end はあってもなくてもかまいません。
|
30
20
|
* 行を#ではじめるとコメントになります。
|
31
|
-
*
|
21
|
+
* ulmul.rbをライブラリとしても使えます。
|
32
22
|
* subs_rulesに俺ルールを加えることができます。
|
33
23
|
* 目次 (Contents) を自動的に生成できます。
|
34
24
|
* はじめの「= ABCD EFGH」がタイトルになります。Slidyの表紙にもなります。
|
@@ -41,23 +31,11 @@ http://loto.sourceforge.net/feram/doc/film.txt から生成されました。
|
|
41
31
|
パッケージ ulmul-X.Y.Z.tgz を次のようにインストールします:
|
42
32
|
$ tar zxf ulmul-X.Y.Z.tgz
|
43
33
|
$ cd ulmul-X.Y.Z
|
44
|
-
$
|
45
|
-
# ruby setup.rb
|
34
|
+
$ sudo ruby setup.rb
|
46
35
|
なお、ULMULを使うにはeimxmlライブラリとmathmlライブラリとが必要です。
|
47
36
|
=== II. RubyGemsを使えば簡単にインストールができます
|
48
37
|
gemでインストールすればeimxmlライブラリとmathmlライブラリとは自動的にインストールされます:
|
49
|
-
$
|
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
|
-
以下にあるかもしれません。
|
38
|
+
$ sudo gem install ulmul
|
61
39
|
|
62
40
|
== ULMULテキストの書き方
|
63
41
|
ULMULテキストのエンコーディングにはutf-8を使ってください。
|
@@ -82,12 +60,14 @@ EOF と "=end" が出てくると処理が終了します。
|
|
82
60
|
Lines starting with"#" and "=begin" are ignored.
|
83
61
|
==== その他の入力行 (normal)
|
84
62
|
地の文になります。
|
63
|
+
|
85
64
|
=== その他のルール
|
86
65
|
* "=end"より後の行はすべて無視されます。
|
87
66
|
* あなたのオリジナル・ルールを @subs_rules に加えることができます。
|
67
|
+
|
88
68
|
=== 数式の書き方
|
89
69
|
文章中の2つのドル記号($)で挟まれた部分がTeX形式からMathML形式に変換されます。
|
90
|
-
また、Eq.…/Eq
|
70
|
+
また、Eq.…/Eq.で挟まれた行も次の例のように処理されます。
|
91
71
|
|
92
72
|
入力:
|
93
73
|
Mass $m$ can be converted into energy $E$ as
|
@@ -102,24 +82,46 @@ Eq. 1
|
|
102
82
|
E=mc^2.
|
103
83
|
/Eq.
|
104
84
|
|
85
|
+
数式を正しくご覧いただくには
|
86
|
+
* Firefox http://mozilla.jp/firefox/
|
87
|
+
* IE8 + MathPlayer http://www.dessci.com/en/products/mathplayer/
|
88
|
+
などのブラウザを試してみて下さい。
|
89
|
+
|
105
90
|
=== 図の挿入方法
|
106
91
|
入力:
|
107
92
|
Fig. 1 ruby.jpg
|
108
93
|
The is a dummy figure for an example.
|
94
|
+
Cute red logo of Ruby, isn't it?
|
109
95
|
/Fig.
|
110
96
|
|
111
97
|
出力:
|
112
98
|
Fig. 1 ruby.jpg
|
113
99
|
The is a dummy figure for an example.
|
100
|
+
Cute red logo of Ruby, isn't it?
|
114
101
|
/Fig.
|
115
102
|
|
116
103
|
== 使用方法
|
104
|
+
ulmul2xhtmlとulmul2html5の2つのコマンドがあります。
|
105
|
+
|
106
|
+
2010年4月現在、ulmul2xhtmlの出力を.htmlの拡張子を持ったファイルにリダイレクトして
|
107
|
+
httpサーバからtext/htmlのMIMEタイプで送信されるようにすれば
|
108
|
+
いくつかのブラウザが数式を表示してくれるようです。
|
109
|
+
1行目のxml宣言を取るとさらにうまく表示される場合もあります。
|
110
|
+
|
111
|
+
Firefox3.6でHTML5を表示するには、URLとして about:config を入力して、
|
112
|
+
html5.enableをfalseからtrueに変更してください。
|
113
|
+
|
114
|
+
IE8はMathMLで書かれた数式を含んだHTML5をうまく表示できないようです。
|
115
|
+
|
117
116
|
=== 例
|
118
|
-
$
|
119
|
-
$
|
120
|
-
$
|
121
|
-
|
117
|
+
$ ulmul2xhtml without-equations.txt > without-equations.html # XHTML1.0 Transitional
|
118
|
+
$ ulmul2xhtml with-equations.txt > with-equations.html # XHTML1.1 + MathML2.0
|
119
|
+
$ ulmul2xhtml -n 'Takeshi Nishimatsu' -s ulmul-slidy.css -j slidy.js presentation.txt > presentation.xhtml
|
120
|
+
$ ulmul2html5 with-equations.txt > with-equations.html # HTML5
|
121
|
+
|
122
122
|
=== コマンド・ライン・オプション
|
123
|
+
==== --help
|
124
|
+
ヘルプ情報が表示されます。
|
123
125
|
==== -s, --style
|
124
126
|
スタイルシートのファイル名を指定します。--style=style.css などがよいでしょう。
|
125
127
|
==== -n, --name
|
@@ -131,14 +133,22 @@ JavaScriptのファイル名を指定します。
|
|
131
133
|
==== -c, --contents-range
|
132
134
|
目次の深さを指定します。既定値は"2..3"です。
|
133
135
|
目次が必要なければ-c 3..2とします。
|
134
|
-
|
135
|
-
|
136
|
+
|
137
|
+
=== 使用例
|
138
|
+
* http://loto.sourceforge.net/feram/
|
139
|
+
* ソースは http://loto.sourceforge.net/feram/README
|
140
|
+
* http://loto.sourceforge.net/feram/doc/film.xhtml
|
141
|
+
* ソースは http://loto.sourceforge.net/feram/doc/film.txt
|
136
142
|
|
137
143
|
== ulmul.rbの仕組み
|
138
144
|
入力の各行をイベントとして状態遷移しています。
|
139
|
-
|
140
|
-
|
141
|
-
|
145
|
+
定数Ulmul::TABLEが状態遷移表です。
|
146
|
+
|
147
|
+
== 最新のソース・ツリーの入手方法
|
148
|
+
ソース・ツリーはRubyForge.orgのSubversionレポジトリで管理されています。
|
149
|
+
svn(1)コマンドを使って
|
150
|
+
$ svn co svn://rubyforge.org/var/svn/ulmul/ulmul/trunk ulmul
|
151
|
+
とcheckoutできます。
|
142
152
|
|
143
153
|
== 著作権表示
|
144
154
|
ulmul.rb is distributed in the hope that
|
@@ -158,5 +168,6 @@ and http://www.w3.org/Consortium/Legal/copyright-software .
|
|
158
168
|
西松タケシ (t_nissie{at}yahoo.co.jp)
|
159
169
|
|
160
170
|
# Local variables:
|
161
|
-
#
|
171
|
+
# mode: rd
|
172
|
+
# compile-command: "rake index.ja.html"
|
162
173
|
# End:
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#! /usr/bin/env rake
|
2
2
|
# -*-Ruby-*-
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <2010-04-01 08:37:35 takeshi>
|
4
4
|
# Author: Takeshi Nishimatsu
|
5
5
|
##
|
6
6
|
$LOAD_PATH.unshift('lib')
|
@@ -14,7 +14,7 @@ require 'archive/tar/minitar'
|
|
14
14
|
require 'zlib'
|
15
15
|
|
16
16
|
spec = eval(File.read("ulmul.gemspec"))
|
17
|
-
spec.version =
|
17
|
+
spec.version = Ulmul::VERSION
|
18
18
|
ULMUL_PACKAGE_DIR = '..'
|
19
19
|
# RDOC_OPTS = %w(--title ulmul --line-numbers)
|
20
20
|
# spec.rdoc_options = RDOC_OPTS
|
@@ -48,28 +48,20 @@ end
|
|
48
48
|
# end
|
49
49
|
|
50
50
|
desc "Publish to RubyForge"
|
51
|
-
task :rubyforge => ["
|
52
|
-
"
|
53
|
-
"style.css", "
|
51
|
+
task :rubyforge => ["index.en.html",
|
52
|
+
"index.ja.html",
|
53
|
+
"style.css", "favicon.ico", "ruby.jpg"] do |t|
|
54
54
|
t.prerequisites.each do |f|
|
55
55
|
sh "scp #{f} t-nissie@rubyforge.org:/var/www/gforge-projects/ulmul/"
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
desc "
|
60
|
-
|
61
|
-
|
62
|
-
desc "Copy lib/ulmul.rb ../ulmul-X.Y.Z.rb"
|
63
|
-
task :ulmul_version_rb do
|
64
|
-
FileUtils.copy_file('lib/ulmul.rb', ULMUL_PACKAGE_DIR + '/ulmul-' + ULMUL_RB_VERSION + '.rb')
|
65
|
-
end
|
66
|
-
|
67
|
-
desc "Create README-en.xhtml"
|
68
|
-
file "README-en.xhtml" => ["bin/ulmul.rb", "style.css", "lib/ulmul.rb"] do |t|
|
69
|
-
sh "ruby #{t.prerequisites[0]} -c 2..3 -s #{t.prerequisites[1]} #{t.prerequisites[2]} > #{t.name}"
|
59
|
+
desc "Create index.en.html"
|
60
|
+
file "index.en.html" => ["bin/ulmul2xhtml", "ulmul2xhtml.css", "README-en", "lib/ulmul.rb"] do |t|
|
61
|
+
sh "ruby -I lib #{t.prerequisites[0]} -n 'Takeshi Nishimatsu' -l en #{t.prerequisites[2]} > #{t.name}"
|
70
62
|
end
|
71
63
|
|
72
|
-
desc "Create
|
73
|
-
file "
|
74
|
-
sh "ruby #{t.prerequisites[0]} -
|
64
|
+
desc "Create index.ja.html"
|
65
|
+
file "index.ja.html" => ["bin/ulmul2xhtml", "ulmul2xhtml.css", "README-ja", "lib/ulmul.rb"] do |t|
|
66
|
+
sh "ruby -I lib #{t.prerequisites[0]} -n 'Takeshi Nishimatsu' -l ja #{t.prerequisites[2]} > #{t.name}"
|
75
67
|
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
= XHTML vs HTML5
|
2
|
+
XHTMLとHTML5とを比較
|
3
|
+
|
4
|
+
== XHTML
|
5
|
+
=== XHTML+MathMLの例
|
6
|
+
<?xml version="1.0" encoding="utf-8"?>
|
7
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
|
8
|
+
"http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd">
|
9
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja">
|
10
|
+
<head>
|
11
|
+
<title>XHTML+MathMLの例</title>
|
12
|
+
</head>
|
13
|
+
<body>
|
14
|
+
<p>XHTML+MathMLの例だよ。</p>
|
15
|
+
<p>
|
16
|
+
質量<math display='inline' xmlns='http://www.w3.org/1998/Math/MathML'><mi>m</mi></math>は
|
17
|
+
エネルギー<math display='inline' xmlns='http://www.w3.org/1998/Math/MathML'><mi>E</mi></math>に
|
18
|
+
<math display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
|
19
|
+
<mi>E</mi>
|
20
|
+
<mo>=</mo>
|
21
|
+
<mi>m</mi>
|
22
|
+
<msup>
|
23
|
+
<mi>c</mi>
|
24
|
+
<mn>2</mn>
|
25
|
+
</msup>
|
26
|
+
</math>
|
27
|
+
と転換されるよ。
|
28
|
+
</p>
|
29
|
+
</body>
|
30
|
+
</html>
|
31
|
+
|
32
|
+
=== 留意点
|
33
|
+
* 拡張子は.xhtml
|
34
|
+
* httpサーバからapplication/xhtml+xmlのMIMEタイプで送信される
|
35
|
+
* DTDを使ってvalid XML documentかどうかチェックされる
|
36
|
+
* もちろん well-formed XML document
|
37
|
+
* 文書はhtmlをルート要素(root element=一番の親要素)として記述
|
38
|
+
* このルート要素において、xmlns属性でXHTMLのXML名前空間を指定
|
39
|
+
* ルート要素の前に有効な文書型宣言を行なう
|
40
|
+
* 1行目のxml宣言はMUSTではない http://www.spacewalker.jp/webtips/xhtmlviewmode/
|
41
|
+
* 拡張子を.htmlにしてhttpサーバからtext/htmlのMIMEタイプで送信されるようにすればたいていのブラウザが読んでくれるみたい
|
42
|
+
|
43
|
+
=== 参考文献
|
44
|
+
[Kanzaki] http://www.kanzaki.com/docs/html/xhtml1.html
|
45
|
+
|
46
|
+
|
47
|
+
== HTML5
|
48
|
+
=== HTML5の例(数式付き)
|
49
|
+
<!DOCTYPE html>
|
50
|
+
<html>
|
51
|
+
<head>
|
52
|
+
<meta charset=utf-8>
|
53
|
+
<title>HTML5の例</title>
|
54
|
+
</head>
|
55
|
+
<body>
|
56
|
+
<p>HTML5の例だよ。</p>
|
57
|
+
<p>
|
58
|
+
質量<math display='inline'><mi>m</mi></math>は
|
59
|
+
エネルギー<math display='inline'><mi>E</mi></math>に
|
60
|
+
<math display='block'>
|
61
|
+
<mi>E</mi>
|
62
|
+
<mo>=</mo>
|
63
|
+
<mi>m</mi>
|
64
|
+
<msup>
|
65
|
+
<mi>c</mi>
|
66
|
+
<mn>2</mn>
|
67
|
+
</msup>
|
68
|
+
</math>
|
69
|
+
と転換されるよ。
|
70
|
+
</p>
|
71
|
+
</body>
|
72
|
+
</html>
|
73
|
+
|
74
|
+
=== 留意点
|
75
|
+
* 拡張子は.html
|
76
|
+
* httpサーバからtext/htmlのMIMEタイプで送信される
|
77
|
+
|
78
|
+
|
79
|
+
== 疑問点
|
80
|
+
* <hr> or <hr/> ?
|
81
|
+
* MathMLでよく使う<none/>は?
|
82
|
+
|
83
|
+
# Local variables:
|
84
|
+
# mode: rd
|
85
|
+
# compile-command: "rake XHTML-vs-HTML5.ja.html"
|
86
|
+
# End:
|