diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/stex/omdoc.sty.ltxml')
-rw-r--r-- | Master/texmf-dist/tex/latex/stex/omdoc.sty.ltxml | 230 |
1 files changed, 0 insertions, 230 deletions
diff --git a/Master/texmf-dist/tex/latex/stex/omdoc.sty.ltxml b/Master/texmf-dist/tex/latex/stex/omdoc.sty.ltxml deleted file mode 100644 index 24c3ca3b119..00000000000 --- a/Master/texmf-dist/tex/latex/stex/omdoc.sty.ltxml +++ /dev/null @@ -1,230 +0,0 @@ -package LaTeXML::Package::Pool; -use strict; -use LaTeXML::Package; -RequirePackage('keyval'); -DefKeyVal('omgroup','id','Semiverbatim'); -DefKeyVal('omgroup','type','Semiverbatim'); -DefKeyVal('omgroup','display','Semiverbatim'); -DefEnvironment('{omgroup} OptionalKeyVals:omgroup {}', - "<omdoc:omgroup ?&KeyVal(#1,'id')(xml:id='#1')() ?&KeyVal(#1,'type')(type='#1')()>\n" - . "?#1(<omdoc:metadata><dc:title>#1</dc:title></omdoc:metadata>\n)()" - . "#body\n" - . "</omdoc:omgroup>"); - -DefEnvironment('{tgroup} OptionalKeyVals:omgroup {}', - "<omdoc:tgroup ?&KeyVal(#1,'id')(xml:id='#1')() ?&KeyVal(#1,'type')(type='#1')()>\n" - . "?#1(<omdoc:metadata><dc:title>#1</dc:title></omdoc:metadata>\n)()" - . "#body\n" - . "</omdoc:tgroup>"); -DefParameterType('IfBeginFollows', sub { - my ($gullet) = @_; - $gullet->skipSpaces; - return 1 unless $gullet->ifNext(T_CS('\begin')); - return; }, - reversion=>'', optional=>1); - -Let('\group@item@maybe@unwrap','\relax'); - -DefMacro('\group@item[] IfBeginFollows', sub { - my($gullet,$tag,$needwrapper)=@_; - ( T_CS('\group@item@maybe@unwrap'), - ($needwrapper ? (Invocation(T_CS('\group@item@wrap'),$tag)->unlist) : ()) ); }); - -DefConstructor('\group@item@wrap {}', - "<omdoc:omtext>" - . "?#1(<omdoc:metadata><dc:title>#1</dc:title></omdoc:metadata>)()" - . "<omdoc:CMP><omdoc:p>", - beforeDigest=>sub { - Let('\group@item@maybe@unwrap','\group@item@unwrap'); - $_[0]->bgroup; - useCMPItemizations(); - return; }, - properties=>sub{ RefStepItemCounter(); }); -DefConstructor('\group@item@unwrap', - "</omdoc:p></omdoc:CMP></omdoc:omtext>", - beforeDigest=>sub { - $_[0]->egroup; - Let('\group@item@maybe@unwrap','\relax'); }); - -Let('group@item@maybe@unwrap','\relax'); - -Let('\itemize@item'=>'\group@item'); -Let('\enumerate@item'=>'\group@item'); -Let('\description@item'=>'\group@item'); - -DefEnvironment('{itemize}', - "<omdoc:omgroup xml:id='#id' type='itemize'>#body</omdoc:omgroup>", - properties=>sub { beginItemize('itemize'); }, - beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); -DefEnvironment('{enumerate}', - "<omdoc:omgroup xml:id='#id' type='enumerate'>#body</omdoc:omgroup>", - properties=>sub { beginItemize('enumerate'); }, - beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); -DefEnvironment('{description}', - "<omdoc:omgroup xml:id='#id' type='description'>#body</omdoc:omgroup>", - properties=>sub { beginItemize('description'); }, - beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); -Let('\tgroup@itemize@item'=>'\group@item'); -Let('\tgroup@enumerate@item'=>'\group@item'); -Let('\tgroup@description@item'=>'\group@item'); - -DefEnvironment('{tgroup@itemize}', - "<omdoc:tgroup xml:id='#id' type='itemize'>#body</omdoc:tgroup>", - properties=>sub { beginItemize('tgroup@itemize'); }, - beforeDigest=>sub { Let(T_CS('\end{itemize}') =>T_CS('\end{tgroup@itemize}')); }, - beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); -DefEnvironment('{tgroup@enumerate}', - "<omdoc:tgroup xml:id='#id' type='enumerate'>#body</omdoc:tgroup>", - properties=>sub { beginItemize('tgroup@enumerate'); }, - beforeDigest=>sub{ Let(T_CS('\end{enumerate}') =>T_CS('\end{tgroup@enumerate}'));}, - beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); -DefEnvironment('{tgroup@description}', - "<omdoc:tgroup xml:id='#id' type='description'>#body</omdoc:tgroup>", - properties=>sub { beginItemize('tgroup@description'); }, - beforeDigest=>sub{ Let(T_CS('\end{description}') =>T_CS('\end{tgroup@description}'));}, - beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); - -sub useTheoryItemizations { - Let(T_CS('\begin{itemize}') =>T_CS('\begin{tgroup@itemize}')); - Let(T_CS('\begin{enumerate}') =>T_CS('\begin{tgroup@enumerate}')); - Let(T_CS('\begin{description}')=>T_CS('\begin{tgroup@description}')); - return; } -DefConstructor('\CMP@itemize@item[]', - '<omdoc:li>' - . '?#1(<omdoc:metadata><dc:title>#1</dc:title></omdoc:metadata>)()', - properties=>sub{ RefStepItemCounter(); }); - -DefConstructor('\CMP@enumerate@item[]', - '<omdoc:li>' - . '?#1(<omdoc:metadata><dc:title>#1</dc:title></omdoc:metadata>)()', - properties=>sub{ RefStepItemCounter(); }); - -DefConstructor('\CMP@description@item[]', - '<omdoc:di>' - . '?#1(<omdoc:dt>#1</omdoc:dt>)()<omdoc:dd>', # trust di and dt to autoclose - properties=>sub{ RefStepItemCounter(); }); - -DefEnvironment('{CMP@itemize}', - "<omdoc:ul xml:id='#id'>#body</omdoc:ul>", - properties=>sub { beginItemize('CMP@itemize'); }, - beforeDigest=>sub { Let(T_CS('\end{itemize}') =>T_CS('\end{CMP@itemize}')); }); -DefEnvironment('{CMP@enumerate}', - "<omdoc:ol xml:id='#id'>#body</omdoc:ol>", - properties=>sub { beginItemize('CMP@enumerate'); }, - beforeDigest=>sub { Let(T_CS('\end{enumerate}') =>T_CS('\end{CMP@enumerate}')); }); -DefEnvironment('{CMP@description}', - "<omdoc:dl xml:id='#id'>#body</omdoc:dl>", - properties=>sub { beginItemize('CMP@description'); }, - beforeDigest=>sub { Let(T_CS('\end{description}') =>T_CS('\end{CMP@description}'));}); - -sub useCMPItemizations { - Let(T_CS('\begin{itemize}') =>T_CS('\begin{CMP@itemize}')); - Let(T_CS('\begin{enumerate}') =>T_CS('\begin{CMP@enumerate}')); - Let(T_CS('\begin{description}')=>T_CS('\begin{CMP@description}')); - return; } - -Tag('omdoc:CMP', afterOpen => sub { - AssignValue('_LastSeenCMP', $_[1], 'global'); - return; }); - -Tag('omdoc:li', autoClose=>1); -Tag('omdoc:dd', autoClose=>1); -Tag('omdoc:di', autoClose=>1); -DefKeyVal('stat','id','Semiverbatim'); -DefKeyVal('stat','for','Semiverbatim'); -DefKeyVal('stat','title','Semiverbatim'); -DefKeyVal('stat','from','Semiverbatim'); -DefKeyVal('stat','type','Semiverbatim'); -DefKeyVal('stat','display','Semiverbatim'); # not used at the moment -DefCMPEnvironment('{omtext} OptionalKeyVals:stat', - "<omdoc:omtext " - . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')() " - . "?&KeyVal(#1,'type')(type='&KeyVal(#1,'type')')() " - . "?&KeyVal(#1,'for')(for='&KeyVal(#1,'for')')() " - . "?&KeyVal(#1,'from')(from='&KeyVal(#1,'from')')()>" - . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" - . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" - . "</omdoc:omtext>\n"); -sub DefCMPEnvironment { - my ($proto, $replacement, %options) = @_; - my @before = $options{beforeDigest} ? ($options{beforeDigest}) : (); - push(@before, \&useCMPItemizations); - $options{beforeDigest} = \@before; - DefEnvironment($proto, $replacement, %options); -} -DefConstructor('\STRlabel{}{}', sub { - my($document,$label,$object)=@_; - $document->absorb($object); - $document->addAttribute('xml:id'=>ToString($label)) if $label; }); -DefConstructor('\STRcopy{}',"<omdoc:ref xref='#1'/>"); -DefMacro('\STRlabeldef{}{}', ""); -DefConstructor('\STRsemantics[]{}{}', sub { - my($document,$label,$ignore,$object)=@_; - $document->absorb($object); - $document->addAttribute('xml:id'=>ToString($label)) if $label; }); -DefKeyVal('phrase','id','Semiverbatim'); -DefKeyVal('phrase','style','Semiverbatim'); -DefKeyVal('phrase','class','Semiverbatim'); -DefKeyVal('phrase','index','Semiverbatim'); -DefKeyVal('phrase','verbalizes','Semiverbatim'); -DefKeyVal('phrase','type','Semiverbatim'); -DefConstructor('\phrase OptionalKeyVals:phrase {}', - "<omdoc:phrase %&KeyVals(#1)>#body</omdoc:phrase>"); -DefConstructor('\nlex{}',"<omdoc:phrase type='nlex'>#1</omdoc:phrase>"); -DefConstructor('\nlcex{}',"<omdoc:phrase type='nlcex'>#1</omdoc:phrase>"); -DefConstructor('\inlinequote{}',"<omdoc:phrase type='inlinequote'>#1</omdoc:phrase>"); -sub omdocColorMacro { - my ($color, @args) = @_; - my $tok_color = TokenizeInternal($color); - (T_BEGIN, T_CS('\@omdoc@color'), T_BEGIN, $tok_color->unlist, - T_END, T_CS('\@omdoc@color@content'), T_OTHER('['), $tok_color->unlist, T_OTHER(']'), - T_BEGIN, $args[1]->unlist, T_END, T_END); } -DefMacro('\@omdoc@color{}', sub { MergeFont(color=>$_[1]->toString); return; }); -DefConstructor('\@omdoc@color@content[]{}', - "?#isMath(#2)(<omdoc:phrase ?#1(style='color:#1')()>#2</omdoc:phrase>)"); -foreach my $color(qw(blue red green magenta cyan brown yellow)) { - DefMacro("\\".$color.'{}', sub { omdocColorMacro($color, @_); }); } -DefConstructor('\par',sub { $_[0]->maybeCloseElement('omdoc:p'); },alias=>"\\par\n"); -Tag('omdoc:p', autoClose=>1, autoOpen=>1); -DefConstructor('\omspace{}',''); -DefConstructor('\emph{}',"<omdoc:phrase class='emphasis'>#1</omdoc:phrase>"); -DefConstructor('\em',"<omdoc:phrase class='emphasis'>"); -Tag('omdoc:phrase', autoClose=>1); -DefEnvironment('{center}','#body'); -DefEnvironment('{minipage}{}','#body'); -DefEnvironment('{quote}',"<omdoc:phrase type='quote' style='display:block'>#body</omdoc:phrase>"); -DefEnvironment('{quotation}',"<omdoc:phrase type='quote' style='display:block'>#body</omdoc:phrase>"); -DefEnvironment('{small}','#body'); -DefEnvironment('{footnotesize}','#body'); -DefEnvironment('{tiny}','#body'); -DefEnvironment('{scriptsize}','#body'); -DefConstructor('\LARGE',''); -DefConstructor('\Large',''); -DefConstructor('\large',''); -DefConstructor('\small',''); - -DefConstructor('\fbox{}','#1'); - -DefConstructor('\footnote[]{}', - "<omdoc:note class='foot' ?#1(mark='#1')>#2</omdoc:note>"); -DefConstructor('\footnotemark[]',""); -DefConstructor('\footnotetext[]{}', - "<omdoc:note class='foot' ?#1(mark='#1')>#2</omdoc:note>"); - -DefConstructor('\sf', ''); -DefConstructor('\sc', ''); -Tag('omdoc:p',afterOpen=>\&numberIt); -Tag('omdoc:omtext',afterOpen=>\&numberIt); -Tag('omdoc:omgroup',afterOpen=>\&numberIt); -Tag('omdoc:tgroup',afterOpen=>\&numberIt); -Tag('omdoc:CMP',afterOpen=>\&numberIt); -sub numberIt { - my($document,$node,$whatsit)=@_; - my(@parents)=$document->findnodes('ancestor::*[@xml:id]',$node); # find 1st id'd parent. - my $prefix= (@parents ? $parents[$#parents]->getAttribute('xml:id')."." : ''); - my(@siblings)=$document->findnodes('preceding-sibling::*[@xml:id]',$node); - my $n = scalar(@siblings)+1; - my $id = ($node -> getAttribute('xml:id')); - $node->setAttribute('xml:id'=>$prefix."p$n") unless $id; } -DefConstructor('\url Semiverbatim',"<omdoc:link href='#1'>#1</omdoc:link>"); -1; |