ULMUL (Ultra Lightweight MarkUp Language)
“ULMUL” is an original Ultra Lightweight MarkUp Language. Using “ulmul2html5” or “ulmul2mathjax” commands, You can convert a ULMUL text with TeX style equations into HTML5 documents with MathML or MathJax, respectively. ULMUL is written in Ruby. You can also use ulmul.rb as a library.
Homepage of ULMUL: t-nissie.users.sourceforge.net/ULMUL/
Ruby Gem: rubygems.org/gems/ulmul
Repository of ULMUL: github.com/t-nissie/ULMUL
Features
* TeX style equations between two dollar marks ($) and between "\Eq:foo" and "/Eq:foo"
will be converted into MathML. Any browsers such as Firefox, Chrome Edge, and Safari can render MathML nowadays.
* ULMUL uses MathML Library https://rubygems.org/gems/math_ml .
* ulmul2html5 output is good with the Slidy presentation environment
https://www.w3.org/Talks/Tools/Slidy/ using Firefox+CSS+XHTML+JavaScript.
Please use ulmul-slidy.js and ulmul-slidy.css in the package.
* Figures, tables and code can be inserted to the document.
They can be easily referred in the text.
* Lines starting from "#" are comments.
* You can add your conversion rules to @subs_rules.
* "Table of Contents" will be automatically generated.
* "= ABC EFGH" will be the document title and the cover page of Slidy.
* Use utf-8 for ULMUL texts.
Specify your natural language with a --language option, e.g. --language=en.
Installation of ULMUL
Please use its gem rubygems.org/gems/ulmul for installation.
$ sudo gem install ulmul
How to write ULMUL texts
The encode of input file must be utf-8.
lines
Inside ulmul.rb, input lines are processed as “events” with aasm library rubygems.org/gems/aasm .
empty
Empty lines divide paragraphs.
heading
Starting with “= ”, “== ”, “=== ”, “==== ”, “===== ”, and “====== ”. “= ” will be used for the title.
asterisk
Lines starting with asterisks become itemizing list. Indent lines by two characters. For example,
# Nesting is allowed up to 4th--5th level.
* First
* Second
* Third
* Fourth
* more for Fourth
second continue
* More for third
* More for first
become # Nesting is allowed up to 4th–5th level.
* First
* Second
* Third
* Fourth
* more for Fourth
second continue
* More for third
* More for first
offset
Lines starting with some spaces but not asterisks become verbatim lines.
end
EOF or “=end” end the process.
ignore
Lines starting with “#” and “=begin” are ignored.
normal
Other lines.
Other rules
* Lines after "=end" are ignored.
* Add your substitution rules to @subs_rules.
Equations
Input:
Mass $m$ can be converted into energy $E$ as
\Eq:Emc2
E=mc^2.
/Eq:Emc2
Output:
Mass $m$ can be converted into energy $E$ as Eq:Emc2
E=mc^2.
/Eq:Emc2
You can refer the equation in a way like “Eq:Einstein”, as Eq:Emc2.
To view the equations in MathML correctly, please use
* Firefox 4 https://mozilla.jp/firefox/
* IE9 https://windows.microsoft.com/en-US/internet-explorer/products/ie/home
* etc.
Figures
Start a Figure environment with “Fig:foo FILENAME.jpg” and terminate it with “/Fig:foo”, where “foo” is a tag for the figure. You can write a figure caption between them. You can refer the figure with “Fig:foo” as Fig:ruby.
Input:
\Fig:ruby ruby.jpg
The is a dummy figure for an example.
Cute red logo of Ruby, isn't it?
You can write equations even in a caption as $ax^2+bx+c=0$.
/Fig:ruby
Output: Fig:ruby ruby.jpg
The is a dummy figure for an example.
Cute red logo of Ruby, isn't it?
You can write equations even in a caption as $ax^2+bx+c=0$.
/Fig:ruby
Tables
Put a GFM-formed table file, benchmark.table for example, outside. Start a Table environment with “Table:bar” and terminate it with “/Table:bar”, where “bar” is a tag for the table. You can write a table caption between them. You can refer the table with “Table:bar”.
Input:
\Table:mercaribenchmark benchmark.table
Benchmark results of a Ruby script mercari.rb and a Crystal code mercari.cr.
For more details, see the gist page of https://gist.github.com/t-nissie/22a4a9525d423208c7f784ce507d0bc5
/Table:mercaribenchmark
Output: Table:mercaribenchmark benchmark.table
Benchmark results of a Ruby script mercari.rb and a Crystal code mercari.cr.
For more details, see the gist page of https://gist.github.com/t-nissie/22a4a9525d423208c7f784ce507d0bc5
/Table:mercaribenchmark
Code
Start a Code environment with “Code:baz FILENAME” and terminate it with “/Code:baz”, where “baz” is a tag for the code. You can write a caption between them. You can refer the code with “Code:baz” as Code:hello. Code will be highlighted with google-code-prettify when -j cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js is given.
Input:
\Code:hello hello.c
Ordinary hello.c.
Can you see stdio.h?
/Code:hello
Output: Code:hello hello.c
Ordinary hello.c.
Can you see stdio.h?
/Code:hello
Usage of ulmul2html5
Examples
$ ulmul2html5 foo.txt > foo.html
$ ulmul2html5 -n 'Takeshi Nishimatsu' -s ulmul-slidy.css -j ulmul-slidy.js presentation.txt > presentation.html
Command options
–help
Show a help message.
-s, –style
Specify stylesheet filename.
-n, –name
Specify your name for copyright notices.
-j, –javascript
Specify JavaScript filename.
-l, –language
Specify natural language. Its default is “en”.
-m, –max-table-of-contents
Maximum depth for the Table of Contents. Its default is 3. If you do not need the Table of Contents, specify 1.
ULMUL and Slidy examples
* https://loto.sourceforge.net/feram/
* Its source is https://loto.sourceforge.net/feram/README
* https://loto.sourceforge.net/feram/doc/film.xhtml
* It is a Slidy presentation made from https://loto.sourceforge.net/feram/doc/film.txt
* https://t-nissie.users.sourceforge.net/ULMUL/index.en.html
* Its source is https://t-nissie.users.sourceforge.net/ULMUL/README-en (this document)
Usage of ulmul2mathjax
It uses MathJax www.mathjax.org/ to show equations.
$ ulmul2mathjax --help
$ ulmul2mathjax -s ulmul2html5.css -j https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js \
-j 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default' README-en > README-en-mathjax.html
Usage of ulmul2latex
$ ulmul2latex --help
$ ulmul2latex test.ulmul | tee test.tex
$ latex test.tex
$ latex test.tex
$ dvipdfmx test.dvi
ulmul2latex is still under development. Sorry.
TODO
* More useful error for syntax errors.
* Unit test, tests/ulmul_test.rb
* @body should be XML object, not a String.
* Citation.
For more, see TODO file.
Repository in GitHub
You can clone the source tree of ULMUL from GitHub with git(1) command:
$ git clone https://github.com/t-nissie/ULMUL.git ulmul
Copying
Copyright © 2008,2009,2010,2011,2012,2013,2014,2015,2017,2022,2024,2025,2026 by Takeshi Nishimatsu
ulmul.rb is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. You can copy, modify and redistribute ulmul.rb, but only under the conditions described in the GNU General Public License (the “GPL”).
W3C has copyrights for ulmul-slidy.js and ulmul-slidy.css. Their original names were slidy.js and slidy.css, respectively. Takeshi Nishimatsu slightly modified them. You can download the original package, slidy.zip, from www.w3.org/Talks/Tools/Slidy/ . You can find their licenses at www.w3.org/Consortium/Legal/copyright-documents and www.w3.org/Consortium/Legal/copyright-software .
Author of ULMUL
Takeshi Nishimatsu (t_nissieatyahoo.co.jp) t-nissie.users.sourceforge.net/
# Local variables: # mode: rd # compile-command: “rake index.en.html” # End: