Author: mnodine Date: 2006-11-07 20:07:13 +0100 (Tue, 07 Nov 2006) New Revision: 4799 Added: trunk/prest/doc/src/ascii-mathml.xrst trunk/prest/t/60_new/directives.init/Dir.mak trunk/prest/t/60_new/directives.init/Text/ trunk/prest/t/60_new/directives.init/Text/ASCIIMathML.pm trunk/prest/t/60_new/directives.init/mathml01.dom trunk/prest/t/60_new/directives.init/mathml01.rst trunk/prest/t/60_new/directives.init/mathml01.skip.pl trunk/prest/t/60_new/directives.init/mathml02.dom trunk/prest/t/60_new/directives.init/mathml02.rst trunk/prest/t/60_new/directives.init/mathml02.skip.pl trunk/prest/t/60_new/directives.init/mathml03.dom trunk/prest/t/60_new/directives.init/mathml03.rst trunk/prest/t/60_new/directives.init/mathml03.skip.pl trunk/prest/t/60_new/directives.init/mathml04.dom trunk/prest/t/60_new/directives.init/mathml04.rst trunk/prest/t/60_new/directives.init/mathml05.dom trunk/prest/t/60_new/directives.init/mathml05.rst trunk/prest/t/60_new/directives.init/mathml06.dom trunk/prest/t/60_new/directives.init/mathml06.rst trunk/prest/t/60_new/directives.init/mathml07.dom trunk/prest/t/60_new/directives.init/mathml07.rst trunk/prest/t/60_new/directives.init/roles1.dom trunk/prest/t/60_new/directives.init/roles1.rst trunk/prest/t/60_new/roles.init/ trunk/prest/t/60_new/roles.init/Dir.mak trunk/prest/t/60_new/roles.init/mathml01.dom trunk/prest/t/60_new/roles.init/mathml01.rst trunk/prest/t/60_new/roles.init/mathml02.dom trunk/prest/t/60_new/roles.init/mathml02.rst trunk/prest/t/60_new/roles.init/skip.pl trunk/prest/t/80_misc/coverage.init/Text/ASCIIMathML.pm trunk/prest/t/80_misc/coverage.init/mathml01.dom trunk/prest/t/80_misc/coverage.init/mathml01.rst trunk/prest/t/80_misc/directive.init/raw_01.r Removed: trunk/prest/t/60_new/parse.init/roles1.dom trunk/prest/t/60_new/parse.init/roles1.rst Modified: trunk/prest/MANIFEST trunk/prest/Makefile.PL trunk/prest/doc/src/Makefile trunk/prest/doc/src/directives.rst trunk/prest/doc/src/roles.rst trunk/prest/lib/Text/Restructured.pm trunk/prest/lib/Text/Restructured/Directive/code_block.pm trunk/prest/lib/Text/Restructured/Writer/dom.wrt trunk/prest/lib/Text/Restructured/Writer/html.wrt trunk/prest/lib/Text/Restructured/Writer/latex.wrt trunk/prest/lib/Text/Restructured/Writer/xml.wrt trunk/prest/t/60_new/parse.init/tabs1.rst trunk/prest/t/60_new/parse.init/tabs2.rst trunk/prest/t/80_misc/cmdline.init/opt_d.dom trunk/prest/t/80_misc/cmdline.init/opt_dx2.dom trunk/prest/t/80_misc/cmdline.init/opt_dx3.dom trunk/prest/t/80_misc/coverage.init/Dir.mak trunk/prest/tbin/redom Log: Added support for ascii-mathml role and directive to produce mathml markup. The mathml markup is only supported in the dom and html writers for now. Modified: trunk/prest/MANIFEST =================================================================== --- trunk/prest/MANIFEST 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/MANIFEST 2006-11-07 19:07:13 UTC (rev 4799) @@ -1,5 +1,6 @@ COPYING.txt doc/src/alternatives.rst +doc/src/ascii-mathml.xrst doc/src/directives.rst doc/src/introduction.rst doc/src/latest/directives.html @@ -237,12 +238,33 @@ t/40_writers/xref.init/xref06.stderr t/40_writers/xref.init/xref06.xref t/40_writers/xref.init/xreftest.rst +t/60_new/directives.init/Dir.mak +t/60_new/directives.init/mathml01.dom +t/60_new/directives.init/mathml01.rst +t/60_new/directives.init/mathml01.skip.pl +t/60_new/directives.init/mathml02.dom +t/60_new/directives.init/mathml02.rst +t/60_new/directives.init/mathml02.skip.pl +t/60_new/directives.init/mathml03.dom +t/60_new/directives.init/mathml03.rst +t/60_new/directives.init/mathml03.skip.pl +t/60_new/directives.init/mathml04.dom +t/60_new/directives.init/mathml04.rst +t/60_new/directives.init/mathml05.dom +t/60_new/directives.init/mathml05.rst +t/60_new/directives.init/mathml06.dom +t/60_new/directives.init/mathml06.rst +t/60_new/directives.init/mathml07.dom +t/60_new/directives.init/mathml07.rst +t/60_new/directives.init/roles1.dom +t/60_new/directives.init/roles1.rst t/60_new/directives.init/tables01.dom t/60_new/directives.init/tables01.rst t/60_new/directives.init/tables02.dom t/60_new/directives.init/tables02.rst t/60_new/directives.init/tables03.dom t/60_new/directives.init/tables03.rst +t/60_new/directives.init/Text/ASCIIMathML.pm t/60_new/html.init/Dir.mak t/60_new/html.init/entryattr.myhtml t/60_new/html.init/entryattr.rst @@ -257,8 +279,6 @@ t/60_new/parse.init/keeptitle.rst t/60_new/parse.init/nestinline.dom t/60_new/parse.init/nestinline.rst -t/60_new/parse.init/roles1.dom -t/60_new/parse.init/roles1.rst t/60_new/parse.init/tables01.dom t/60_new/parse.init/tables01.rst t/60_new/parse.init/tables02.dom @@ -271,6 +291,12 @@ t/60_new/parse.init/tabs1.rst t/60_new/parse.init/tabs2.dom t/60_new/parse.init/tabs2.rst +t/60_new/roles.init/Dir.mak +t/60_new/roles.init/mathml01.dom +t/60_new/roles.init/mathml01.rst +t/60_new/roles.init/mathml02.dom +t/60_new/roles.init/mathml02.rst +t/60_new/roles.init/skip.pl t/70_plugins/code_block.init/code01.dom t/70_plugins/code_block.init/code01.rst t/70_plugins/code_block.init/code02.dom @@ -447,6 +473,7 @@ t/80_misc/cmdline.init/opt_h.rst t/80_misc/cmdline.init/opt_V.domre t/80_misc/cmdline.init/opt_V.rst +t/80_misc/cmdline.init/Text/Restructured/Writer/dom.wrt t/80_misc/coverage.init/baddirect.dom t/80_misc/coverage.init/baddirect.r t/80_misc/coverage.init/baddirect.rst @@ -470,6 +497,8 @@ t/80_misc/coverage.init/html.stderr t/80_misc/coverage.init/indtarget.dom t/80_misc/coverage.init/indtarget.rst +t/80_misc/coverage.init/mathml01.dom +t/80_misc/coverage.init/mathml01.rst t/80_misc/coverage.init/nowrt.dom t/80_misc/coverage.init/nowrt.rst t/80_misc/coverage.init/nowrt.stderr @@ -480,6 +509,7 @@ t/80_misc/coverage.init/pending.stderr t/80_misc/coverage.init/restructured.domc t/80_misc/coverage.init/restructured.rst +t/80_misc/coverage.init/Text/ASCIIMathML.pm t/80_misc/coverage.init/Text/Restructured/Directive/baddirective.pm t/80_misc/coverage.init/Text/Restructured/Directive/baddirective2.pm t/80_misc/coverage.init/Text/Restructured/PrestConfig.pm @@ -557,6 +587,7 @@ t/80_misc/directive.init/parsed_literal_04.dom t/80_misc/directive.init/parsed_literal_04.rst t/80_misc/directive.init/raw_01.dom +t/80_misc/directive.init/raw_01.r t/80_misc/directive.init/raw_01.rst t/80_misc/directive.init/raw_02.dom t/80_misc/directive.init/raw_02.rst Modified: trunk/prest/Makefile.PL =================================================================== --- trunk/prest/Makefile.PL 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/Makefile.PL 2006-11-07 19:07:13 UTC (rev 4799) @@ -13,7 +13,7 @@ ## Note: The version number for the entire release is specified here and ## propagated. Be sure to edit for every release. -my $Version = "0.003018"; +my $Version = "0.003019"; use vars qw($opt_f $opt_h $opt_k); my $OUTPUT_CFG_FILE = $opt_f = 'config.log'; @@ -246,6 +246,7 @@ # Substitute in for ${perlvar} references $generic_t =~ s/(\$ \{ [^\}]+ \})/eval $1/gex; +my @TESTS; my @generic_t_dirs = grep -d $_, <t/*>; # Create generic .t files foreach my $dir (@generic_t_dirs) { @@ -256,6 +257,7 @@ open T, ">$dir/$t"; print T $generic_t; close T; + push @TESTS, "$dir/$t"; } } @@ -278,15 +280,17 @@ EXE_FILES => [qw(prest)], MAN1PODS => {}, MAN3PODS => {}, - PREREQ_PM => {}, # e.g., Module::Name => 1.1 + PREREQ_PM => { 'Text::ASCIIMathML'=>0 }, # e.g., Module::Name => 1.1 PL_FILES => {'lib/Text/Restructured/PrestConfig.pm.PL' => "lib/Text/Restructured/PrestConfig.pm"}, PM => {'lib/Text/Restructured/PrestConfig.pm' => 'blib/lib/Text/Restructured/PrestConfig.pm', %pm_files}, # FIXIN => 'cp', - test => { TESTS => q($(shell find t -name '*.t' -type f)) }, - clean => { FILES => q[$(TEST_FILES) $(TEST_FILES:.t=.dir) t/Common.mk lib/Text/Restructured/PrestConfig.pm] }, + test => { TESTS => join ' ',@TESTS }, + clean => { FILES =>(join(' ', (@TESTS, map(/(.*)\.t$/ && "$1.dir", + @TESTS))) . + q[ t/Common.mk lib/Text/Restructured/PrestConfig.pm]) }, dist => { COMPRESS => 'gzip', SUFFIX => '.gz' }, realclean => { FILES => q(config.log config.log.bak) }, ); Modified: trunk/prest/doc/src/Makefile =================================================================== --- trunk/prest/doc/src/Makefile 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/doc/src/Makefile 2006-11-07 19:07:13 UTC (rev 4799) @@ -5,8 +5,10 @@ DIFFRE_DIR = ../../tbin RSTS := $(wildcard *.rst) +XRSTS := $(wildcard *.xrst) HTMLS := $(wildcard *.html) DEST_HTMLS = $(addprefix $(DEST_DIR)/,$(RSTS:.rst=.html)) +DEST_XHTMLS = $(addprefix $(DEST_DIR)/,$(XRSTS:.rst=.html)) OTHER_TARGETS = $(addprefix $(DEST_DIR)/,index.html quickref.html) LATEST_HTMLS := $(notdir $(wildcard latest/*.html)) DIFF_TARGETS = $(addprefix $(DEST_DIR)/,$(LATEST_HTMLS:.html=_diff.html)) @@ -34,6 +36,7 @@ PREST_FLAGS_prest_usage = -D trusted PREST_FLAGS_prest_internals = -D trusted PREST_FLAGS_prest_extend = -D trusted +PREST_FLAGS_ascii-mathml = -D mstyle='mathcolor=red' targets: $(DEST_DIR) $(DEST_HTMLS) $(OTHER_TARGETS) $(DIFF_TARGETS) @@ -55,6 +58,10 @@ $(PREST_CMD) $(HTML_FLAGS) $(PREST_FLAGS_$(notdir $*)) -- - > $@ -chmod 664 $@ +$(DEST_DIR)/%.xhtml: %.xrst $(PREST_SRC) $(HTML_WRITER) + $(PREST_CMD) $(HTML_FLAGS) $(PREST_FLAGS_$(notdir $*)) $< > $@ + -chmod 664 $@ + $(DEST_DIR)/%_diff.html: $(DEST_DIR)/%.html latest/%.html $(HTMLDIFF) $(HTMLDIFF_CMD) latest/$*.html $(DEST_DIR)/$*.html > $@ -chmod 664 $@ Added: trunk/prest/doc/src/ascii-mathml.xrst =================================================================== --- trunk/prest/doc/src/ascii-mathml.xrst 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/doc/src/ascii-mathml.xrst 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,406 @@ +=========================== + Markup Using ASCIIMathML +=========================== +:Author: Mark Nodine +:Contact: mn...@al... +:Revision: $Revision: 762 $ +:Date: $Date: 2006-01-27 11:47:47 -0600 (Fri, 27 Jan 2006) $ +:Copyright: This document has been placed in the public domain. + +.. |amml| replace:: ASCIIMathML +.. contents:: + +This document describes the |amml| input notation for producing +mathml markup to represent mathematical formulas. |amml| was designed +by Peter Jipsen of Chapman University, who did a Javascript +implementation which you can find at the `ASCIIMathML web page`_. +In order to use this feature of prest, your perl installation will +have to include Text::ASCIIMathML, which is available on CPAN. + +.. _ASCIIMathML web page: http://www1.chapman.edu/~jipsen/mathml/asciimath.html + +ASCIIMathML markup +================== + +The syntax is very permissive and does not generate syntax +errors. This allows mathematically incorrect expressions to be +displayed, which is important for teaching purposes. It also causes +less frustration when previewing formulas. + +.. default-role:: mathml + +If you encode ``x^2`` or ``a_(mn)`` or ``a_{mn}`` or ``(x+1)/y`` or +``sqrtx``, you pretty much get what you expect, namely `x^2` or +`a_(mn)` or `a_{mn}` or `(x+1)/y` or `sqrtx`. The choice of grouping +parenthesis is up to you (they don't have to match either). If the +displayed expression can be parsed uniquely without them, they are +omitted. Most LaTeX commands are also supported, so the last two +formulas above can also be written as ``\frac{x+1}{y}`` and +``\sqrt{x}``. + +The parser uses no operator precedence and only respects the grouping +brackets, subscripts, superscript, fractions and (square) roots. This +is done for reasons of efficiency and generality. The resulting MathML +code can quite easily be processed further to ensure additional +syntactic requirements of any particular application. + +The grammar +----------- + +Here is a definition of the grammar used to parse +ASCIIMathML expressions. In the Backus-Naur form given below, the +letter on the left of the ``::=`` represents a category of symbols that +could be one of the possible sequences of symbols listed on the right. +The vertical bar ``|`` separates the alternatives. :: + + c ::= [A-z] | numbers | greek letters | other constant symbols + (see below) + u ::= 'sqrt' | 'text' | 'bb' | other unary symbols for font commands + b ::= 'frac' | 'root' | 'stackrel' | 'newcommand' | 'newsymbol' + binary symbols + l ::= ( | [ | { | (: | {: left brackets + r ::= ) | ] | } | :) | :} right brackets + S ::= c | lEr | uS | bSS | "any" simple expression + E ::= SE | S/S |S_S | S^S | S_S^S expression (fraction, sub-, + super-, subsuperscript) + +The translation rules +--------------------- + +Each terminal symbol is translated into a corresponding MathML +node. The constants are mostly converted to their respective Unicode +symbols. The other expressions are converted as follows:: + + lSr -> <mrow>lSr</mrow> + (note that any pair of brackets can be used to + delimit subexpressions, they don't have to match) + sqrt S -> <msqrt>S'</msqrt> + text S -> <mtext>S'</mtext> + "any" -> <mtext>any</mtext> + frac S1 S2 -> <mfrac>S1' S2'</mfrac> + root S1 S2 -> <mroot>S2' S1'</mroot> + stackrel S1 S2 -> <mover>S2' S1'</mover> + S1/S2 -> <mfrac>S1' S2'</mfrac> + S1_S2 -> <msub>S1 S2'</msub> + S1^S2 -> <msup>S1 S2'</msup> + S1_S2^S3 -> <msubsup>S1 S2' S3'</msubsup> or + <munderover>S1 S2' S3'</munderover> (in some cases) + +In the rules above, the expression ``S'`` is the same as ``S``, except that if +``S`` has an outer level of brackets, then ``S'`` is the expression inside +these brackets. + +Matrices +-------- + +A simple syntax for matrices is also recognized:: + + l(S11,...,S1n),(...),(Sm1,...,Smn)r + +or :: + + l[S11,...,S1n],[...],[Sm1,...,Smn]r. + +Here ``l`` and ``r`` stand for any of the left and right +brackets (just like in the grammar they do not have to match). Both of +these expressions are translated to :: + + <mrow>l<mtable><mtr><mtd>S11</mtd>... + <mtd>S1n</mtd></mtr>... + <mtr><mtd>Sm1</mtd>... + <mtd>Smn</mtd></mtr></mtable>r</mrow>. + +Note that each row must have the same number of expressions, and there +should be at least two rows. + +LaTeX matrix commands are not recognized. + +Tokenization +------------ + +The input formula is broken into tokens using a "longest matching +initial substring search". Suppose the input formula has been +processed from left to right up to a fixed position. The longest +string from the list of constants (given below) that matches the +initial part of the remainder of the formula is the next token. If +there is no matching string, then the first character of the remainder +is the next token. The symbol table at the top of the ASCIIMathML.js +script specifies whether a symbol is a math operator (surrounded by a +``<mo>`` tag) or a math identifier (surrounded by a ``<mi>`` +tag). For single character tokens, letters are treated as math +identifiers, and non-alphanumeric characters are treated as math +operators. For digits, see "Numbers" below. + +Spaces are significant when they separate characters and thus prevent +a certain string of characters from matching one of the +constants. Multiple spaces and end-of-line characters are equivalent +to a single space. + +Numbers +------- + +A string of digits, optionally followed by a decimal point (a period) +and another string of digits, is parsed as a single token and +converted to a MathML number, i.e., enclosed with the ``<mn>`` tag. + +Greek letters +------------- + +* Lowercase letters + + ``alpha`` ``beta`` ``chi`` ``delta`` ``epsilon`` ``eta`` ``gamma`` ``iota`` + ``kappa`` ``lambda`` ``mu`` ``nu`` ``omega`` ``phi`` ``pi`` ``psi`` ``rho`` + ``sigma`` ``tau`` ``theta`` ``upsilon`` ``xi`` ``zeta`` + +* Uppercase letters + + ``Delta`` ``Gamma`` ``Lambda`` ``Omega`` ``Phi`` ``Pi`` ``Psi`` ``Sigma`` + ``Theta`` ``Xi`` + +* Variants + + ``varepsilon`` ``varphi`` ``vartheta`` + + +Standard functions +------------------ + +``sin`` ``cos`` ``tan`` ``csc`` ``sec`` ``cot`` ``sinh`` ``cosh`` +``tanh`` ``log`` ``ln`` ``det`` ``dim`` ``lim`` ``mod`` ``gcd`` +``lcm`` ``min`` ``max`` + +Operation symbols +----------------- + +.. mathml:: newcommand "bs" "\\" + +======== ============================================= ============== ======= +Type Description Entity MathML +======== ============================================= ============== ======= +``+`` ``+`` ``+`` `+` +``-`` ``-`` ``-`` `-` +``*`` Mid dot ⋅ `*` +``**`` Star ⋆ `**` +``//`` ``/`` ``/`` `//` +``\\`` ``\`` ``\`` `bs` +``xx`` Cross product × `xx` +``-:`` Divided by ÷ `-:` +``@`` Compose functions ∘ `@` +``o+`` Circle with plus ⊕ `o+` +``ox`` Circle with x ⊗ `ox` +``o.`` Circle with dot ⊙ `o.` +``sum`` Sum for sub- and superscript ∑ `sum` +``prod`` Product for sub- and superscript ∏ `prod` +``^^`` Logic "and" ∧ `^^` +``^^^`` Logic "and" for sub- and superscript ⋀ `^^^` +``vv`` Logic "or" ∨ `vv` +``vvv`` Logic "or" for sub- and superscript ⋁ `vvv` +``nn`` Logic "intersect" ∩ `nn` +``nnn`` Logic "intersect" for sub- and superscript ⋂ `nnn` +``uu`` Logic "union" ∪ `uu` +``uuu`` Logic "union" for sub- and superscript ⋃ `uuu` +======== ============================================= ============== ======= + +Relation symbols +---------------- + +======== ============================================= ============== ======= +Type Description Entity MathML +======== ============================================= ============== ======= +``=`` ``=`` = `=` +``!=`` Not equals ≠ `!=` +``<`` ``<`` < `<` +``>`` ``>`` > `>` +``<=`` Less than or equal ≤ `<=` +``>=`` Greater than or equal ≥ `>=` +``-lt`` Precedes ≺ `-lt` +``>-`` Succeeds ≻ `>-` +``in`` Element of ∈ `in` +``!in`` Not an element of ∉ `!in` +``sub`` Subset ⊂ `sub` +``sup`` Superset ⊃ `sup` +``sube`` Subset or equal ⊆ `sube` +``supe`` Superset or equal ⊇ `supe` +``-=`` Equivalent ≡ `-=` +``~=`` Congruent to ≅ `~=` +``~~`` Asymptotically equal to ≈ `~~` +``prop`` Proportional to ∝ `prop` +======== ============================================= ============== ======= + +Logical symbols +--------------- + +======== ============================================= ================ ======= +Type Description Entity MathML +======== ============================================= ================ ======= +``and`` And " and " `and` +``or`` Or " or " `or` +``not`` Not ¬ `not` +``=>`` Implies ⇒ `=>` +``if`` If " if " `if` +``iff`` If and only if ⇔ `iff` +``AA`` For all ∀ `AA` +``EE`` There exists ∃ `EE` +``_|_`` Perpendicular, bottom ⊥ `_|_` +``TT`` Top ⊤ `TT` +``|--`` Right tee ⊢ `|--` +``|==`` Double right tee ⊨ `|==` +======== ============================================= ================ ======= + +Grouping brackets +----------------- + +======== ============================================= ============== ======= +Type Description Entity MathML +======== ============================================= ============== ======= +``(`` ``(`` ``(`` `(` +``)`` ``)`` ``)`` `)` +``[`` ``[`` ``[`` `[` +``]`` ``]`` ``]`` `]` +``{`` ``{`` ``{`` `{` +``}`` ``}`` ``}`` `}` +``(:`` Left angle bracket ⟨ `(:` +``:)`` Right angle bracket ⟩ `:)` +``{:`` Invisible left grouping element +``:}`` Invisible right grouping element +======== ============================================= ============== ======= + +Miscellaneous symbols +--------------------- + +=========== ====================================== ================== ======= +Type Description Entity MathML +=========== ====================================== ================== ======= +``int`` Integral ∫ `int` +``oint`` Countour integral ∮ `oint` +``del`` Partial derivative &del; `del` +``grad`` Gradient ∇ `grad` +``+-`` Plus or minus ± `+-` +``O/`` Null set ∅ `O/` +``oo`` Infinity ∞ `oo` +``aleph`` Hebrew letter aleph ℵ `aleph` +``/_`` Angle ∠ `/_` +``:.`` Therefore ∴ `:.` +``...`` Ellipsis ... `...` +``cdots`` Three centered dots ⋯ `cdots` +``\<sp>`` Non-breaking space (<sp> means space) `|\ |` +``quad`` Quad space `|quad|` +``diamond`` Diamond ⋄ `diamond` +``square`` Square □ `square` +``|__`` Left floor ⌊ `|__` +``__|`` Right floor ⌋ `__|` +``|~`` Left ceiling ⌈ `|~` +``~|`` Right ceiling ⌉ `~|` +``CC`` Complex numbers ℂ `CC` +``NN`` Natural numbers ℕ `NN` +``QQ`` Rational numbers ℚ `QQ` +``RR`` Real numbers ℝ `RR` +``ZZ`` Integers ℤ `ZZ` +=========== ====================================== ================== ======= + +Arrows +------ + +======== ============================================= ============== ======= +Type Description Entity MathML +======== ============================================= ============== ======= +``uarr`` Up arrow ↑ `uarr` +``darr`` Down arrow ↓ `darr` +``rarr`` Right arrow → `rarr` +``->`` Right arrow → `->` +``larr`` Left arrow ← `larr` +``harr`` Horizontal (two-way) arrow ↔ `harr` +``rArr`` Right double arrow ⇒ `rArr` +``lArr`` Left double arrow ⇐ `lArr` +``hArr`` Horizontal double arrow ⇔ `hArr` +======== ============================================= ============== ======= + +Accents +------- + +========== =================== ======== +Type Description MathML +========== =================== ======== +``hat x`` Hat over x `hat x` +``bar x`` Bar over x `bar x` +``ul x`` Underbar under x `ul x` +``vec x`` Right arrow over x `vec x` +``dot x`` Dot over x `dot x` +``ddot x`` Double dot over x `ddot x` +========== =================== ======== + +Font commands +------------- + +========== ======================== ======== +Type Description MathML +========== ======================== ======== +``bb A`` Bold A `bb A` +``bbb A`` Double-struck A `bbb A` +``cc A`` Calligraphic (script) A `cc A` +``tt A`` Teletype (monospace) A `tt A` +``fr A`` Fraktur A `fr A` +``sf A`` Sans-serif A `sf A` +========== ======================== ======== + +Defining new commands and symbols +--------------------------------- + +It is possible to define new commands and symbols using the +``newcommand`` and ``newsymbol`` binary operators. The former defines a +macro that gets expanded and reparsed as ASCIIMathML and the latter +defines a constant that gets used as a math operator (``<mo>``) +element. Both of the arguments must be text, optionally enclosed in +grouping operators. + +.. mathml:: newcommand "DDX" "{:d/dx:}" +.. mathml:: newsymbol{"!le"}{"≰"} + +For example, ``newcommand "DDX" "{:d/dx:}"`` would define a new +command ``DDX``. It could then be invoked like ``DDXf(x)``, which +would expand to ``{:d/dx:}f(x)`` and appear `DDXf(x)`. The text +``newsymbol{"!le"}{"≰"}`` could be used to create a symbol you +could invoke with ``!le``, as in ``a !le b``, which appears `a !le b`. + + +Attributes for mstyle +===================== + +For point of reference, this document was compiled with ``-D +mstyle='mathcolor=red'``. + +* ``displaystyle`` + + The displaystyle attribute for the element, if specified. One of the + values "true" or "false". If the displaystyle is false, then fractions + are represented with a smaller font size and the placement of + subscripts and superscripts of sums and integrals changes. + +* ``mathvariant`` + + The mathvariant attribute for the element, if specified. One of the + values "normal", "bold", "italic", "bold-italic", "double-struck", + "bold-fraktur", "script", "bold-script", "fraktur", "sans-serif", + "bold-sans-serif", "sans-serif-italic", "sans-serif-bold-italic", or + "monospace". + +* ``mathsize`` + + The mathsize attribute for the element, if specified. Either "small", + "normal" or "big", or of the form "number v-unit". + +* ``mathfamily`` + + A string representing the font family. + +* ``mathcolor`` + + The mathcolor attribute for the element, if specified. It be in one of + the forms "#rgb" or "#rrggbb", or should be an html-color-name. + +* ``mathbackground`` + + The mathbackground attribute for the element, if specified. It should + be in one of the forms "#rgb" or "#rrggbb", or an html-color-name, or + the keyword "transparent". + Modified: trunk/prest/doc/src/directives.rst =================================================================== --- trunk/prest/doc/src/directives.rst 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/doc/src/directives.rst 2006-11-07 19:07:13 UTC (rev 4799) @@ -564,7 +564,42 @@ Set a "classes" attribute value on the compound element. See the class_ directive below. +.. _mathml: +.. _ascii-mathml: +Mathematical Equations +====================== + +:Directive Type: "ascii-mathml", "mathml" +:Doctree Element: mathml +:Directive Arguments: Possible. +:Directive Options: Possible. +:Directive Content: Possible. + +This directive is used to create mathematical markup from `ASCIIMathML`_. +Unlike the ``mathml`` and ``ascii-mathml`` roles, which produce +inline-style mathematical markup, the directive produces display-style +markup unless it is used in a substitution definition, in which case +it also defaults to inline-style markup. However, the style can be +overridden by means of the directive options. + +.. _AsciiMathML: ascii-mathml.xhtml + +The following option is recognized: + +``mstyle`` : field list text + The field list gives a set of key/value pairs for the `mstyle + attribute`_ of the generated mathml markup. For example, the + following directive would not use display style and would have the + math equation in green:: + + .. ascii-mathml:: E = mc^2 + :mstyle: + :displaystyle: false + :mathcolor: green + +.. _mstyle attribute: ascii-mathml.xhtml#attributes-for-mstyle + -------- Tables -------- Modified: trunk/prest/doc/src/roles.rst =================================================================== --- trunk/prest/doc/src/roles.rst 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/doc/src/roles.rst 2006-11-07 19:07:13 UTC (rev 4799) @@ -308,3 +308,23 @@ ``format`` : text One or more space-separated output format names (Writer names). + +``ascii-mathml`` +================ + +:Aliases: ``:mathml:`` +:DTD Element: mathml +:Customization: + :Options: class_, format + :Content: None + +The ``ascii-mathml`` role is used to provide markup for mathematical +notation. It is currently supported only by the latex writer. See +the `ascii-mathml`_ document for further details. + +.. note:: In order for at least some browsers (e.g. Firefox) to render + mathml markup, the file must be saved with an extension of ``.xhtml`` + or ``.xml``; the markup is not processed for files with extension + ``.html`` or ``.htm``. + +.. ascii-mathml:: ascii-mathml.xhtml Modified: trunk/prest/lib/Text/Restructured/Directive/code_block.pm =================================================================== --- trunk/prest/lib/Text/Restructured/Directive/code_block.pm 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/lib/Text/Restructured/Directive/code_block.pm 2006-11-07 19:07:13 UTC (rev 4799) @@ -89,7 +89,6 @@ qq(Cannot have both :file: option and content.), $lit) if $options->{file} && $content !~ /^$/; - $ENV{PATH} = ""; my ($states_bin) = grep -x "$_/states", qw(/bin /usr/bin /usr/local/bin); my $subdir = 'Text/Restructured/Directive'; Modified: trunk/prest/lib/Text/Restructured/Writer/dom.wrt =================================================================== --- trunk/prest/lib/Text/Restructured/Writer/dom.wrt 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/lib/Text/Restructured/Writer/dom.wrt 2006-11-07 19:07:13 UTC (rev 4799) @@ -41,6 +41,11 @@ return $text; } + sub mathml { + my ($dom, $str) = @_; + return $dom->{attr}{mathml} ? $dom->{attr}{mathml}->text . "\n" : $str; + } + sub .* = { my ($dom, $str, $writer) = @_; # Devel::Cover condition 0 0 $str should always be defined Modified: trunk/prest/lib/Text/Restructured/Writer/html.wrt =================================================================== --- trunk/prest/lib/Text/Restructured/Writer/html.wrt 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/lib/Text/Restructured/Writer/html.wrt 2006-11-07 19:07:13 UTC (rev 4799) @@ -87,7 +87,7 @@ # Run-time globals use vars qw($HAS_CONTENTS $TARGET_FRAME $FOOTER $HEADER @HEAD_INFO - %USED_DEFAULT); + %USED_DEFAULT $DOCTYPE); # Defaults for -W flags $attribution = 'dash' unless defined $attribution; @@ -110,6 +110,13 @@ $link_target = "''" unless defined $link_target; $option_limit = 14 unless defined $option_limit; $target_tag = "a" unless defined $target_tag; + + $DOCTYPE = $html_prolog ? << "EOPROLOG1" : << "EOPROLOG2" ; +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +EOPROLOG1 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +EOPROLOG2 + ; } # Creates a default HTML string @@ -553,6 +560,19 @@ return; } + sub mathml = { # PREPROCESS + my ($dom, $str) = @_; + $DOCTYPE = << "EOS" if $dom->{attr}{mathml}; +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" + "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [ + <!ENTITY mathml "http://www.w3.org/1998/Math/MathML"> +]> +EOS + ; + return $dom->{attr}{mathml} ? $dom->{attr}{mathml}->text : $str; + } + + sub .* = { # PREPROCESS my ($dom, $str) = @_; $USED_DEFAULT{$dom->{tag}} = 1; @@ -1145,13 +1165,9 @@ my $doc = [[], []]; # Handle the prolog - my $prolog = $html_prolog ? << "EOPROLOG1" : << "EOPROLOG2" ; -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> -EOPROLOG1 -<?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -EOPROLOG2 - push (@{$doc->[0]}, $prolog); + push @{$doc->[0]}, qq(<?xml version="1.0" encoding="utf-8" ?>\n) + unless $html_prolog; + push @{$doc->[0]}, $DOCTYPE; push (@{$doc->[0]}, qq(<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n)); unshift (@{$doc->[1]}, qq(</html>\n)); Modified: trunk/prest/lib/Text/Restructured/Writer/latex.wrt =================================================================== --- trunk/prest/lib/Text/Restructured/Writer/latex.wrt 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/lib/Text/Restructured/Writer/latex.wrt 2006-11-07 19:07:13 UTC (rev 4799) @@ -130,6 +130,10 @@ @FOOTNOTE_SYMBOLS{@footnote_symbols} = (1 .. @footnote_symbols); } +sub Warn { + print STDERR "$main::opt_w writer: Warning: $_[0]\n"; +} + # This phase marks elements as being contained within footnotes or literals # and computes nesting levels for sections and enumerated_lists. phase MARK = { @@ -1131,9 +1135,5 @@ Warn("no handler for tag $dom->{tag}") unless $PRINTED{$dom->{tag}}++; return $str; - - sub Warn { - print STDERR "$main::opt_w writer: Warning: $_[0]\n"; - } } } Modified: trunk/prest/lib/Text/Restructured/Writer/xml.wrt =================================================================== --- trunk/prest/lib/Text/Restructured/Writer/xml.wrt 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/lib/Text/Restructured/Writer/xml.wrt 2006-11-07 19:07:13 UTC (rev 4799) @@ -31,6 +31,11 @@ return $text; } + sub mathml { + my ($dom, $str) = @_; + return $dom->{attr}{mathml} ? $dom->{attr}{mathml}->text . "\n" : $str; + } + sub .* = { my ($dom, $str) = @_; my $attr = defined $dom->{attr} ? Modified: trunk/prest/lib/Text/Restructured.pm =================================================================== --- trunk/prest/lib/Text/Restructured.pm 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/lib/Text/Restructured.pm 2006-11-07 19:07:13 UTC (rev 4799) @@ -29,6 +29,11 @@ containing the directive (which may not be the same as the directory in which trip is invoked, ".". Default is "<.>". +-D mstyle=<comma-separated-attr-val-list> + A comma-separated set of attribute=value pairs to + be used for the <mstyle> elements of MathML + markup. Default is displaystyle=true for + ascii-mathml directive. -D nestinline[=<0|1>] Specify whether to allow nesting of inline markup. There are some limitations, like strong cannot be @@ -182,36 +187,60 @@ list_table=> \&Text::Restructured::Directive::table, restructuredtext_test_directive => \&Text::Restructured::Directive::test_directive, + ascii_mathml + => \&Text::Restructured::Directive::ascii_mathml, + mathml => \&Text::Restructured::Directive::ascii_mathml, ); - %ROLES = (emphasis=>{tag=>'emphasis'}, - strong=>{tag=>'strong'}, - literal=>{tag=>'literal'}, - subscript=>{tag=>'subscript'}, - sub=>{alias=>'subscript'}, + %ROLES = (emphasis =>{tag=>'emphasis'}, + strong =>{tag=>'strong'}, + literal =>{tag=>'literal'}, + subscript =>{tag=>'subscript'}, + sub =>{alias=>'subscript'}, superscript=>{tag=>'superscript'}, - sup=>{alias=>'superscript'}, - ab=>{tag=>'abbreviation'}, - ac=>{tag=>'acronym'}, - inline=>{tag=>'inline'}, - raw=>{tag=>'raw', attr=>{'xml:space'=>'preserve'}, + sup =>{alias=>'superscript'}, + ab =>{tag=>'abbreviation'}, + ac =>{tag=>'acronym'}, + inline =>{tag=>'inline'}, + raw =>{tag=>'raw', attr=>{'xml:space'=>'preserve'}, check=>\&Text::Restructured::Role::raw}, - 'raw-formatting'=>{tag=>'inline'}, - 'pep-reference'=>{alias=>'PEP'}, - PEP=>{tag=>'reference', - attr=>{refuri=>"http://www.python.org/peps/pep-%04d.html"}, - text=>"PEP %s", - check=>\&Text::Restructured::Role::PEP, + 'pep-reference' =>{alias=>'PEP'}, + PEP =>{ + tag =>'reference', + attr =>{refuri=>"http://www.python.org/peps/pep-%04d.html"}, + text =>"PEP %s", + check=>\&Text::Restructured::Role::PEP, }, 'rfc-reference'=>{alias=>'RFC'}, - RFC=>{tag=>'reference', - attr=>{refuri=>"http://www.faqs.org/rfcs/rfc%04d.html"}, - text=>"RFC %s", - check=>\&Text::Restructured::Role::RFC, + RFC =>{ + tag =>'reference', + attr =>{refuri=>"http://www.faqs.org/rfcs/rfc%04d.html"}, + text =>"RFC %s", + check=>\&Text::Restructured::Role::RFC, }, 'title-reference'=>{tag=>'title_reference'}, - title=>{alias=>'title-reference'}, - t=>{alias=>'title-reference'}, + title =>{alias=>'title-reference'}, + t =>{alias=>'title-reference'}, + 'ascii-mathml'=>{alias=>'mathml'}, + mathml =>{ + tag =>'mathml', + attr=>{mathml=>sub { + my ($parser, $attr, $text) = @_; + if (! $parser->{_MathML}) { + eval "use Text::ASCIIMathML"; + $parser->{_MathML} = new Text::ASCIIMathML + unless $@; + } + return $parser->{_MathML} ? + $parser->{_MathML}->TextToMathMLTree + ($text, [title=>$text, xmlns=>"&mathml;"], + [$main::opt_D{mstyle} ? + @{$main::opt_D{mstyle}} : ()]) : + ''; + + }, + 'raw'=>1}, + }, ); *DEFAULT_ROLE = \'title-reference'; #'; @UNITS = (qw(em ex px in cm mm pt pc), ''); @@ -272,6 +301,14 @@ $new_inc =~ s/<inc>/$perl_inc/gi; @INC = split(/:/, $new_inc); delete $main::opt_D{perlpath}; + + # Preprocess the mstyle define + if ($main::opt_D{mstyle} && ref($main::opt_D{mstyle}) ne 'ARRAY') { + my %attr = map((/(\w+)=(.*)/g), split(/\s*,\s*/, + $main::opt_D{mstyle})); + $main::opt_D{mstyle} = [ map(($_,$attr{$_}), sort keys %attr) ] ; + } + $self->{MY_DEFAULT_ROLE} = $DEFAULT_ROLE; $self->{MY_ROLES} = { %ROLES }; $self->{ANONYMOUS_TARGETS} = [ ]; @@ -1326,6 +1363,8 @@ $attr{$attr} = ref($role->{attr}{$attr}) eq 'ARRAY' ? $role->{attr}{$attr} : + ref($role->{attr}{$attr}) eq 'CODE' ? + &{$role->{attr}{$attr}}($self, $attr, $mid): sprintf $role->{attr}{$attr}, $mid; } } @@ -1372,9 +1411,14 @@ $parent->append($dom); $parent->append($suffix) if $suffix; if ($tag =~ /^(literal)$/ && ! $was_interpreted || $implicit || - $tag eq 'raw' || ! $main::opt_D{nestinline}) { + $tag eq 'raw' || + (defined $attr{role} && + $self->{MY_ROLES}{$attr{role}}{attr}{raw}) || + ! $main::opt_D{nestinline}) { $mid = RemoveBackslashes($mid) - if $tag !~ /^(literal|raw)$/; + if $tag !~ /^(literal|raw)$/ && + !(defined $attr{role} && + $self->{MY_ROLES}{$attr{role}}{attr}{raw}); $dom->append($DOM->newPCDATA($mid)) if $mid ne ''; } @@ -2990,8 +3034,6 @@ # Returns: array of DOM objects sub admonition { my($parser, $name, $parent, $source, $lineno, $dtext, $lit) = @_; - my $subst = $parent->{attr}{name} - if $parent->{tag} eq 'substitution_definition'; my $dhash = parse_directive($parser, $dtext, $lit, $source, $lineno); return $dhash if ref($dhash) eq $DOM; @@ -3019,6 +3061,59 @@ return $adm; } +# Built-in handler for ascii-mathml directives. +# Arguments: parser, directive name, parent, source, line number, +# directive text, literal text +# Returns: array of DOM objects +sub ascii_mathml { + my($parser, $name, $parent, $source, $lineno, $dtext, $lit) = @_; + my @optlist = qw(mstyle); + my $dhash = parse_directive($parser, $dtext, $lit, $source, $lineno, + \@optlist); + return $dhash if ref($dhash) eq $DOM; + my($args, $options, $content) = map($dhash->{$_}, + qw(args options content)); + foreach my $optname (qw(mstyle)) { + my $opt = $options->{$optname}; + next unless defined $opt; + my $err = check_fieldlist_option($parser, $name, $optname, $opt, + $opt, $source, $lineno, $lit); + return $err if $err; + } + return Text::Restructured::Directive::system_msg + ($parser, $name, 3, $source, $lineno, + qq(Cannot have both argument and content.), $lit) + if $args !~ /^$/ && $content !~ /^$/; + + my $subst = $parent->{tag} eq 'substitution_definition'; + my $text = "$args$content"; + if (! $parser->{_MathML}) { + eval "use Text::ASCIIMathML"; + $parser->{_MathML} = new Text::ASCIIMathML unless $@; + } + chomp $text; + my $pcdata = $DOM->newPCDATA("$text\n"); + my $math = $parser->{_MathML} ? $DOM->new('mathml') : $pcdata; + if ($parser->{_MathML}) { + my %mstyle = (($subst ? () : (displaystyle=>'true')), + ($options->{mstyle} ? + %{$parser->HashifyFieldList($options->{mstyle})} : + ()), + ); + $math->{attr}{mathml} = $parser->{_MathML}->TextToMathMLTree + ($text, [title=>$text, xmlns=>"&mathml;"], + [($main::opt_D{mstyle} ? + @{$main::opt_D{mstyle}} : ()), %mstyle]); + return if ! defined $math->{attr}{mathml}; + $math->append($pcdata); + } + return $math if $subst; + + my $para = $DOM->new('paragraph'); + $para->append($math); + return $para; +} + # Built-in handler for class directives. # Arguments: parser obj, directive name, parent, source, line number, # directive text, literal text @@ -3959,7 +4054,7 @@ unless ref($heads) eq 'ARRAY'; } } - elsif ($name eq 'list-table') { + else { # elsif ($name eq 'list-table') { $rows = ParseListTable($parser, $content, $source, $content_lineno); return $parser->system_message Added: trunk/prest/t/60_new/directives.init/Dir.mak =================================================================== --- trunk/prest/t/60_new/directives.init/Dir.mak 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/directives.init/Dir.mak 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,3 @@ +PERL_FLAG_mathml07 = -I. + +RST_FLAG_mathml03 = -D mstyle='mathcolor=red,mathbackground=yellow' Added: trunk/prest/t/60_new/directives.init/Text/ASCIIMathML.pm =================================================================== --- trunk/prest/t/60_new/directives.init/Text/ASCIIMathML.pm 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/directives.init/Text/ASCIIMathML.pm 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,3 @@ +# This file doesn't parse as a perl module. + +0; Added: trunk/prest/t/60_new/directives.init/mathml01.dom =================================================================== --- trunk/prest/t/60_new/directives.init/mathml01.dom 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/directives.init/mathml01.dom 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,7 @@ +<document source="test data"> + <paragraph> + <math title="\int_0^16x^3\ dx" xmlns="&mathml;"><mstyle displaystyle="false"><mrow><msubsup><mo>∫</mo><mn>0</mn><mn>16</mn></msubsup></mrow><msup><mi>x</mi><mn>3</mn></msup><mo> </mo><mrow><mi>d</mi><mi>x</mi></mrow></mstyle></math> + <paragraph> + <math title="sum_{k=0}^47k^2" xmlns="&mathml;"><mstyle displaystyle="true" mathcolor="green"><mrow><munderover><mo>∑</mo><mrow><mi>k</mi><mo>=</mo><mn>0</mn></mrow><mn>47</mn></munderover></mrow><msup><mi>k</mi><mn>2</mn></msup></mstyle></math> + <paragraph> + <math title="DDX43981x" xmlns="&mathml;"><mstyle displaystyle="true"><mrow><mfrac><mi>d</mi><mrow><mi>d</mi><mi>x</mi></mrow></mfrac></mrow><mn>43981</mn><mi>x</mi></mstyle></math> Added: trunk/prest/t/60_new/directives.init/mathml01.rst =================================================================== --- trunk/prest/t/60_new/directives.init/mathml01.rst 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/directives.init/mathml01.rst 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,9 @@ +.. ascii-mathml:: \int_0^16x^3\ dx + :mstyle: :displaystyle: false + +.. mathml:: newcommand "DDX" "{:d/dx:}" + +.. mathml:: sum_{k=0}^47k^2 + :mstyle: :mathcolor: green + +.. mathml:: DDX43981x Added: trunk/prest/t/60_new/directives.init/mathml01.skip.pl =================================================================== --- trunk/prest/t/60_new/directives.init/mathml01.skip.pl 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/directives.init/mathml01.skip.pl 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1 @@ +require Text::ASCIIMathML; Added: trunk/prest/t/60_new/directives.init/mathml02.dom =================================================================== --- trunk/prest/t/60_new/directives.init/mathml02.dom 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/directives.init/mathml02.dom 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,5 @@ +<document source="test data"> + <substitution_definition names="int"> + <math title="\int_0^16x^3\ dx" xmlns="&mathml;"><mstyle><mrow><msubsup><mo>∫</mo><mn>0</mn><mn>16</mn></msubsup></mrow><msup><mi>x</mi><mn>3</mn></msup><mo> </mo><mrow><mi>d</mi><mi>x</mi></mrow></mstyle></math> + <substitution_definition names="sum"> + <math title="sum_{k=0}^47k^2" xmlns="&mathml;"><mstyle mathcolor="green"><mrow><munderover><mo>∑</mo><mrow><mi>k</mi><mo>=</mo><mn>0</mn></mrow><mn>47</mn></munderover></mrow><msup><mi>k</mi><mn>2</mn></msup></mstyle></math> Added: trunk/prest/t/60_new/directives.init/mathml02.rst =================================================================== --- trunk/prest/t/60_new/directives.init/mathml02.rst 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/directives.init/mathml02.rst 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,3 @@ +.. |int| ascii-mathml:: \int_0^16x^3\ dx +.. |sum| mathml:: sum_{k=0}^47k^2 + :mstyle: :mathcolor: green Added: trunk/prest/t/60_new/directives.init/mathml02.skip.pl =================================================================== --- trunk/prest/t/60_new/directives.init/mathml02.skip.pl 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/directives.init/mathml02.skip.pl 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1 @@ +require Text::ASCIIMathML; Added: trunk/prest/t/60_new/directives.init/mathml03.dom =================================================================== --- trunk/prest/t/60_new/directives.init/mathml03.dom 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/directives.init/mathml03.dom 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,7 @@ +<document source="test data"> + <paragraph> + <math title="\int_0^16x^3\ dx" xmlns="&mathml;"><mstyle mathbackground="yellow" mathcolor="red" displaystyle="false"><mrow><msubsup><mo>∫</mo><mn>0</mn><mn>16</mn></msubsup></mrow><msup><mi>x</mi><mn>3</mn></msup><mo> </mo><mrow><mi>d</mi><mi>x</mi></mrow></mstyle></math> + <paragraph> + <math title="sum_{k=0}^47k^2" xmlns="&mathml;"><mstyle mathbackground="yellow" mathcolor="green" displaystyle="true"><mrow><munderover><mo>∑</mo><mrow><mi>k</mi><mo>=</mo><mn>0</mn></mrow><mn>47</mn></munderover></mrow><msup><mi>k</mi><mn>2</mn></msup></mstyle></math> + <paragraph> + <math title="DDX43981x" xmlns="&mathml;"><mstyle mathbackground="yellow" mathcolor="red" displaystyle="true"><mrow><mfrac><mi>d</mi><mrow><mi>d</mi><mi>x</mi></mrow></mfrac></mrow><mn>43981</mn><mi>x</mi></mstyle></math> Added: trunk/prest/t/60_new/directives.init/mathml03.rst =================================================================== --- trunk/prest/t/60_new/directives.init/mathml03.rst 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/directives.init/mathml03.rst 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,9 @@ +.. ascii-mathml:: \int_0^16x^3\ dx + :mstyle: :displaystyle: false + +.. mathml:: newcommand "DDX" "{:d/dx:}" + +.. mathml:: sum_{k=0}^47k^2 + :mstyle: :mathcolor: green + +.. mathml:: DDX43981x Added: trunk/prest/t/60_new/directives.init/mathml03.skip.pl =================================================================== --- trunk/prest/t/60_new/directives.init/mathml03.skip.pl 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/directives.init/mathml03.skip.pl 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1 @@ +require Text::ASCIIMathML; Added: trunk/prest/t/60_new/directives.init/mathml04.dom =================================================================== --- trunk/prest/t/60_new/directives.init/mathml04.dom 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/directives.init/mathml04.dom 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,8 @@ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Error in "mathml" directive: + invalid option block. + <literal_block xml:space="preserve"> + .. mathml:: + :: badoption Added: trunk/prest/t/60_new/directives.init/mathml04.rst =================================================================== --- trunk/prest/t/60_new/directives.init/mathml04.rst 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/directives.init/mathml04.rst 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,2 @@ +.. mathml:: + :: badoption Added: trunk/prest/t/60_new/directives.init/mathml05.dom =================================================================== --- trunk/prest/t/60_new/directives.init/mathml05.dom 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/directives.init/mathml05.dom 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,9 @@ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Error in "mathml" directive: + invalid option value: (option: "mstyle"; value: 'badly formatted field list') + invalid literal for fieldlist. + <literal_block xml:space="preserve"> + .. mathml:: + :mstyle: badly formatted field list Added: trunk/prest/t/60_new/directives.init/mathml05.rst =================================================================== --- trunk/prest/t/60_new/directives.init/mathml05.rst 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/directives.init/mathml05.rst 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,2 @@ +.. mathml:: + :mstyle: badly formatted field list Added: trunk/prest/t/60_new/directives.init/mathml06.dom =================================================================== --- trunk/prest/t/60_new/directives.init/mathml06.dom 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/directives.init/mathml06.dom 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,9 @@ +<document source="test data"> + <system_message level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Error in "mathml" directive: + Cannot have both argument and content. + <literal_block xml:space="preserve"> + .. mathml:: argument + + and content Added: trunk/prest/t/60_new/directives.init/mathml06.rst =================================================================== --- trunk/prest/t/60_new/directives.init/mathml06.rst 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/directives.init/mathml06.rst 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,3 @@ +.. mathml:: argument + + and content Added: trunk/prest/t/60_new/directives.init/mathml07.dom =================================================================== --- trunk/prest/t/60_new/directives.init/mathml07.dom 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/directives.init/mathml07.dom 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,3 @@ +<document source="test data"> + <paragraph> + ax^2+bx+c Added: trunk/prest/t/60_new/directives.init/mathml07.rst =================================================================== --- trunk/prest/t/60_new/directives.init/mathml07.rst 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/directives.init/mathml07.rst 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1 @@ +.. mathml:: ax^2+bx+c Copied: trunk/prest/t/60_new/directives.init/roles1.dom (from rev 4730, trunk/prest/t/60_new/parse.init/roles1.dom) Copied: trunk/prest/t/60_new/directives.init/roles1.rst (from rev 4730, trunk/prest/t/60_new/parse.init/roles1.rst) Deleted: trunk/prest/t/60_new/parse.init/roles1.dom Deleted: trunk/prest/t/60_new/parse.init/roles1.rst Modified: trunk/prest/t/60_new/parse.init/tabs1.rst =================================================================== --- trunk/prest/t/60_new/parse.init/tabs1.rst 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/parse.init/tabs1.rst 2006-11-07 19:07:13 UTC (rev 4799) @@ -1,4 +1,4 @@ * Itemized list This will normally be a block quote, but it will be a second - paragraph under the list if -D tabstops=2 is specified. \ No newline at end of file + paragraph under the list if -D tabstops=2 is specified. Modified: trunk/prest/t/60_new/parse.init/tabs2.rst =================================================================== --- trunk/prest/t/60_new/parse.init/tabs2.rst 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/parse.init/tabs2.rst 2006-11-07 19:07:13 UTC (rev 4799) @@ -1,4 +1,4 @@ * Itemized list This will normally be a block quote, but it will be a second - paragraph under the list if -D tabstops=2 is specified. \ No newline at end of file + paragraph under the list if -D tabstops=2 is specified. Added: trunk/prest/t/60_new/roles.init/Dir.mak =================================================================== --- trunk/prest/t/60_new/roles.init/Dir.mak 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/roles.init/Dir.mak 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1 @@ +RST_FLAG_mathml02 = -D mstyle='mathcolor=red,mathbackground=yellow' Added: trunk/prest/t/60_new/roles.init/mathml01.dom =================================================================== --- trunk/prest/t/60_new/roles.init/mathml01.dom 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/roles.init/mathml01.dom 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,7 @@ +<document source="test data"> + <paragraph> + Here are in-line math expressions + <math title="\int_0^16x^3\ dx" xmlns="&mathml;"><mstyle><mrow><msubsup><mo>∫</mo><mn>0</mn><mn>16</mn></msubsup></mrow><msup><mi>x</mi><mn>3</mn></msup><mo> </mo><mrow><mi>d</mi><mi>x</mi></mrow></mstyle></math> + and + <math title="sum_{k=0}^47k^2" xmlns="&mathml;"><mstyle><mrow><munderover><mo>∑</mo><mrow><mi>k</mi><mo>=</mo><mn>0</mn></mrow><mn>47</mn></munderover></mrow><msup><mi>k</mi><mn>2</mn></msup></mstyle></math> + . Added: trunk/prest/t/60_new/roles.init/mathml01.rst =================================================================== --- trunk/prest/t/60_new/roles.init/mathml01.rst 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/roles.init/mathml01.rst 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,2 @@ +Here are in-line math expressions :ascii-mathml:`\int_0^16x^3\ dx` and +:mathml:`sum_{k=0}^47k^2`. Added: trunk/prest/t/60_new/roles.init/mathml02.dom =================================================================== --- trunk/prest/t/60_new/roles.init/mathml02.dom 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/roles.init/mathml02.dom 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,7 @@ +<document source="test data"> + <paragraph> + Here are in-line math expressions + <math title="\int_0^16x^3\ dx" xmlns="&mathml;"><mstyle mathbackground="yellow" mathcolor="red"><mrow><msubsup><mo>∫</mo><mn>0</mn><mn>16</mn></msubsup></mrow><msup><mi>x</mi><mn>3</mn></msup><mo> </mo><mrow><mi>d</mi><mi>x</mi></mrow></mstyle></math> + and + <math title="sum_{k=0}^47k^2" xmlns="&mathml;"><mstyle mathbackground="yellow" mathcolor="red"><mrow><munderover><mo>∑</mo><mrow><mi>k</mi><mo>=</mo><mn>0</mn></mrow><mn>47</mn></munderover></mrow><msup><mi>k</mi><mn>2</mn></msup></mstyle></math> + . Added: trunk/prest/t/60_new/roles.init/mathml02.rst =================================================================== --- trunk/prest/t/60_new/roles.init/mathml02.rst 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/roles.init/mathml02.rst 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1,2 @@ +Here are in-line math expressions :ascii-mathml:`\int_0^16x^3\ dx` and +:mathml:`sum_{k=0}^47k^2`. Added: trunk/prest/t/60_new/roles.init/skip.pl =================================================================== --- trunk/prest/t/60_new/roles.init/skip.pl 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/60_new/roles.init/skip.pl 2006-11-07 19:07:13 UTC (rev 4799) @@ -0,0 +1 @@ +require Text::ASCIIMathML; Modified: trunk/prest/t/80_misc/cmdline.init/opt_d.dom =================================================================== --- trunk/prest/t/80_misc/cmdline.init/opt_d.dom 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/80_misc/cmdline.init/opt_d.dom 2006-11-07 19:07:13 UTC (rev 4799) @@ -1,6 +1,7 @@ /export/home/nodine/tools/prest/blib/lib/Text/Restructured/Writer/dom.wrt, line 23 /export/home/nodine/tools/prest/blib/lib/Text/Restructured/Writer/dom.wrt, line 32 /export/home/nodine/tools/prest/blib/lib/Text/Restructured/Writer/dom.wrt, line 44 +/export/home/nodine/tools/prest/blib/lib/Text/Restructured/Writer/dom.wrt, line 49 PROCESS: #PCDATA PROCESS: paragraph PROCESS: #PCDATA Modified: trunk/prest/t/80_misc/cmdline.init/opt_dx2.dom =================================================================== --- trunk/prest/t/80_misc/cmdline.init/opt_dx2.dom 2006-11-06 20:25:50 UTC (rev 4798) +++ trunk/prest/t/80_misc/cmdline.init/opt_dx2.dom 2006-11-07 19:07:13 UTC (re... [truncated message content] |