diff options
author | Karl Berry <karl@freefriends.org> | 2010-11-12 00:31:31 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-11-12 00:31:31 +0000 |
commit | 70e387eb63ce4723858c48592208e193dec294f3 (patch) | |
tree | 61ec42df871a70687151ed4a6d1bc6a5c81dc53c /Master/texmf-dist/tex/latex/stex/statements | |
parent | 2cee8f6dcf8e9596b5cfe9d1f3e55c61b261a320 (diff) |
stex 0.9.3 (11nov10)
git-svn-id: svn://tug.org/texlive/trunk@20410 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/stex/statements')
-rw-r--r-- | Master/texmf-dist/tex/latex/stex/statements/statements.sty | 60 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/stex/statements/statements.sty.ltxml | 27 |
2 files changed, 55 insertions, 32 deletions
diff --git a/Master/texmf-dist/tex/latex/stex/statements/statements.sty b/Master/texmf-dist/tex/latex/stex/statements/statements.sty index e761512a9b3..15ba42db9c8 100644 --- a/Master/texmf-dist/tex/latex/stex/statements/statements.sty +++ b/Master/texmf-dist/tex/latex/stex/statements/statements.sty @@ -8,15 +8,16 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{statements}[2010/06/25 v1.0 Semantic Markup for Statements] +\DeclareOption{showmeta}{\PassOptionsToPackage{\CurrentOption}{metakeys}} \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{omdoc}} \ProcessOptions \RequirePackage{omtext} \RequirePackage{modules} \RequirePackage[hyperref]{ntheorem} \theoremstyle{plain} -\def\STpresent#1{#1} +\providecommand\STpresent[1]{#1} \def\define@statement@env#1{% -\newenvironment{#1}[1][]{\omdsetkeys{omtext}{##1}\sref@target% +\newenvironment{#1}[1][]{\metasetkeys{omtext}{##1}\sref@target% \ifx\omtext@display\st@flow\else% \ifx\omtext@title\@empty\begin{ST#1Env}\else\begin{ST#1Env}[\omtext@title]\fi% \ifx\sref@id\@empty\else\label{#1.\sref@id}\fi @@ -24,7 +25,7 @@ \ifx\sref@id\@empty\sref@label@id{here}\else% \sref@label@id{\STpresent{\csname ST#1EnvKeyword\endcsname}~\@currentlabel}\fi} {\csname st@#1@terminate\endcsname\ifx\omtext@display\st@flow\else\end{ST#1Env}\fi}} -\newenvironment{assertion}[1][]{\omdsetkeys{omtext}{#1}\sref@target% +\newenvironment{assertion}[1][]{\metasetkeys{omtext}{#1}\sref@target% \ifx\omtext@display\st@flow\else% \ifx\omtext@title\@empty\begin{ST\omtext@type AssEnv}% \else\begin{ST\omtext@type AssEnv}[\omtext@title]\fi\fi% @@ -64,18 +65,18 @@ \theorembodyfont{\upshape} \newtheorem{STaxiomEnv}[STtheoremAssEnv]{\st@axiom@kw} \srefaddidkey{symboldec} -\omdaddkey{symboldec}{functions} -\omdaddkey{symboldec}{role} -\omdaddkey{symboldec}{title} -\omdaddkey{symboldec}{name} -\omdaddkey{symboldec}{display} +\addmetakey{symboldec}{functions} +\addmetakey{symboldec}{role} +\addmetakey*{symboldec}{title} +\addmetakey{symboldec}{name} +\addmetakey*{symboldec}{display} \def\symboldec@type{Symbol} -\newenvironment{symboldec}[1][]{\omdsetkeys{symboldec}{#1}\sref@target +\newenvironment{symboldec}[1][]{\metasetkeys{symboldec}{#1}\sref@target\st@indeftrue% \ifx\symboldec@display\st@flow\else{\stDMemph{\symboldec@type} \symboldec@name:}\fi% \ifx\symboldec@title\@empty~\else~(\stDMemph{\symboldec@title})\par\fi}{} \newcommand{\symtype}[2]{Type (#1): #2} \newif\ifst@indef\st@indeffalse -\newenvironment{definition}[1][]{\omdsetkeys{omtext}{#1}\sref@target\st@indeftrue% +\newenvironment{definition}[1][]{\metasetkeys{omtext}{#1}\sref@target\st@indeftrue% \ifx\omtext@display\st@flow\else% \ifx\omtext@title\@empty\begin{STdefinitionEnv}\else\begin{STdefinitionEnv}[\omtext@title]\fi\fi% \ifx\sref@id\@empty\sref@label@id{here}\else% @@ -92,20 +93,24 @@ \theorembodyfont{\upshape} \newtheorem{STnotationEnv}[STtheoremAssEnv]{\st@notation@kw} \def\st@def@target#1#2{\def\@test{#1}% -\@ifundefined{mod@id}% -{\PackageError{statements}{definiendum in unidentified module}% -{\protect\definiendum, \protect\defin, +\ifst@indef% if we are in a definition or such +\ifx\omtext@theory\@empty% if there is no theory attribute +\@ifundefined{mod@id}% if we are not in a module +{\PackageWarning{statements}{definiendum in unidentified module\MessageBreak +\protect\definiendum, \protect\defin, \protect\twindef, \protect\atwindef\MessageBreak -may only be called in a module with id key}}% -{\ifst@indef\else\PackageWarning{statements} - {definiendum outside definition context\MessageBreak +can only be referenced when called in a module with id key}}% +{\ifx\@test\@empty% +\expandafter\sref@target@ifh{sref@#2@\mod@id @target}{}\else% +\expandafter\sref@target@ifh{sref@#1@\mod@id @target}{}\fi}% +\else\expandafter\sref@target@ifh{sref@#1@\omtext@theory @target}{}\fi% +\else\PackageError{statements}% +{definiendum outside definition context\MessageBreak \protect\definiendum, \protect\defin, \protect\twindef, \protect\atwindef\MessageBreak do not make sense semantically outside a definition.\MessageBreak -Consider wrapping the defining phrase in a \protect\inlinedef}\fi -\ifx\@test\@empty% -\expandafter\sref@target@ifh{sref@#2@\mod@id @target}{}\else% -\expandafter\sref@target@ifh{sref@#1@\mod@id @target}{}\fi}} +Consider wrapping the defining phrase in a \protect\inlinedef}% +\fi} \newcommand{\definiendum}[2][]{\st@def@target{#1}{#2}\defemph{#2}} \newcommand{\notatiendum}[2][]{\notemph{#2}} \newcommand{\defin}[2][]{\definiendum[#1]{#2}\omdoc@index[#1]{#2}} @@ -114,13 +119,14 @@ Consider wrapping the defining phrase in a \protect\inlinedef}\fi \newcommand{\twindefalt}[4][]{\definiendum[#1]{#2}\@twin[#1]{#3}{#4}} \newcommand{\atwindef}[4][]{\st@def@target{#1}{#2-#3-#4}\defemph{#2 #3 #4}\@atwin[#1]{#2}{#3}{#4}} \newcommand{\atwindefalt}[5][]{\definiendum[#1]{#2}\@atwin[#1]{#3}{#4}{#5}} -\newcommand{\inlinedef}[2][]{\omdsetkeys{omtext}{#1}\sref@target\sref@label@id{here}\st@indeftrue #2} -\omdaddkey[\mod@id]{termref}{cd} -\omdaddkey{termref}{cdbase} -\omdaddkey{termref}{name} -\omdaddkey{termref}{role} -\def\termref@set#1#2{\def\termref@name{#2}\omdsetkeys{termref}{#1}} -\newcommand{\termref}[2][]{\omdsetkeys{termref}{#1}\st@termref{#2}} +\newcommand{\inlineex}[2][]{\metasetkeys{omtext}{#1}\sref@target\sref@label@id{here}#2} +\newcommand{\inlinedef}[2][]{\metasetkeys{omtext}{#1}\sref@target\sref@label@id{here}\st@indeftrue #2} +\addmetakey[\mod@id]{termref}{cd} +\addmetakey{termref}{cdbase} +\addmetakey{termref}{name} +\addmetakey{termref}{role} +\def\termref@set#1#2{\def\termref@name{#2}\metasetkeys{termref}{#1}} +\newcommand{\termref}[2][]{\metasetkeys{termref}{#1}\st@termref{#2}} \def\st@termref#1{\ifx\termref@name\@empty\def\termref@name{#1}\fi% \mod@termref\termref@cd\termref@name{#1}} \newcommand{\twinref}[3][]{\termref@set{#1}{#2-#3}\st@termref{#2 #3}} diff --git a/Master/texmf-dist/tex/latex/stex/statements/statements.sty.ltxml b/Master/texmf-dist/tex/latex/stex/statements/statements.sty.ltxml index 709150f1b9d..cd1a45ef945 100644 --- a/Master/texmf-dist/tex/latex/stex/statements/statements.sty.ltxml +++ b/Master/texmf-dist/tex/latex/stex/statements/statements.sty.ltxml @@ -15,17 +15,31 @@ sub makeNCName { $ncname; } sub simple_wrapper { - my @input = @_; + #Deref if array reference + my @input; + foreach (@_) { + if (ref $_ && $_ =~ /ARRAY/ && $_ !~ /LaTeXML/) { + @input=(@input,@$_); + } else + { push (@input,$_); } + } return '' if (!@input); - @input = map(split(/\s*,\s*/,$_->toString),@input); + @input = map(split(/\s*,\s*/,ToString($_)),@input); my $output=join(" ",@input); $output=~s/(^ )|[{}]//g; #remove leading space and list separator brackets $output||''; } sub hash_wrapper{ - my @input = @_; + #Deref if array reference + my @input; + foreach (@_) { + if (ref $_ && $_ =~ /ARRAY/ && $_ !~ /LaTeXML/) { + @input=(@input,@$_); + } else + { push (@input,$_); } + } return '' if (!@input); - @input = map(split(/\s*,\s*/,$_->toString),@input); + @input = map(split(/\s*,\s*/,ToString($_)),@input); my $output=join(".sym #",@input); $output=~s/(^\.sym )|[{}]//g; #remove leading space and list separator brackets "#$output"||''; @@ -42,6 +56,7 @@ DefCMPEnvironment('{example} OptionalKeyVals:omtext', "<omdoc:example " . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')() " . "?&KeyVal(#1,'for')(for='&hash_wrapper(&KeyVal(#1,'for'))')()>" + . "?&KeyVal(#1,'title')(<dc:title>&KeyVal(#1,'title')</dc:title>)()" . "<omdoc:CMP><omdoc:p>#body" . "</omdoc:example>\n"); DefCMPEnvironment('{axiom} OptionalKeyVals:omtext', @@ -106,7 +121,7 @@ DefCMPEnvironment('{definition} OptionalKeyVals:omtext', sub{definitionBody(@_)} DefCMPEnvironment('{notation} OptionalKeyVals:omtext', "<omdoc:definition " . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id').not')()" - . "?&KeyVal(#1,'for')(for='&simple_wrapper(&KeyVal(#1,'for'))')()>" + . "?&KeyVal(#1,'for')(for='&hash_wrapper(&KeyVal(#1,'for'))')()>" . "?&KeyVal(#1,'title')(<dc:title>&KeyVal(#1,'title')</dc:title>)()" . "<omdoc:CMP><omdoc:p>#body" . "</omdoc:definition>\n"); @@ -241,6 +256,8 @@ DefConstructor('\atwindefalt[]{}{}{}{}', $whatsit->setProperty(theory=>LookupValue('current_module')); return; }, alias=>'\atwindef'); +DefConstructor('\inlineex OptionalKeyVals:omtext {}', + "<omdoc:phrase type='example'>#2</omdoc:phrase>"); DefConstructor('\inlinedef OptionalKeyVals:omtext {}', sub { my ($document, $keyvals, $body, %props) = @_; my $for = $keyvals->getValue('for') if $keyvals; |