diff options
author | Karl Berry <karl@freefriends.org> | 2023-10-13 21:06:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-10-13 21:06:13 +0000 |
commit | f1699d5f8cd35da9034fa3a1cfb1dca1f521f49c (patch) | |
tree | ae39f7af601882fde870b7fabf296863d883b57b /Master/texmf-dist/tex/context/third | |
parent | 155afd78de569975d7d0908294fe8fefd4023199 (diff) |
rm context-<many>, obsolete on ctan
git-svn-id: svn://tug.org/texlive/trunk@68539 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/third')
30 files changed, 0 insertions, 11959 deletions
diff --git a/Master/texmf-dist/tex/context/third/animation/t-animation.mkvi b/Master/texmf-dist/tex/context/third/animation/t-animation.mkvi deleted file mode 100644 index 62f960c9ada..00000000000 --- a/Master/texmf-dist/tex/context/third/animation/t-animation.mkvi +++ /dev/null @@ -1,363 +0,0 @@ -%D \module -%D [ file=t-animation, -%D version=2013.04.07, -%D title=\CONTEXT\ User Module, -%D subtitle=Animations, -%D author=Wolfgang Schuster, -%D date=\currentdate, -%D copyright=Wolfgang Schuster, -%D license=GNU General Public License] - -%C Copyright (C) 2011 Wolfgang Schuster -%C -%C This program is free software: you can redistribute it and/or modify -%C it under the terms of the GNU General Public License as published by -%C the Free Software Foundation, either version 3 of the License, or -%C (at your option) any later version. -%C -%C This program is distributed in the hope that it will be useful, -%C but WITHOUT ANY WARRANTY; without even the implied warranty of -%C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -%C GNU General Public License for more details. -%C -%C You should have received a copy of the GNU General Public License -%C along with this program. If not, see <http://www.gnu.org/licenses/>. - -% begin info -% -% title : animations -% comment : simple interface to generate animations which are based on the fieldstack mechanism -% status : useable in documents and modules -% -% end info - -%M \loadsetups[t-animation.xml] - -%D \showsetup{startanimation} -%D \showsetup{defineanimation} -%D \showsetup{setupanimation} - -\unprotect - -\startinterface all - \setinterfacevariable {animation} {animation} -\stopinterface - -\startinterface all - \setinterfaceconstant {menustyle} {menustyle} - \setinterfaceconstant {menucolor} {menucolor} - \setinterfaceconstant {framerate} {framerate} -\stopinterface - -\installnamespace {animation} -\installnamespace {animationmenu} -\installnamespace {animationrenderings} - -\installframedcommandhandler \????animation {animation} \????animation -\installcommandhandler \????animationmenu {animationmenu} \????animationmenu - -\appendtoks - \setuevalue{\e!start\currentanimation}{\animation_beg{\currentanimation}}% - \setuevalue{\e!stop \currentanimation}{\animation_end }% -\to \everydefineanimation - -\newcount\animation_current -\newcount\animation_frame - -\edef\m_animation_signal_pause{+} - -\ifdefined\s!repeat \else \def\s!repeat {repeat} \fi -\ifdefined\s!once \else \def\s!once {once} \fi -\ifdefined\s!pause \else \def\s!pause {pause} \fi -\ifdefined\s!FirstFrame \else \def\s!FirstFrame {FirstFrame} \fi -\ifdefined\s!PreviousFrame \else \def\s!PreviousFrame {PreviousFrame} \fi -\ifdefined\s!StartAnimation \else \def\s!StartAnimation{StartAnimation} \fi -\ifdefined\s!StopAnimation \else \def\s!StopAnimation {StopAnimation} \fi -\ifdefined\s!NextFrame \else \def\s!NextFrame {NextFrame} \fi -\ifdefined\s!LastFrame \else \def\s!LastFrame {LastFrame} \fi - -\unexpanded\def\animation_beg#environment% - {\begingroup - \edef\currentanimation{#environment}% - \dodoubleempty\animation_beg_parameters} - -\def\animation_beg_parameters - {\iffirstargument - \ifsecondargument - \doubleexpandafter\animation_beg_parameters_two - \else - \doubleexpandafter\animation_beg_parameters_one - \fi - \else - \expandafter\animation_beg_parameters_zero - \fi} - -\def\animation_beg_parameters_zero[#name][#parameters]% - {\global\advance\animation_current\plusone - \animation_beg_parameters_two[\number\animation_current][]} - -\def\animation_beg_parameters_one[#name][#parameters]% - {\doifassignmentelse{#name} - {\global\advance\animation_current\plusone - \animation_beg_parameters_two[\number\animation_current][#name]} - {\animation_beg_parameters_two[#name][]}} - -\def\animation_beg_parameters_two[#name][#parameters]% - {\edef\animation_name{\currentanimation:#name}% - \setupcurrentanimation - [#parameters, - \c!align=\v!middle, - \c!background={\v!foreground,\animation_name}, - \c!offset=\v!overlay]% - \animation_initialize - \animation_symbols - \doifnextbgroupelse\animation_frame_grouped\donothing} - -\def\animation_symbols - {\definesymbol[\s!FirstFrame ][\symbol\v!firstpage ]% - \definesymbol[\s!PreviousFrame ][\symbol\v!PreviousJump]% - \definesymbol[\s!StartAnimation][\symbol\v!StartMovie ]% - \definesymbol[\s!StopAnimation ][\symbol\v!StopMovie ]% - \definesymbol[\s!NextFrame ][\symbol\v!NextJump ]% - \definesymbol[\s!LastFrame ][\symbol\v!lastpage ]} - -\def\animation_initialize - {\animation_frame\zerocount - \let\m_animation_symbols\empty - \let\m_animation_pause \empty - \let\startframe\animation_frame_start - \let\stopframe \relax - \let\frame \animation_frame_direct} - -\unexpanded\def\animation_end - {\normalexpanded{\definefieldstack[\animation_name][\m_animation_symbols][]}% - % - \edef\p_animation_repeat{\animationparameter\c!repeat}% - \ifx\p_animation_repeat\v!no - \let\p_animation_repeat\s!once - \else - \let\p_animation_repeat\s!repeat - \fi - % - \edef\p_animation_list{\animationparameter\c!list}% - \ifx\m_animation_pause\empty \else - \let\p_animation_list\m_animation_pause - \fi - % - \edef\currentanimationmenu{\animationparameter\c!menu}% - \edef\p_animation_renderingsetup{\animationmenuparameter\c!renderingsetup}% - \doifsetupselse\p_animation_renderingsetup - {\texsetup\p_animation_renderingsetup} - {\texsetup{\????animationrenderings:\v!no}}% - \endgroup} - -%D \extras -%D {menu} -%D -%D \subject{Control buttons} -%D -%D Animations are useless without any method to enable them, one way -%D is to use \tex{goto} command (e.g. \type{\goto{...}[JS(Walk_Field{<NAME>})]}) -%D where you go to the next frame with each click. A different way to control -%D the animation is the menu, which can be a row with buttons below the animation -%D or a link above the graphic. -%D -%D The module provides for this the following values for the menu key: -%D -%D \startitemize[packed] -%D \startitem no (usefull when you use the \tex{goto} command) \stopitem -%D \startitem yes (places a row with buttons below the animation) \stopitem -%D \startitem overlay (creates a button over the animation) \stopitem -%D \stopitemize - -\defineanimationmenu[\v!yes ][\c!renderingsetup=\????animationrenderings:\v!yes ] -\defineanimationmenu[\v!no ][\c!renderingsetup=\????animationrenderings:\v!no ] -\defineanimationmenu[\v!overlay][\c!renderingsetup=\????animationrenderings:\v!overlay] - -\startsetups[\????animationrenderings:\v!yes] - - \defineviewerlayer[\animation_name:\v!start][\c!state=\v!start] - \defineviewerlayer[\animation_name:\v!stop ][\c!state=\v!stop ] - - \inheritedanimationframed\bgroup - - \fieldstack[\animation_name] - - \blank[\v!medium]% \animationparameter\c!inbetween - - \dontleavehmode\hbox\bgroup - - \setupinteraction[\c!style=,\c!color=,\c!contrastcolor=]% Use only "menustyle" and "menucolor"! - \useanimationstyleandcolor\c!menustyle\c!menucolor - - \setupsymbolset[\animationparameter\c!symbolset] - - \gotobox - {\symbol\s!FirstFrame} - [JS(Reset_Walk_Field{\animation_name}), - HideLayer{\animation_name:\v!stop }, - VideLayer{\animation_name:\v!start}] - - \dotfskip{\animationparameter\c!distance} - - \gotobox - {\symbol\s!PreviousFrame} - [JS(Previous_Walk_Field{\animation_name}), - HideLayer{\animation_name:\v!stop }, - VideLayer{\animation_name:\v!start}] - - \dotfskip{\animationparameter\c!distance} - - \ifx\p_animation_list\empty - - \gotobox - {\setbox\scratchbox\hbox{\symbol\s!StopAnimation} - \startoverlay - {\startviewerlayer[\animation_name:\v!stop] - \hbox to \wd\scratchbox{\symbol\s!StopAnimation} - \stopviewerlayer} - {\startviewerlayer[\animation_name:\v!start] - \hbox to \wd\scratchbox{\hss\symbol\s!StartAnimation\hss} - \stopviewerlayer} - \stopoverlay} - [JS(Start_Pause_Walk_Field{\animation_name,\cldcontext{math.round(1000/\number\animationparameter\c!framerate)},\p_animation_repeat}), - ToggleLayer{\animation_name:\v!stop }, - ToggleLayer{\animation_name:\v!start}] - - \else - - \gotobox - {\symbol\s!StartAnimation} - [JS(Start_Pause_Walk_Field{\animation_name,\cldcontext{math.round(1000/\number\animationparameter\c!framerate)},\s!pause,\p_animation_list}), - ToggleLayer{\animation_name:\v!stop }, - ToggleLayer{\animation_name:\v!start}] - - \fi - - \dotfskip{\animationparameter\c!distance} - - \gotobox - {\symbol\s!NextFrame} - [JS(Next_Walk_Field{\animation_name}), - HideLayer{\animation_name:\v!stop }, - VideLayer{\animation_name:\v!start}] - - \dotfskip{\animationparameter\c!distance} - - \gotobox - {\symbol\s!LastFrame} - [JS(Stop_Walk_Field{\animation_name}), - JS(Set_Field{\animation_name,\number\animation_frame}), - HideLayer{\animation_name:\v!stop }, - VideLayer{\animation_name:\v!start}]% - - \egroup - - \egroup - -\stopsetups - -\startsetups[\????animationrenderings:\v!no] - - \inheritedanimationframed{\fieldstack[\animation_name]} - -\stopsetups - -\startsetups[\????animationrenderings:\v!overlay] - - \defineoverlay[\animation_name][\overlaybutton{Walk{\animation_name}}] - - \inheritedanimationframed{\fieldstack[\animation_name]} - -\stopsetups - -%D \macros -%D {frame,startframe} -%D -%D The content for each frame can be set with two methods, the first is to -%D enclose the code in brackets like you do in the overlay environment. -%D -%D \starttyping -%D \startanimation -%D {FRAME 1} -%D {FRAME 2} -%D \stopanimation -%D \stoptyping -%D -%D The second method is the modern variant with start/stop-tags to enclose -%D each frame, you can either you use \tex{frame} command which takes -%D a argument, e.g. -%D -%D \starttyping -%D \startanimation -%D \frame{FRAME 1} -%D \frame{FRAME 2} -%D \stopanimation -%D \stoptyping -%D -%D or you use the \type{frame} environment which delimits each frame -%D by the start and stop tags. -%D -%D \starttyping -%D \startanimation -%D \startframe FRAME 1 \stopframe -%D \startframe FRAME 2 \stopframe -%D \stopanimation -%D \stoptyping - -\unexpanded\def\animation_frame_grouped#content% - {\advance\animation_frame\plusone - \edef\animation_currentframe{\animation_name:\number\animation_frame}% - \appendtocommalist\animation_currentframe\m_animation_symbols - \definesymbol[\animation_currentframe][{#content}]% - \doifnextbgroupelse\animation_frame_grouped\donothing} - -\unexpanded\def\animation_frame_direct - {\dosingleempty\animation_frame_direct_indeed} - -\def\animation_frame_direct_indeed[#signal]#content% - {\advance\animation_frame\plusone - \edef\m_animation_signal{#signal}% - \ifx\m_animation_signal\m_animation_signal_pause - \appendtocommalist{\number\animation_frame}\m_animation_pause - \fi - \edef\animation_currentframe{\animation_name:\number\animation_frame}% - \appendtocommalist\animation_currentframe\m_animation_symbols - \definesymbol[\animation_currentframe][{#content}]} - -\unexpanded\def\animation_frame_start - {\dosingleempty\animation_frame_start_indeed} - -\def\animation_frame_start_indeed[#signal]#content\stopframe - {\advance\animation_frame\plusone - \edef\m_animation_signal{#signal}% - \ifx\m_animation_signal\m_animation_signal_pause - \appendtocommalist{\number\animation_frame}\m_animation_pause - \fi - \edef\animation_currentframe{\animation_name:\number\animation_frame}% - \appendtocommalist\animation_currentframe\m_animation_symbols - \definesymbol[\animation_currentframe][{#content}]} - -%D To use the module one has to create a new animation environment, -%D to prevent the user from creating one first before he can use the module -%D one environment would be always available. The name of this predefined -%D environment is \tex{startenvironment}, to ensure it can be also by other -%D modules when a non english interface is used it is ensured you can always -%D use it with two commands \tex{startanimation} and \tex{stopanimation}. - -\defineanimation[\v!animation] - -\ifdefined\startanimation \else - \def\startanimation{\animation_beg\v!animation}% - \def\stopanimation {\animation_end }% -\fi - -\setupanimation - [ \c!frame=\v!off, - \c!offset=\v!overlay, - \c!menu=\v!overlay, - \c!distance=\spaceamount, - \c!framerate=\plusone, - \c!symbolset=navigation 1] - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/third/annotation/t-annotation.lua b/Master/texmf-dist/tex/context/third/annotation/t-annotation.lua deleted file mode 100644 index 0221cc4a772..00000000000 --- a/Master/texmf-dist/tex/context/third/annotation/t-annotation.lua +++ /dev/null @@ -1,151 +0,0 @@ -if not modules then modules = { } end modules ['t-annotation'] = { - version = 1.000, - comment = "Annotations", - author = "Wolfgang Schuster", - copyright = "Wolfgang Schuster", - license = "GNU General Public License" -} - -thirddata = thirddata or {} -thirddata.annotation = thirddata.annotation or {} - -local annotation = thirddata.annotation - -local variables = interfaces.variables - -local format = string.format -local gsub = string.gsub -local rep = string.rep -local validstring = string.valid - -local datasets = job.datasets - -local v_yes = variables.yes -local v_no = variables.no -local v_auto = variables.auto -local v_paragraph = variables.paragraph -local v_text = variables.text -local v_command = variables.command -local v_vertical = variables.vertical -local v_horizontal = variables.horizontal -local v_annotation = variables.annotation -local v_buffer = variables.buffer - -local texsprint = tex.sprint -local ctxcatcodes = tex.ctxcatcodes -local txtcatcodes = tex.txtcatcodes - --- Collect the content of the environment - -local data = { } - -function annotation.erasedata(name) - data[name] = nil -end - -function annotation.getdata(name) - local data = data[name] - return data and data.content or "" -end - -function annotation.printdata(environment,name) - local content, catcodes - if tex.conditionals['c_annotation_buffer'] and name ~= "" then - content = datasets.getdata(environment,name,"content") or "" - catcodes = datasets.getdata(environment,name,"catcodes") or "" - else - content = data[name] and data[name]["content"] or "" - catcodes = data[name] and data[name]["catcodes"] or "" - end - if catcodes == txtcatcodes then - context.pushcatcodes(txtcatcodes) - else - context.pushcatcodes(ctxcatcodes) - end - if tex.conditionals['c_annotation_inline'] then - context(content:strip()) -- remove leading/trailing spaces - else - context.viafile(content,format("annotation.%s",validstring(name,"noname"))) - end - context.popcatcodes() -end - -function annotation.parameters(environment,name) - local data = data[name] - local parameters = data and data.parameters or "" - texsprint(ctxcatcodes,parameters) -end - -function annotation.dataset(environment,name,parameters,content,catcodes) - datasets.setdata { - name = environment, - tag = name, - data = { - parameters = parameters, - content = content, - catcodes = catcodes - } - } -end - -function annotation.collectdata(environment,name,parameters,content,begintag,endtag,catcodes) - local oldcontent = annotation.getdata(name) - local content = content - local parameters = parameters - local catcodes = catcodes - local nesting = false - if oldcontent == "" then - -- no nested environment - else - content = oldcontent .. endtag .. " " .. content - end - if select(2,gsub(content,begintag,begintag)) > select(2,gsub(content,endtag,endtag)) then - nesting = true - else - nesting = false - end - if not nesting and name ~= "" then - annotation.dataset(environment,name,parameters,content,catcodes) - end - data[name] = { parameters = parameters, content = content, catcodes = catcodes } - commands.doifelse(nesting) -end - -function annotation.savedata(environment,name,parameters,content,catcodes) - data[name] = { parameters = parameters, content = content, catcodes = catcodes } -end - --- Write the content of the environment to a file - -annotation.empty = true - -function annotation.open() - annotation.export = io.open(file.addsuffix(table.concat({tex.jobname,"annotation"},"-"),"txt"),"wb") -end - -function annotation.write(title,content) - local title, content = title:strip(), content - if annotation.empty == true then - annotation.open() - annotation.empty = false - else - annotation.export:write("\n\n") - end - if title ~= "" then - annotation.export:write(title) - annotation.export:write("\n",rep("-",#title),"\n\n") - content = content:gsub(" \\par ","\n\n") - annotation.export:write(content) - end -end - ---~ function annotation.write(title,content) ---~ local title, content = title:strip(), content ---~ if annotation.empty == true then ---~ annotation.open() ---~ annotation.empty = false ---~ else ---~ annotation.export:write("\n") ---~ end ---~ annotation.export:write(title.." "..content) ---~ end diff --git a/Master/texmf-dist/tex/context/third/annotation/t-annotation.mkvi b/Master/texmf-dist/tex/context/third/annotation/t-annotation.mkvi deleted file mode 100644 index 41ca1531752..00000000000 --- a/Master/texmf-dist/tex/context/third/annotation/t-annotation.mkvi +++ /dev/null @@ -1,1077 +0,0 @@ -%D \module -%D [ file=t-annotation, -%D version=2013.05.27, -%D title=\CONTEXT\ User Module, -%D subtitle=Annotations, -%D author=Wolfgang Schuster, -%D date=\currentdate, -%D copyright=Wolfgang Schuster, -%D email=schuster.wolfgang@googlemail.com, -%D license=GNU General Public License] - -%C Copyright (C) 2011 Wolfgang Schuster -%C -%C This program is free software: you can redistribute it and/or modify -%C it under the terms of the GNU General Public License as published by -%C the Free Software Foundation, either version 3 of the License, or -%C (at your option) any later version. -%C -%C This program is distributed in the hope that it will be useful, -%C but WITHOUT ANY WARRANTY; without even the implied warranty of -%C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -%C GNU General Public License for more details. -%C -%C You should have received a copy of the GNU General Public License -%C along with this program. If not, see <http://www.gnu.org/licenses/>. - -% begin info -% -% title : annotate text blocks -% comment : create todo commands and environments and inline buffers -% status : under development, mkiv only -% -% end info - -%M \usemodule[annotation] -%M \loadsetups[t-annotation.xml] -%M -%M \setupbodyfont[calluna] -%M -%M \definedescription[description][alternative=margin] -%M -%M \setuptyping[typing][bodyfont=] - -%D \subject{\textbackslash defineannotation} -%D -%D \showsetup{defineannotation} -%D -%D \subject{The \tex{setupannotation} command} -%D -%D \showsetup{setupannotation} -%D -%D \startdescription {alternative} -%D With the “alternative” you can control the placement of the anootation block. -%D -%D \starttabulate[|l|p|] -%D \NC \bf Name \NC \bf Description \NC\NR -%D \NC text \EQ inline \NC\NR -%D \NC paragraph \EQ Separate paragraph \NC\NR -%D \NC comment \EQ pdf comment \NC\NR -%D \NC tooltip \EQ \type{\tooltip} \NC\NR -%D \NC inmargin \EQ \type{\inmargin} \NC\NR -%D \NC inleft \EQ \type{\inleft} \NC\NR -%D \NC inright \EQ \type{\inright} \NC\NR -%D \NC margin \EQ \type{\inmargin} \NC\NR -%D \NC leftmargin \EQ \type{\inleft} \NC\NR -%D \NC rightmargin \EQ \type{\inright} \NC\NR -%D \NC innermargin \EQ \type{\ininner} \NC\NR -%D \NC outermargin \EQ \type{\inouter} \NC\NR -%D \NC footnote \EQ \type{\footnote} \NC\NR -%D \NC endnote \EQ \type{\endnote} \NC\NR -%D \NC command \EQ use the “command” key \NC\NR -%D \stoptabulate -%D \stopdescription -%D -%D \startdescription {title} -%D … -%D \stopdescription -%D -%D \startdescription {text} -%D … -%D \stopdescription -%D -%D \startdescription {number} -%D The “number” key let you control whether to show a number or not. Each time -%D you show a number the associated counter is incremented by one. -%D \stopdescription -%D -%D \startdescription {list} -%D … -%D \stopdescription -%D -%D \startdescription {counter} -%D … -%D \stopdescription -%D -%D \startdescription {reference} -%D … -%D \stopdescription -%D -%D \startdescription {left} -%D … -%D \stopdescription -%D -%D \startdescription {right} -%D … -%D \stopdescription -%D -%D \startdescription {next} -%D … -%D \stopdescription -%D -%D \startdescription {display} -%D … -%D \stopdescription -%D -%D \startdescription {paragraph} -%D … -%D \stopdescription -%D -%D \startdescription {command} -%D … -%D \stopdescription -%D -%D \startdescription {export} -%D … -%D \stopdescription -%D -%D \startdescription {before} -%D … -%D \stopdescription -%D -%D \startdescription {after} -%D … -%D \stopdescription -%D -%D \startdescription {inbetween} -%D … -%D \stopdescription -%D -%D \startdescription {spacebefore} -%D … -%D \stopdescription -%D -%D \startdescription {spaceafter} -%D … -%D \stopdescription -%D -%D \startdescription {style} -%D … -%D \stopdescription -%D -%D \startdescription {color} -%D … -%D \stopdescription -%D -%D \startdescription {headstyle} -%D … -%D \stopdescription -%D -%D \startdescription {headcolor} -%D … -%D \stopdescription -%D -%D \startdescription {textstyle} -%D … -%D \stopdescription -%D -%D \startdescription {textcolor} -%D … -%D \stopdescription -%D -%D \startdescription {align} -%D … -%D \stopdescription -%D -%D \startdescription {indenting} -%D … -%D \stopdescription -%D -%D \startdescription {indentnext} -%D This key let you control whether the next paragraph after the annotation block -%D is indented or not. The option is only used for annotation which are set with -%D the “paragraph” or “command” alternative, for “command” this is only true when -%D display is set to “yes” or “auto”. -%D \stopdescription -%D -%D \subject{The \textbackslash annotation command} -%D -%D \showsetup{annotation} -%D \showsetup{startannotation} -%D -%D \subject{Accesing values} -%D -%D As you saw before you can get the content of the title and content blocks -%D with the “command” alternative but there is another way to access -%D the raw values of each element with the following for commands. -%D -%D \startitemize[packed] -%D \item \type{\placeannotationtext} -%D \item \type{\placeannotationtitle} -%D \item \type{\placeannotationnumber} -%D \item \type{\placeannotationcontent} -%D \stopitemize -%D -%D The following example shows you how you can use the commands for yourself -%D in your own defintions for the annotation environment. The \type{\placeannotationtext} -%D commands holds the value you set with the “title” key while \type{\placeannotationnumber} -%D let you access the number countervalue. -%D -%D \subject{Customized Layouts} -%D -%D \subsubject{Example 1} -%D -%D \startbuffer -%D \define[2]\AnnotationCommand -%D {\starttabulate[|l|p|] -%D \NC Text \EQ \rawannotationtext \NC\NR -%D \NC Number \EQ \rawannotationcounter \NC\NR -%D \NC Title \EQ \rawannotationtitle \NC\NR -%D \NC Content \EQ \rawannotationcontent \NC\NR -%D \stoptabulate} -%D -%D \setupannotation -%D [alternative=command, -%D command=\AnnotationCommand, -%D text=Annotation , -%D number=yes] -%D -%D \startannotation {Peter D. Ward} -%D The Earth, as a habitat for animal life, is in old age and -%D has a fatal illness. Several, in fact. It would be happening -%D whether humans had ever evolved or not. But our presence is -%D like the effect of an old-age patient who smokes many packs -%D of cigarettes per day – and we humans are the cigarettes. -%D \stopannotation -%D \stopbuffer -%D -%D \start \typebuffer[option=tex] \getbuffer \stop -%D -%D \subsubject{Example 2} -%D -%D \startbuffer -%D \define[2]\AnnotationCommand -%D {\textrule{#1}#2\textrule} -%D -%D \setupannotation -%D [alternative=command, -%D command=\AnnotationCommand, -%D text=Annotation] -%D -%D \startannotation -%D The Earth, as a habitat for animal life, is in old age and -%D has a fatal illness. Several, in fact. It would be happening -%D whether humans had ever evolved or not. But our presence is -%D like the effect of an old-age patient who smokes many packs -%D of cigarettes per day – and we humans are the cigarettes. -%D \stopannotation -%D \stopbuffer -%D -%D \start \typebuffer \getbuffer \stop -%D -%D \subsubject{Example 3} -%D -%D \startbuffer -%D \define[2]\AnnotationCommand -%D {\startblockquote -%D “#2”\wordright{\placeannotationtitle}% -%D \stopblockquote} -%D -%D \setupannotation -%D [alternative=command, -%D command=\AnnotationCommand] -%D -%D \startannotation {Peter D. Ward} -%D The Earth, as a habitat for animal life, is in old age and -%D has a fatal illness. Several, in fact. It would be happening -%D whether humans had ever evolved or not. But our presence is -%D like the effect of an old-age patient who smokes many packs -%D of cigarettes per day – and we humans are the cigarettes. -%D \stopannotation -%D \stopbuffer -%D -%D \start \typebuffer \getbuffer \stop - -\writestatus{loading}{ConTeXt User Module / Annotations} - -\unprotect - -\startinterface all - \setinterfacevariable {annotation} {annotation} - \setinterfacevariable {tooltip} {tooltip} -\stopinterface - -\startinterface all - \setinterfaceconstant {content} {content} - \setinterfaceconstant {leftsymbol} {leftsymbol} - \setinterfaceconstant {rightsymbol} {rightsymbol} -\stopinterface - -\newconditional\c_annotation_header -\newconditional\c_annotation_display -\newconditional\c_annotation_inline -\newconditional\c_annotation_number -\newconditional\c_annotation_title -\newconditional\c_annotation_paragraph -\newconditional\c_annotation_buffer -\newconditional\c_annotation_rightpage - -\installnamespace {annotation} -\installnamespace {annotationalternative} -\installnamespace {annotationrenderings} -\installnamespace {annotationmethod} -\installnamespace {annotationlevel} - -\installcommandhandler \????annotation {annotation} \????annotation - -\ctxloadluafile{t-annotation} - -\appendtoks - \expandafter\newcount\csname\????annotationlevel\currentannotation\endcsname - \setuevalue {\currentannotation}{\annotation_cmd{\currentannotation}}% - \setuevalue{\e!start\currentannotation}{\annotation_beg{\currentannotation}}% - \setuevalue{\e!stop \currentannotation}{\annotation_end }% - \setuevalue{\e!get \currentannotation}{\annotation_get{\currentannotation}}% -\to \everydefineannotation - -\appendtoks - \definedataset[\currentannotation]% -\to \everydefineannotation - -% each new environment creates a list and a counter with the same, -% one can also use the counter of another environment but in this -% case it has to be set with the “counter” key - -\appendtoks - \letannotationparameter\s!counter\currentannotation -\to \everypresetannotation - -\appendtoks - \edef\p_annotation_counter{\annotationparameter\s!counter}% - \ifx\p_annotation_counter\currentannotation - \registerannotationcounter\currentannotation - \definelist [\currentannotation]% - \definecounter[\currentannotation]% - \synchronizeannotationcounters - \fi -\to \everydefineannotation - -% the \setupannotation command inherits all keys from \setupstructurecounter, -% to do this a single line is necessary which takes care of this - -\installcounterassociation{annotation} - -\appendtoks - \synchronizeannotationcounters -\to \everysetupannotation - -% Code for the annotation environment and command - -\def\annotation_initialize - {\let\m_annotation_name \empty - \let\m_annotation_parameters\empty - % - \setfalse\c_annotation_header - \setfalse\c_annotation_display - \setfalse\c_annotation_inline - \setfalse\c_annotation_number - \setfalse\c_annotation_title - \setfalse\c_annotation_paragraph - \setfalse\c_annotation_buffer - \setfalse\c_annotation_rightpage - % - \let\currentannotationheader \annotation_header_formatted_indeed - \let\currentannotationcontent\annotation_content_formatted_indeed - \let\currentannotationtext \annotation_text_formatted - \let\currentannotationcounter\annotation_counter_formatted - \let\currentannotationtitle \annotation_title_formatted - % - \let\rawannotationheader \annotation_header_raw - \let\rawannotationcontent\annotation_content_raw - \let\rawannotationtext \annotation_text_raw - \let\rawannotationcounter\annotation_counter_raw - \let\rawannotationtitle \annotation_title_raw} - -\unexpanded\def\annotation_beg#environment% - {\begingroup - \annotation_initialize - \edef\currentannotation{#environment}% - \dodoubleempty\annotation_beg_parameters} - -\def\annotation_beg_parameters - {\iffirstargument - \ifsecondargument - \doubleexpandafter\annotation_beg_parameters_two - \else - \doubleexpandafter\annotation_beg_parameters_one - \fi - \else - \expandafter\annotation_beg_parameters_zero - \fi} - -\def\annotation_beg_parameters_two[#name][#parameters]% - {\edef\m_annotation_name {#name}% - \edef\m_annotation_parameters{#parameters}% - \dosinglegroupempty\annotation_beg_title} - -\def\annotation_beg_parameters_one[#name][#parameters]% - {\doifassignmentelse{#name} - {\edef\m_annotation_parameters{#name}} - {\edef\m_annotation_name {#name}}% - \dosinglegroupempty\annotation_beg_title} - -\def\annotation_beg_parameters_zero[#name][#parameters]% - {\dosinglegroupempty\annotation_beg_title} - -\def\annotation_beg_title#title% - {\ctxlua{thirddata.annotation.erasedata("\m_annotation_name")}% - \edef\m_annotation_parameters{\c!reference=,\c!list=,\c!title={#title},\m_annotation_parameters}% - \normalexpanded - {\annotation_environment - \expandafter\noexpand\csname\e!start\currentannotation\endcsname - \expandafter\noexpand\csname\e!stop \currentannotation\endcsname}} - -\unexpanded\def\annotation_environment#1#2% - {\begingroup\obeylines - \def\annotation_collect##1#2% - {\ctxlua{thirddata.annotation.collectdata("\currentannotation","\m_annotation_name",\!!bs\m_annotation_parameters\!!es,\!!bs\normalunexpanded{##1}\!!es,\!!bs#1\!!es,\!!bs#2\!!es,\number\catcodetable)} - \annotation_collect - \annotation_method}% - \annotation_collect} - -\unexpanded\def\annotation_end - {} - -\unexpanded\def\annotation_cmd#environment% - {\begingroup - \annotation_initialize - \edef\currentannotation{#environment}% - \dodoubleempty\annotation_cmd_parameters} - -\def\annotation_cmd_parameters - {\iffirstargument - \ifsecondargument - \doubleexpandafter\annotation_cmd_parameters_two - \else - \doubleexpandafter\annotation_cmd_parameters_one - \fi - \else - \expandafter\annotation_cmd_parameters_zero - \fi} - -\def\annotation_cmd_parameters_two[#name][#parameters]% - {\edef\m_annotation_name {#name}% - \edef\m_annotation_parameters{#parameters}% - \dodoublegroupempty\annotation_cmd_title} - -\def\annotation_cmd_parameters_one[#name][#parameters]% - {\doifassignmentelse{#name} - {\edef\m_annotation_parameters{#name}} - {\edef\m_annotation_name {#name}}% - \dodoublegroupempty\annotation_cmd_title} - -\def\annotation_cmd_parameters_zero[#name][#parameters]% - {\dodoublegroupempty\annotation_cmd_title} - -\def\annotation_cmd_title - {\ifsecondargument - \expandafter\annotation_cmd_content - \else - \expandafter\annotation_cmd_content\expandafter\empty - \fi} - -\def\annotation_cmd_content#title#content% - {\ctxlua{thirddata.annotation.erasedata("\m_annotation_name")}% - \edef\m_annotation_parameters{\c!reference=,\c!list=,\c!title={#title},\m_annotation_parameters}% - \begingroup - \ctxlua{thirddata.annotation.savedata("\currentannotation","\m_annotation_name","\m_annotation_parameters",\!!bs\normalunexpanded{#content}\!!es,\number\catcodetable)}% - \annotation_method} - -\unexpanded\def\annotation_get#environment% - {\begingroup - \annotation_initialize - \edef\currentannotation{#environment}% - \dodoubleempty\annotation_get_parameters} - -\def\annotation_get_parameters - {\iffirstargument - \iffirstargument - \doubleexpandafter\annotation_get_parameters_two - \else - \doubleexpandafter\annotation_get_parameters_one - \fi - \else - \expandafter\annotation_get_parameters_zero - \fi} - -\def\annotation_get_parameters_two[#name][#parameters]% - {\edef\m_annotation_name {#name}% - \edef\m_annotation_parameters{#parameters}% - \annotation_get_content} - -\def\annotation_get_parameters_one[#name][#parameters]% - {\doifassignmentelse{#name} - {\edef\m_annotation_parameters{#name}} - {\edef\m_annotation_name {#name}}% - \annotation_get_content} - -\def\annotation_get_parameters_zero[#name][#parameters]% - {\annotation_get_content} - -\def\annotation_get_content - {\letannotationparameter\c!method\s!default - \settrue\c_annotation_buffer - \edef\m_annotation_parameters{\ctxlua{thirddata.annotation.parameters("\currentannotation","\m_annotation_name")},\m_annotation_parameters}% - \begingroup - \annotation_method} - -\def\annotation_alternative - {\edef\currentannotationalternative {\annotationparameter \c!alternative }% - \edef\p_annotationalternative_renderingsetup{\annotationalternativeparameter\c!renderingsetup}% - \edef\p_annotationalternative_alternative {\annotationalternativeparameter\c!alternative }% - \ifx\p_annotationalternative_alternative\v!vertical - \settrue\c_annotation_display - \else\ifx\p_annotationalternative_alternative\v!horizontal - \settrue\c_annotation_inline - \else\ifx\p_annotationalternative_alternative\v!auto % used for \setupannotation[alternative=command] - \ifx\p_annotation_display\v!yes - \settrue\c_annotation_display - \else\ifx\p_annotation_display\v!no - \settrue\c_annotation_inline - \else - \ifvmode - \settrue\c_annotation_display - \else - \settrue\c_annotation_inline - \fi - \fi\fi - \else\ifx\p_annotationalternative_alternative\v!none % needed for \setupannotation[alternative=none] - \ifhmode - \settrue\c_annotation_inline - \fi - \else - % margin, comment etc. annotations - \fi\fi\fi\fi - \annotation_before - \annotation_tagged_start - \autosetups\p_annotationalternative_renderingsetup - \annotation_tagged_stop - \annotation_after} - -\def\annotation_before - {\ifconditional\c_annotation_display - \edef\p_annotation_spacebefore {\annotationparameter\c!spacebefore }% - \edef\p_annotation_before {\annotationparameter\c!before }% - \edef\p_annotation_spaceafter {\annotationparameter\c!spaceafter }% - \edef\p_annotation_after {\annotationparameter\c!after }% - \edef\p_annotation_inbetween {\annotationparameter\c!inbetween }% - \edef\p_annotation_indenting {\annotationparameter\c!indenting }% - \edef\p_annotation_interlinespace{\annotationparameter\c!interlinespace}% - \ifx\p_annotation_spacebefore\empty - \endgraf - \else - \blank[\p_annotation_spacebefore]% - \fi - \ifx\p_annotation_indenting\empty \else - \setupindenting[\p_annotation_indenting]% - \fi - \ifconditional\c_annotation_paragraph - \ifx\p_annotation_interlinespace\v!empty - \setupinterlinespace - \else - \setupinterlinespace[\p_annotation_interlinespace]% - \fi - \fi - \p_annotation_before - \fi} - -\def\annotation_after - {\ifconditional\c_annotation_display - \p_annotation_after - \ifx\p_annotation_spaceafter\empty - \endgraf - \else - \blank[\p_annotation_spaceafter]% - \fi - \fi} - -% methods - -\unexpanded\def\installannotationmethod#name#command% - {\setvalue{\????annotationmethod#name}{#command}} - -\def\annotation_method - {\endgroup - \expandnamespaceparameter\????annotationmethod\annotationparameter\c!method\s!default} - -\def\annotation_method_default - {\normalexpanded{\annotation_parameters[\m_annotation_parameters]}% - \annotation_alternative - \ifconditional\c_annotation_display - \checknextindentation[\p_annotation_indentnext]% - \glet\annotation_aftergroup\dorechecknextindentation - \else - \ifconditional\c_annotation_inline - \glet\annotation_aftergroup\p_annotation_next - \else - \glet\annotation_aftergroup\GotoPar - \fi - \fi - \aftergroup\annotation_aftergroup - \endgroup} - -\def\annotation_method_buffer - {\endgroup} - -\installannotationmethod \s!default \annotation_method_default -\installannotationmethod \v!buffer \annotation_method_buffer - -% processing - -\def\c_annotation_level{\csname\????annotationlevel\currentparentannotation\endcsname} - -\def\annotation_level - {\let\currentparentannotation\currentannotation - \advance\c_annotation_level\plusone - \chaintocurrentannotation{\currentparentannotation:\number\c_annotation_level}% - \edef\currentannotation{\currentparentannotation:\number\c_annotation_level}} - -\unexpanded\def\annotation_parameters[#parameters]% - {\annotation_level - \setupcurrentannotation[#parameters]% - \useannotationstyleandcolor\c!style\c!color - \edef\p_annotation_number {\annotationparameter\c!number }% - \edef\p_annotation_header {\annotationparameter\c!header }% - \edef\p_annotation_title {\annotationparameter\c!title }% - \edef\p_annotation_text {\annotationparameter\c!text }% - \edef\p_annotation_left {\annotationparameter\c!left }% - \edef\p_annotation_right {\annotationparameter\c!right }% - \edef\p_annotation_stopper {\annotationparameter\c!stopper }% - \edef\p_annotation_reference {\annotationparameter\c!reference }% - \edef\p_annotation_list {\annotationparameter\c!list }% - \edef\p_annotation_counter {\annotationparameter\s!counter }% - \edef\p_annotation_display {\annotationparameter\c!display }% - \edef\p_annotation_paragraph {\annotationparameter\c!paragraph }% - \edef\p_annotation_export {\annotationparameter\c!export }% - \edef\p_annotation_indentnext {\annotationparameter\c!indentnext }% - \edef\p_annotation_next {\annotationparameter\c!next }% - \edef\p_annotation_doublesided{\annotationparameter\c!doublesided}% - \edef\p_annotation_leftmargin {\annotationparameter\c!leftmargin }% - \edef\p_annotation_rightmargin{\annotationparameter\c!rightmargin}% - \ifx\p_annotation_number\v!yes - \settrue\c_annotation_number - \incrementcounter[\p_annotation_counter]% - \fi - \ifx\p_annotation_title\empty \else - \settrue\c_annotation_title - \fi - \ifx\p_annotation_header\v!yes - \ifconditional\c_annotation_number - \settrue\c_annotation_header - \else\ifconditional\c_annotation_title - \settrue\c_annotation_header - \else\ifx\p_annotation_text\empty - % \setfalse\c_annotation_header - \else - \settrue\c_annotation_header - \fi\fi\fi - \fi - \ifx\p_annotation_reference\empty \else - \ifconditional\c_annotation_number - \normalexpanded{\reference[\p_annotation_reference]{\directconvertedcounter\p_annotation_counter\empty}}% - \else - \normalexpanded{\reference[\p_annotation_reference]{{\tttf ??}}}% - \fi - \fi - \ifx\p_annotation_list\empty \else - \ifconditional\c_annotation_number - \normalexpanded{\writetolist[\currentparentannotation]{\directconvertedcounter\p_annotation_counter\empty}{\p_annotation_list}}% - \else - \normalexpanded{\writetolist[\currentparentannotation]{}{\p_annotation_list}}% - \fi - \fi - \ifx\p_annotation_paragraph\v!yes - \settrue\c_annotation_paragraph - \fi - \ifx\p_annotation_doublesided\v!yes - \signalrightpage - \doifrightpageelse\settrue\setfalse\c_annotation_rightpage - \else - \settrue\c_annotation_rightpage - \fi - \ifx\p_annotation_export\v!yes - \ifconditional\c_annotation_header % do this at the lua with the raw text - \begingroup\simplifycommands - \ctxlua{thirddata.annotation.write(\!!bs\annotation_header_raw\!!es,\!!bs\normalexpanded{\noexpand\detokenize{\annotation_content_raw}}\!!es)}% - \endgroup - \fi - \fi} - -\def\annotation_tagged_start - {\ifconditional\c_annotation_inline - \dostarttagged\t!construct\currentparentannotation - \else - \dostarttagged\t!division\currentparentannotation - \fi} - -\def\annotation_tagged_stop - {\dostoptagged} - -% The title and the content of the annotation commands is accesed -% by the following four commands, the formatted version is used -% by alternatives which allow you to change the style and color. -% -% The raw version is used by alternatives where attributes are -% not possible (comment) or undesired (footnotes). - -\unexpanded\def\annotation_header_formatted - {\edef\p_annotation_headcommand{\annotationparameter\c!headcommand}% - \p_annotation_headcommand\annotation_header_formatted_indeed} - -\unexpanded\def\annotation_header_formatted_indeed - {\begingroup - \useannotationstyleandcolor\c!headstyle\c!headcolor - \p_annotation_text - \ifconditional\c_annotation_number - \ifx\p_annotation_text\empty \else - \removeunwantedspaces\space % add space between “text” and “number” when there is text - \fi - \convertedcounter[\p_annotation_counter]% - \fi - \ifconditional\c_annotation_title - \ifx\p_annotation_text\empty - \ifconditional\c_annotation_number \space \fi % add space between “number” and “title” when there is a number - \else - \space % add space between “text” and “title” when there is a text - \fi - \p_annotation_left - \p_annotation_title - \p_annotation_right - \fi - \p_annotation_stopper - \endgroup} - -\unexpanded\def\annotation_content_formatted - {\edef\p_annotation_textcommand{\annotationparameter\c!textcommand}% - \p_annotation_textcommand\annotation_content_formatted_indeed} - -\unexpanded\def\annotation_content_formatted_indeed - {\begingroup - \useannotationstyleandcolor\c!textstyle\c!textcolor - \ifconditional\c_annotation_paragraph\setupinterlinespace\fi - \ctxlua{thirddata.annotation.printdata("\currentparentannotation","\m_annotation_name")}% - \removeunwantedspaces - \ifconditional\c_annotation_paragraph\par\fi - \endgroup} - -\unexpanded\def\annotation_text_formatted - {\begingroup - \useannotationstyleandcolor\c!headstyle\c!headcolor - \annotationparameter\c!text - \endgroup} - -\unexpanded\def\annotation_counter_formatted - {\begingroup - \useannotationstyleandcolor\c!headstyle\c!headcolor - \convertedcounter[\p_annotation_counter]% - \endgroup} - -\unexpanded\def\annotation_title_formatted - {\begingroup - \useannotationstyleandcolor\c!headstyle\c!headcolor - \p_annotation_title - \endgroup} - -\def\annotation_header_raw - {\p_annotation_text - \ifconditional\c_annotation_number - \ifx\p_annotation_text\empty \else - \removeunwantedspaces\space - \fi - \rawcountervalue[\p_annotation_counter]% - \fi - \ifconditional\c_annotation_title - \ifx\p_annotation_text\empty - \ifconditional\c_annotation_number \space \fi - \else - \space - \fi - \p_annotation_left - \p_annotation_title - \p_annotation_right - \fi - \p_annotation_stopper} - -\def\annotation_content_raw{\ctxlua{thirddata.annotation.printdata("\currentparentannotation","\m_annotation_name")}} -\def\annotation_text_raw {\p_annotation_text} -\def\annotation_counter_raw{\rawcountervalue[\p_annotation_counter]} -\def\annotation_title_raw {\p_annotation_title} - -% With the command alternative one can access the formatted content and title -% with the two arguments but it’s also possible to use the raw content of -% each element with the \placeannotation... commands. - -\let\placeannotationtext \annotation_text_raw -\let\placeannotationnumber \annotation_counter_raw -\let\placeannotationtitle \annotation_title_raw -\let\placeannotationcontent\annotation_content_raw - -% Condtionals for the users to check whether your’re in vertical or -% horizontal mode, they are usefull when you want a command which -% works different depenedent on the mode. - -\unexpanded\def\doifdisplayannotation - {\ifconditional\c_annotation_display - \expandafter\firstofoneargument - \else - \expandafter\gobbleoneargument - \fi} - -\unexpanded\def\doifelsedisplayannotation - {\ifconditional\c_annotation_display - \expandafter\firstoftwoarguments - \else - \expandafter\secondoftwoarguments - \fi} - -\unexpanded\def\doifinlineannotation - {\ifconditional\c_annotation_inline - \expandafter\firstofoneargument - \else - \expandafter\gobbleoneargument - \fi} - -\unexpanded\def\doifelseinlineannotation - {\ifconditional\c_annotation_inline - \expandafter\firstoftwoarguments - \else - \expandafter\secondoftwoarguments - \fi} - -% All layouts for the annotation commands are accessible with the alternative key, -% the relation between the key values and the internal layout is done with the -% following command. This command is not meant for user because they should always -% use the command alternative for their own layouts but the author will add new -% layouts if they are usefull. - -\installcommandhandler \????annotationalternative {annotationalternative} \????annotationalternative - -\defineannotationalternative - [\v!text] - [ \c!alternative=\v!horizontal, - \c!renderingsetup=\????annotationrenderings:\v!text] - -\startsetups[\????annotationrenderings:\v!text] - \ifconditional\c_annotation_header - \annotation_header_formatted\space - \fi - \annotation_content_formatted -\stopsetups - -\defineannotationalternative - [\v!paragraph] - [ \c!alternative=\v!vertical, - \c!renderingsetup=\????annotationrenderings:\v!paragraph] - -\startsetups[\????annotationrenderings:\v!paragraph] - \ifconditional\c_annotation_header - \noindent\annotation_header_formatted - \p_annotation_inbetween - \fi - \annotation_content_formatted -\stopsetups - -\defineannotationalternative - [\v!narrow] - [ \c!alternative=\v!vertical, - \c!renderingsetup=\????annotationrenderings:\v!narrow] - -\startsetups[\????annotationrenderings:\v!narrow] - \ifconditional\c_annotation_rightpage - \doadaptleftskip \p_annotation_leftmargin - \doadaptrightskip\p_annotation_rightmargin - \else - \doadaptleftskip \p_annotation_rightmargin - \doadaptrightskip\p_annotation_leftmargin - \fi - \annotation_content_formatted -\stopsetups - -\defineannotationalternative - [\v!comment] - [\c!renderingsetup=\????annotationrenderings:\v!comment] - -\startsetups[\????annotationrenderings:\v!comment] - \begingroup\simplifycommands - \doifsomething{\annotationparameter\c!color}{\setupcomment[\c!color=\annotationparameter\c!color]} - \removeunwantedspaces - \ifconditional\c_annotation_header - \inmargin[\c!stack=\v!yes]{\normalexpanded{\comment[\annotation_header_raw]{\annotation_content_raw}}} - \else - \inmargin[\c!stack=\v!yes]{\normalexpanded{\comment{\annotation_content_raw}}} - \fi - \endgroup -\stopsetups - -\defineannotationalternative - [\v!tooltip] - [\c!renderingsetup=\????annotationrenderings:\v!tooltip] - -\startsetups[\????annotationrenderings:\v!tooltip] - \ifconditional\c_annotation_title\else\removeunwantedspaces\fi - \tooltip[\annotationparameter\c!location]{\annotation_title_raw}{\annotation_content_raw} -\stopsetups - -\defineannotationalternative - [\v!inmargin] - [\c!command=\inmargin, - \c!renderingsetup=\????annotationrenderings:\v!margin] - -\defineannotationalternative - [\v!margin] - [\c!command=\inmargin, - \c!renderingsetup=\????annotationrenderings:\v!margin] - -\defineannotationalternative - [\v!inleft] - [\c!command=\inleft, - \c!renderingsetup=\????annotationrenderings:\v!margin] - -\defineannotationalternative - [\v!leftmargin] - [\c!command=\inleft, - \c!renderingsetup=\????annotationrenderings:\v!margin] - -\defineannotationalternative - [\v!inright] - [\c!command=\inright, - \c!renderingsetup=\????annotationrenderings:\v!margin] - -\defineannotationalternative - [\v!rightmargin] - [\c!command=\inright, - \c!renderingsetup=\????annotationrenderings:\v!margin] - -\defineannotationalternative - [\v!innermargin] - [\c!command=\ininner, - \c!renderingsetup=\????annotationrenderings:\v!margin] - -\defineannotationalternative - [\v!outermargin] - [\c!command=\inouter, - \c!renderingsetup=\????annotationrenderings:\v!margin] - -\startsetups[\????annotationrenderings:\v!margin] - \edef\p_annotation_command{\annotationalternativeparameter\c!command}% - \ifx\p_annotation_command\empty \else - \p_annotation_command{\annotationparameter\c!before - \ifconditional\c_annotation_header - \annotation_header_formatted - \fi - \annotationparameter\c!inbetween - \annotation_content_formatted - \annotationparameter\c!after} - \fi -\stopsetups - -\defineannotationalternative - [\v!footnote] - [ \c!alternative=\v!horizontal, - \c!renderingsetup=\????annotationrenderings:\v!footnote] - -\startsetups[\????annotationrenderings:\v!footnote] - \normalexpanded{\footnote{\annotation_content_raw}} -\stopsetups - -\defineannotationalternative - [\v!endnote] - [ \c!alternative=\v!horizontal, - \c!renderingsetup=\????annotationrenderings:\v!endnote] - -\startsetups[\????annotationrenderings:\v!endnote] - \normalexpanded{\endnote{\annotation_content_raw}} -\stopsetups - -\defineannotationalternative - [\v!command] - [ \c!alternative=\v!auto, - \c!renderingsetup=\????annotationrenderings:\v!command] - -\startsetups[\????annotationrenderings:\v!command] - \edef\p_annotation_command{\annotationparameter\c!command}% - \ifx\p_annotation_command\empty \else - \p_annotation_command\annotation_header_formatted\annotation_content_formatted - \fi -\stopsetups - -\defineannotationalternative - [\v!quotation] - [ \c!alternative=\v!horizontal, - \c!renderingsetup=\????annotationrenderings:\v!quotation] - -\startsetups[\????annotationrenderings:\v!quotation] - \annotationparameter\c!leftsymbol - \annotation_content_raw\removeunwantedspaces - \annotationparameter\c!rightsymbol -\stopsetups - -\defineannotationalternative - [\v!none] - [\c!renderingsetup=\????annotationrenderings:\v!none] - -\startsetups[\????annotationrenderings:\v!none] - \removeunwantedspaces -\stopsetups - -% The module provides the option to write the content of each command to a external -% file. The values for the option are defined with \defineannotationexport and can -% be changed with \setupannotationexport. - -% \definenamespace -% [annotationexport] -% [ type=module, -% comment=Annotationexport, -% version=2011.02.17, -% name=annotationexport, -% style=no, -% command=yes, -% setup=yes, -% \s!parent=annotationexport] -% -% \appendtoks -% \ctxlua{thirddata.annotation.export_define{...}}% -% \to \everydefineannotationexport -% -% \appendtoks -% \ctxlua{thirddata.annotation.export_setup{...}}% -% \to \everysetupannotationexport -% -% \defineannotationexport[\v!yes][\c!type=\v!default] -% \defineannotationexport[\v!org][\c!type=\v!org] - -% To make the module usefull even if there is no annotation command in a document -% i predefine here the command \annotation. As the command is created with -% \defineannotation you can make specific setups for this command with -% \setupannotation[annotation][...] which won’t affect all other commands. - -\defineannotation[\v!annotation] - -% Finally i set default values for all commands, you can change them in -% your document but all or individual annotation commands. - -\setupannotation - [ \c!headstyle=\v!bold, - \c!left=(, - \c!right=), - \c!spacebefore=\v!line, - \c!spaceafter=\annotationparameter\c!spacebefore, - \c!inbetween=\blank, - \c!alternative=\v!paragraph, - \c!paragraph=\v!no, - \c!number=\v!no, - \c!header=\v!yes, - \c!export=\v!no, - \c!indenting=\v!never, - \c!indentnext=\v!yes, - \c!next=\autoinsertnextspace] - -\setupannotationalternative - [\c!alternative=\v!none] - -% \setupannotationexport -% [ \c!mode=\v!default, -% \c!name=\v!annotation, -% \c!extension=\s!txt] - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/third/bnf/t-bnf.tex b/Master/texmf-dist/tex/context/third/bnf/t-bnf.tex deleted file mode 100644 index 3f40c3e7971..00000000000 --- a/Master/texmf-dist/tex/context/third/bnf/t-bnf.tex +++ /dev/null @@ -1,195 +0,0 @@ -%D \module -%D [ file=t-bnf, -%D version=2004.6.23, -%D title=\CONTEXT\ BNF Grammar Module, -%D subtitle=Grammars, -%D author={Nikolai Weibull}, -%D date=\currentdate, -%D copyright={Nikolai Weibull}] -%C -%C This module is NOT part of the \CONTEXT\ macro||package. -%C This module is free software; you can redistribute it and/or modify -%C it under the terms of the GNU General Public License as published by -%C the Free Software Foundation; either version 2 of the License, or -%C (at your option) any later version. -%C -%C This module is distributed in the hope that it will be useful, -%C but WITHOUT ANY WARRANTY; without even the implied warranty of -%C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -%C GNU General Public License for more details. -%C -%C You should have received a copy of the GNU General Public License -%C along with this program; if not, write to the Free Software -%C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -\writestatus{loading}{BNF Macros / Initialization} - -\unprotect - -%M \usemodule[bnf] -%D We define a new system variable for our settings: - -\definesystemvariable{bnf} - -%D We need some constants for the multi||lingual interface, - -\startconstants english dutch - terminalstart: terminalstart terminalstart - terminalstop: terminalstop terminalstop - nonterminalstart: nonterminalstart nonterminalstart - nonterminalstop: nonterminalstop nonterminalstop - is: is worden -\stopconstants - -%D and while we're at it, lets define some variables. - -\startvariables english dutch - bnfgrammar: bnfgrammar bnfspraakleer - bnfgrammars: bnfgrammars bnfspraakleer -\stopvariables - -%D Finally, we want the commands to be multi||lingually accessible, so we set -%D that up as well: - -\startcommands english dutch - setupbnfgrammar: setupbnfgrammar stelbnfspraakleer - startbnfgrammar: startbnfgrammar startbnfspraakleer - stopbnfgrammar: stopbnfgrammar startbnfspraakleer -\stopcommands - -%D \macros -%D {startbnfgrammar, stopbnfgrammar} -%D -%D Now to the interesting parts, those that are actually useful to the outside -%D world. First we have the \type{\startbnfgrammar} and \type{\stopbnfgrammar} -%D pairs, which are of course used to delimit \BNF\ grammars. We would like to -%D define \type{\startbnfgrammar} as \type{\def\startbnfgrammar[#1]}, but a bug -%D in \CONTEXT\ prevents us from doing this, as the first character in the -%D grammar may be active, for example \type{<}, but while checking for the -%D presence of \type{[}, it gets ruined. A way around it is of course to -%D require that the user pass an empty \type{[]} pair, and we will use this -%D method at the moment. - -\def\complexstartbnfgrammar[#1]% - {\endgraf\nobreak\medskip - \begingroup - \setupbnfgrammar[#1]% - \chardef\bnfsinglequote=`' - \defineactivecharacter : {\@@bnfis} - \defineactivecharacter | {\@@bnfoption} - \defineactivecharacter " % - {\thinspace\bgroup\@@bnfterminalstart\setupinlineverbatim% - \defineactivecharacter " {\@@bnfterminalstop\egroup\thinspace}} - \defineactivecharacter ' % - {\thinspace\bgroup\@@bnfterminalstart\setupinlineverbatim% - \defineactivecharacter ' {\@@bnfterminalstop\egroup\thinspace}} - \catcode`<=13 - \let\par=\bnfgrammarline - \obeylines} - -\def\stopbnfgrammar{\medbreak\checknextindentation[\@@bnfindentnext]} - -\definecomplexorsimpleempty\startbnfgrammar - -%D \macros -%D {<>,bnfgrammarrule} -%D -%D We need a couple more macros to deal with the interior of a \BNF\ grammar. -%D \type{\<>} is used for non||terminals, and \type{\bnfgrammarrule} is used -%D later on in \type{\bnfgrammarswitch} for continuing a line. - -\def\<#1>{\leavevmode\hbox{\@@bnfnonterminalstart#1\/\@@bnfnonterminalstop}} - -\bgroup - \catcode`<=13 - \global\let<=\< - \gdef\bnfgrammarrule<#1>{\endgraf\indent\<#1>} -\egroup - -%D \macros -%D {bnfgrammarline, bnfgrammarswitch, bnfgrammarcont} -%D -%D These macros deal with the ending of a line in a grammar. -%D \type{\bnfgrammarline} is called whenever a new line begins, and invokes -%D \type{\bnfgrammarswitch} to determine what to do next. If the next token is -%D \type{\<}, we will call upon \type{\bnfgrammarrule} to deal with the new -%D rule. If it is \type{\stopbnfgrammar}, we end the top||level group, and let -%D it process \type{\stopbnfgrammar} afterwards. Otherwise we invoke -%D \type{\bnfgrammarcont}, which will end the line and add some indentation to -%D the continuing line. - -\def\bnfgrammarline{\futurelet\next\bnfgrammarswitch} -\def\bnfgrammarswitch% - {\ifx\next\< - \let\next=\bnfgrammarrule - \else\ifx\next\stopbnfgrammar - \let\next=\endgroup - \else - \let\next=\bnfgrammarcont - \fi\fi - \next} -\def\bnfgrammarcont{\hfil\break\indent\qquad} - -%D \macros -%D {setupbnfgrammar} -%D -%D We want to allow our users to change the way the \BNF\ grammars are typeset, -%D so we define a setup command for them to use. -%D -%D It allows you to define the start and stop sequence for terminals and -%D non||terminals, as well as colons (lhs / rhs separator) and vertical bars -%D (alternative), and commas. This has been multi||lingualized above, so -%D choose your language. - -\def\dosetupbnfgrammar[#1]% - {\getparameters[\??bnf][#1]} - -\def\setupbnfgrammar% - {\dosingleargument\dosetupbnfgrammar} - -\setupbnfgrammar - [\c!terminalstart=\tttf, - \c!terminalstop=, - \c!nonterminalstart=\mathematics{\langle}, - \c!nonterminalstop=\mathematics{\rangle}, - \c!is={ \mathematics{\longrightarrow}}, - \c!option=\mathematics{\vert}, - \c!indentnext=\v!no] - -%D \macros -%D {BNF} -%D -%D We also define a useful abbreviation to be used for header texts and labels. - -\logo[BNF]{bnf} - -%D And we use it here: - -\setupheadtext[\s!en][\v!bnfgrammar=\BNF\ Grammar] -\setupheadtext[\s!en][\v!bnfgrammars=\BNF\ Grammars] -\setuplabeltext[\s!en][\v!bnfgrammar=\BNF\ Grammar ] - -%D Finally we define a float to be use with \BNF\ grammars, so that we can -%D finish off with something like this: -%D -%D \startbuffer -%D \placebnfgrammar -%D [][] -%D {An example of a placed grammar.} -%D {\startbnfgrammar[] -%D <exp>: <num> | <num> "+" <num> -%D <num>: "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" -%D \stopbnfgrammar} -%D \stopbuffer -%D -%D \typebuffer -%D -%D \getbuffer -%D -%D which looks kind of nice. - -\definefloat - [\v!bnfgrammar] - [\v!bnfgrammars] - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/third/chromato/t-chromato.tex b/Master/texmf-dist/tex/context/third/chromato/t-chromato.tex deleted file mode 100644 index 0ab8ab35d86..00000000000 --- a/Master/texmf-dist/tex/context/third/chromato/t-chromato.tex +++ /dev/null @@ -1,130 +0,0 @@ -%D \module -%D [ file=t-chromato, -%D version=2008.04.05, -%D title=\CONTEXT\ User Module, -%D subtitle=Macros for chromatograms, -%D author=Peter Münster, -%D date=\currentdate, -%D copyright={Peter Münster}] -%C This module is copyrighted by Peter Münster. -%C Please send any comments to pmrb at free.fr. - -% This program is free software; you can redistribute it and/or -% modify it under the terms of the GNU General Public License -% as published by the Free Software Foundation; either version 2 -% of the License, or (at your option) any later version. - -% This program is distributed in the hope that it will be useful, -% but without any warranty; without even the implied warranty of -% merchantability or fitness for a particular purpose. See the -% GNU General Public License for more details. - -\startmodule[chromato] - -\writestatus{loading}{Macros for chromatograms} - -\unprotect - -%D Some internal dimensions: -\doifundefined{Width}{\newdimen\Width} -\doifundefined{Height}{\newdimen\Height} - -%D \macros{startChromato} -%D Starting a chromatogram. -\def\startChromato{\bgroup\dosingleempty\dostartChromato} -\def\dostartChromato[#1]#2#3{\getparameters[CHROM][dim=0.6,#1] - \def\myChromFig{\doifdefinedelse{CHROMSdim}{% - \externalfigure[#2][height=\CHROMSdim\textheight]}{% - \externalfigure[#2][width=\CHROMdim\makeupwidth]}}% - \setbox\scratchbox\hbox{\myChromFig}% - \Width=\wd\scratchbox \Height=\ht\scratchbox \setuppositioning[unit=pt] - \gdef\SavedCaption{#3}\doifundefined{CHROMSdim}{\placefigure[][fig:#2]{#3}}% - \bgroup\startpositioning\position(0,0){\myChromFig}} - -%D \macros{stopChromato} -%D End of chromatogram. -\def\stopChromato{\stoppositioning\egroup\egroup{\doifdefined{CHROMSdim}{% - \SavedCaption}}} - -%D \macros{startChromatos} -%D Begin set of chromatograms. -\def\startChromatos{\dosingleempty\dostartChromatos} -\def\dostartChromatos[#1]#2#3{\placefigure[][fig:#2]{#3}\bgroup - \getparameters[CHROMS][dim=0.3,#1] - \doifdefined{CHROMSdist}{\setupcombinations[distance=\CHROMSdist em]}% - \startcombination[2*1]} - -%D \macros{stopChromatos} -%D End of chromatograms. -\def\stopChromatos{\stopcombination\egroup} - -%D Internal macro: position left or right: -\define[3]\LRposition{\edef\YPos{\withoutpt{\the\dimexpr(\withoutpt{% - \the\dimexpr(#1pt/100)}\Height - 0.1\baselineskip)}}% - \position(#2,\YPos){\vbox to 2pt{\vss{\hbox to 0pt{#3}\vss}}}} - -%D \macros{Lbrace} -%D Place a brace at the left. -\define[4]\Lbrace{\LRposition{#1}0{\hss\rotate[rotation=90]{% - $\overbrace{\hskip#2\Height}^{% - \displaystyle\text{\rotate[rotation=270]{#4}}}$}\hskip#3em}} - -%D \macros{Rbrace} -%D Place a brace at the right. -\define[4]\Rbrace{\LRposition{#1}{\withoutpt{\the\Width}}{\hskip#3em - \rotate[rotation=270]{$\overbrace{\hskip#2\Height}^{% - \displaystyle\text{\rotate[rotation=90]{#4}}}$}\hss}} - -%D \macros{Larrow} -%D Place a flesh at the left. -\define[2]\Larrow{\LRposition{#1}0{\hss{\tx#2} $\rightarrow$}} - -%D \macros{Rarrow} -%D Place a flesh at the right. -\define[2]\Rarrow{\LRposition{#1}{\withoutpt{\the\Width}}{$\leftarrow$ \tx#2}} - -%D \macros{Above,Abrace} -%D Place something above the chromatogram. -\define[3]\Oposition{\edef\XPos{\withoutpt{\the\dimexpr(\withoutpt{% - \the\dimexpr(#1pt/100)}\Width)}}% - \position(\XPos,-\withoutpt{\the\dimexpr(#2\baselineskip)}){% - \hbox to 0pt{\hss#3\hss}}} -\define[2]\Above{\Oposition{#1}{0.8}{\tx#2}} -\define[3]\Abrace{\Oposition{#1}{2.5}{% - $\overbrace{\hskip#2\Width}^{\displaystyle\text{#3}}$}} - -\protect - -\stopmodule - -\doifnotmode{demo}{\endinput} - -%D Usage example: -\usemodule[chromato] -\setupexternalfigures[directory=samples] -\mainlanguage[de] -\starttext -\startChromato{ecolizeit}{Expression der rekombinanten Fucosyltransferase~V in - {\em E.~coli}.} - \Above{5}{BRS}\Above{15}{1h}\Above{26}{2h}\Above{38}{3h}\Above{50}{4h} - \Above{61}{1h}\Above{72}{2h}\Above{83}{3h}\Above{94}{4h} - \Larrow{12}{97\,kDa}\Larrow{20}{66\,kDa} - \Larrow{32}{45\,kDa}\Larrow{52}{31\,kDa} - \Lbrace{39}{0.75}{4}{A} - \Lbrace{90}{0.16}{4}{B} - \Abrace{32}{0.42}{löslich} - \Abrace{77}{0.42}{unlöslich} - \Rarrow{29}{FucT~V}\Rarrow{87}{FucT~V} -\stopChromato -\startChromatos[dim=0.17,dist=2]{saeuger}{Expression von rekombinanter - Fucosyltransferase~V in unterschiedlichen Säugerzellinien.} - \startChromato{saeuger}{A} - \Above{26}{CHO}\Above{74}{HEK} - \Larrow{4}{96\,kDa}\Larrow{37}{66\,kDa}\Larrow{81}{45\,kDa} - \stopChromato - \startChromato{saeugerred}{B} - \Above{26}{CHO}\Above{74}{HEK} - \Rarrow{81}{FucT~V} - \stopChromato -\stopChromatos -\stoptext diff --git a/Master/texmf-dist/tex/context/third/cmscbf/t-cmscbf.tex b/Master/texmf-dist/tex/context/third/cmscbf/t-cmscbf.tex deleted file mode 100644 index b3903fa7614..00000000000 --- a/Master/texmf-dist/tex/context/third/cmscbf/t-cmscbf.tex +++ /dev/null @@ -1,42 +0,0 @@ -%D \useregime[il9] -%D \enableregime[il9] -%D \module -%D [ file=t-cmscbf, -%D version=2006.09.12, -%D title=\CONTEXT\ User Module, -%D subtitle=Bold Small Caps for Computer/Latin Modern, -%D author=Peter Mnster, -%D date=\currentdate, -%D copyright={Peter Mnster}] -%C This module is copyrighted by Peter Mnster. -%C Please send any comments to pmrb at free.fr. - -% This program is free software; you can redistribute it and/or -% modify it under the terms of the GNU General Public License -% as published by the Free Software Foundation; either version 2 -% of the License, or (at your option) any later version. - -% This program is distributed in the hope that it will be useful, -% but without any warranty; without even the implied warranty of -% merchantability or fitness for a particular purpose. See the -% GNU General Public License for more details. - -\writestatus{loading}{Bold Small Caps for Computer/Latin Modern} - -\definebodyfont[15pt,14pt,13pt,12pt,11pt,10pt,9pt,8pt,7pt,6pt,5pt] - [sc] [bf=cmbcsc10 sa 1, tf=cmcsc10 sa 1] - -%D Hint: when producing PDF, adjust your resolution with -%D \type{\pdfpkresolution=xxx} - -\doifnotmode{demo}{\endinput} - -%D Usage example: -\usemodule[cmscbf] -\useregime[il9] -\enableregime[il9] -\pdfpkresolution=1200 -\starttext -{\sc Normal and \bf bold Small Caps.} -{\sc \bf } -\stoptext diff --git a/Master/texmf-dist/tex/context/third/cmttbf/t-cmttbf.tex b/Master/texmf-dist/tex/context/third/cmttbf/t-cmttbf.tex deleted file mode 100644 index 77618732dd6..00000000000 --- a/Master/texmf-dist/tex/context/third/cmttbf/t-cmttbf.tex +++ /dev/null @@ -1,45 +0,0 @@ -%D \useregime[il9] -%D \enableregime[il9] -%D \module -%D [ file=t-cmttbf, -%D version=2006.09.12, -%D title=\CONTEXT\ User Module, -%D subtitle=Bold Typewriter for Computer/Latin Modern, -%D author=Peter Mnster, -%D date=\currentdate, -%D copyright={Peter Mnster}] -%C This module is copyrighted by Peter Mnster. -%C Please send any comments to pmrb at free.fr. - -% This program is free software; you can redistribute it and/or -% modify it under the terms of the GNU General Public License -% as published by the Free Software Foundation; either version 2 -% of the License, or (at your option) any later version. - -% This program is distributed in the hope that it will be useful, -% but without any warranty; without even the implied warranty of -% merchantability or fitness for a particular purpose. See the -% GNU General Public License for more details. - -\writestatus{loading}{Bold Typewriter for Computer/Latin Modern} - -\definebodyfont[15pt,14pt,13pt,12pt,11pt,10pt] [tt] [bf=cmbtt10 sa 1] -\definebodyfont[9pt] [tt] [bf=cmbtt9] -\definebodyfont[8pt,7pt,6pt,5pt] [tt] [bf=cmbtt8 sa 1] -%\definebodyfont[15pt,14pt,13pt,12pt,11pt,10pt,9pt,8pt,7pt,6pt,5pt] -% [tt] [bf=cmttb10 sa 1] - -%D Hint: when producing PDF, adjust your resolution with -%D \type{\pdfpkresolution=xxx} - -\doifnotmode{demo}{\endinput} - -%D Usage example: -\usemodule[cmttbf] -\useregime[il9] -\enableregime[il9] -\pdfpkresolution=1200 -\starttext -{\tt Normal and \bf bold Typewriter.} -{\tt \bf } -\stoptext diff --git a/Master/texmf-dist/tex/context/third/construction-plan/t-construction-plan.tex b/Master/texmf-dist/tex/context/third/construction-plan/t-construction-plan.tex deleted file mode 100644 index bb48bbf055d..00000000000 --- a/Master/texmf-dist/tex/context/third/construction-plan/t-construction-plan.tex +++ /dev/null @@ -1,150 +0,0 @@ -%D \module -%D [ file=t-construction-plan, -%D version=2008.04.05, -%D title=\CONTEXT\ User Module, -%D subtitle=Construction plans, -%D author=Peter Münster, -%D date=\currentdate, -%D copyright={Peter Münster}] -%C This module is copyrighted by Peter Münster. -%C Please send any comments to pmrb at free.fr. - -% This program is free software; you can redistribute it and/or -% modify it under the terms of the GNU General Public License -% as published by the Free Software Foundation; either version 2 -% of the License, or (at your option) any later version. - -% This program is distributed in the hope that it will be useful, -% but without any warranty; without even the implied warranty of -% merchantability or fitness for a particular purpose. See the -% GNU General Public License for more details. - -\writestatus{loading}{Typesetting construction plans} - -\unprotect - -%D We need a lot of space. -\setuplayout[header=0pt,footer=0pt,backspace=2cm,width=middle, - topspace=1cm,height=middle] - -%D Doing pagenumbering on our own. -\setuppagenumbering[state=stop] - -%D \macros -%D {setupPlan} -%D -%D Setting up some values. -%D -%D Default setup: -%D -%D \starttyping -%D \setupPlan[paper=A3,project=,author=,prec=10] -%D \stoptyping -%D -%D Example: -%D -%D \starttyping -%D \setupPlan[paper=A3,project=My garage,author=Peter Münster, -%D prec=Precision factor for figure width] -%D \stoptyping -\def\setupPlan[#1]{\getparameters[CP][#1]} -\setupPlan[paper=A4,project=,author=,date=,prec=10] - -%D Support for more than one language! -\setuplabeltext[fr][project=Projet,author=Auteur,date=Date,scale=Échelle] -\setuplabeltext[en][project=Project,author=Author,date=Date,scale=Scale] -\setuplabeltext[de][project=Projekt,author=Autor,date=Datum,scale=Maßstab] - -%D \macros -%D {Plan} -%D -%D Makes a page with a plan and some comments below it. -%D -%D Example: -%D -%D \starttyping -%D \Plan[Prefix=file prefix,Scale=scale of figure,mm=width of figure in mm, -%D Title=title of plan] -%D \stoptyping -%D -%D If you want to include the file \type{plan-20000.eps} you have to use -%D \type{Prefix=plan,mm=20000}. -%D -%D Sample document: -%D -%D \starttyping -%D \usemodule[construction-plan] -%D \mainlanguage[fr] % or better: \usemodule[french] -%D \starttext -%D \Plan[Prefix=situ,Scale=2000,mm=351000,Title=Plan de situation] -%D \Plan[Prefix=masse,Scale=400,mm=66000,Title=Plan de masse] -%D \Plan[Prefix=nord,Scale=100,mm=20906,Title=Façade nord] -%D \Plan[Prefix=sud,mm=18900,Title=Façade sud] -%D \Plan[Prefix=west,mm=23390,Title=Pignon ouest] -%D \Plan[Prefix=ost,mm=23513,Title=Pignon est] -%D \Plan[Prefix=rdc,mm=18456,Title=Rez-de-chaussée] -%D \Plan[Prefix=etage,mm=16695,Title=Étage] -%D \Plan[Prefix=haus1,Scale=150,mm=30000,Title=Simulation 1] -%D \Plan[Prefix=haus2,Scale=100,mm=20000,Title=Simulation 2] -%D \stoptext -%D \stoptyping - -\def\@BottomLine{{\tx\doifsomething\CPproject{% - \labeltext{project}: \CPproject, }% - \doifsomething\CPauthor{\labeltext{author}: \CPauthor, }% - \labeltext{date}: \doifelsenothing\CPdate\currentdate\CPdate}\hfill} - -\newdimen\CPwidth \newdimen\CPheight -\def\Plan[#1]{% - \getparameters[CP][#1] - \CPwidth=\dimexpr(\the\numexpr(\CPprec*\CPmm/\CPscale)mm/\CPprec) - \def\CPfig{\externalfigure[\CPprefix-\CPmm][width=\the\CPwidth]}% - \setbox\scratchbox\hbox{\CPfig}\CPheight=\ht\scratchbox - \ifdim\CPwidth>1.1\CPheight - \setuppapersize[\CPpaper,landscape,rotated][\CPpaper] - \else - \setuppapersize[\CPpaper][\CPpaper] - \fi - \startstandardmakeup - \midaligned{\CPfig}\vfil\@BottomLine - \framed[align=lohi,offset=2ex]{{\bfc\CPtitle}\blank - \labeltext{scale}: 1/\CPscale\quad\hfill(\currentpage/\lastpage)}% - \vskip0pt plus -1fil - \stopstandardmakeup} - -%D \macros -%D {NoPlan} -%D -%D Makes a page with some content and some comments below it. -%D -%D Example: -%D -%D \starttyping -%D \NoPlan[Title=Some notes]{Here are some notes about the plans.} -%D \stoptyping - -\long\def\NoPlan[#1]#2{% - \getparameters[CP][#1] - \setuppapersize[\CPpaper][\CPpaper] - \startstandardmakeup - #2\vfil\@BottomLine - \framed[align=lohi,offset=2ex]{{\bfc\CPtitle}\blank - (\currentpage/\lastpage)}\vskip0pt plus -1fil - \stopstandardmakeup} - -\protect - -\doifnotmode{demo}{\endinput} - -%D Usage example: -\usemodule[construction-plan] -\setupexternalfigures[directory=samples] -\mainlanguage[de] -\setupPlan[paper=A3,project=Mein Haus,prec=15] -\starttext -\Plan[prefix=unten,scale=100,mm=21478,title=Erdgeschoß] -\Plan[prefix=oben,mm=21345,title=Obergeschoß] -\Plan[prefix=simulation,scale=250,mm=80000,title=Simulation] -\NoPlan[title=Notizen,paper=A4]{\tfb\setupinterlinespace - Einige Notizen, die das Bauvorhaben beschreiben...} -\stoptext diff --git a/Master/texmf-dist/tex/context/third/degrade/t-degrade.tex b/Master/texmf-dist/tex/context/third/degrade/t-degrade.tex deleted file mode 100644 index b2dbba495c3..00000000000 --- a/Master/texmf-dist/tex/context/third/degrade/t-degrade.tex +++ /dev/null @@ -1,163 +0,0 @@ -%D \enableregime[utf] -%D \module -%D [ file=t-degrade, -%D version=2006.09.12, -%D title=\CONTEXT\ User Module, -%D subtitle=Degrading JPEG images, -%D author=Peter Münster, -%D date=\currentdate, -%D copyright={Peter Münster}] -%C This module is copyrighted by Peter Münster. -%C Please send any comments to pmrb at free.fr. - -% This program is free software; you can redistribute it and/or -% modify it under the terms of the GNU General Public License -% as published by the Free Software Foundation; either version 2 -% of the License, or (at your option) any later version. - -% This program is distributed in the hope that it will be useful, -% but without any warranty; without even the implied warranty of -% merchantability or fitness for a particular purpose. See the -% GNU General Public License for more details. - -\writestatus{loading}{Degrading JPEG images on the fly} - -\unprotect - -%D In this module we suppose, that original figures are either eps or jpg. -%D When creating pdf, eps is converted to pdf, and when creating dvi, -%D jpg is converted to eps. -%D Furthermore, jpg-images can be degraded to a given resolution, to get -%D smaller documents. - -%D When -%D \type{http://context.literatesolutions.com/collector/63} -%D is solved, we can make it better using \type{\appliedfigurefilename}, -%D \type{\figurewidth} etc, and without redefining \type{\externalfigure}. - -%D \macros{setupDegrade} -%D Sets the resolution, the directory for degraded images and the -%D directory, where the original images can be found (source directory). -%D -%D Default setup: -%D -%D \starttyping -%D \setupDegrade[Res=100,Dir=degrade,SDir=.] -%D \stoptyping -%D -%D Example: -%D -%D \starttyping -%D \setupDegrade[Res=600,Dir=degraded-images,SDir=/home/peter/jpegs] -%D \stoptyping - -\def\setupDegrade[#1]{\getparameters[Deg][#1]} -\setupDegrade[Res=100,Dir=degrade,SDir=.] - -%D In order to use this module, you must use \type{\externalfigure} -%D in the following way: \type{\externalfigure[file-prefix][options]}, -%D where \type{options} must contain the width or the height. -%D Furthermore, \type{\write18} must be enabled. -%D The shell-script is in a buffer, just to keep this module in only -%D one file. - -\startbuffer[degrade-script] -#!/bin/bash - -# We consider, that original figures are either eps or jpg. - -# Arguments: -# $1 = filename -# $2 = eps or pdf -# $3 = w or h -# $4 = resolution -# $5 = dimension of image -# $6 = source directory -# $7 = destination directory - -for i in jpeg2ps convert identify bc; do - if ! type $i &>/dev/null; then - echo Error: $i is not installed. - exit 1 - fi -done - -EPSTOPDF=epstopdf - -if ! type epstopdf &>/dev/null; then - if type texmfstart &>/dev/null; then - EPSTOPDF="texmfstart newpstopdf" - else - EPSTOPDF="texutil --figures --epstopdf" - fi -fi - -if [ -s "$1.jpg" ]; then - if [ "$2" = eps ] && [ "$1.jpg" -nt "$1.eps" ]; then - jpeg2ps "$1.jpg" >"$1.eps" - fi -else - if [ "$2" = pdf ] && [ "$1.eps" -nt "$1.pdf" ]; then - $EPSTOPDF "$1.eps" - fi -fi - -X= -[ $3 = h ] && X=x -FORMAT="%$3" -FILE="$6/$1.jpg" -DFILE="$7/$1.jpg" -DFILE_EPS="$7/$1.eps" -DPI="$4" -IW="$5" -MODE="$2" -INCH=72.27 - -mkdir -p $7 - -if [ -s "$FILE" ]; then - W=`identify -format "$FORMAT" "$FILE"` -else - rm -f "$DFILE" - exit 0 -fi - -NW=`echo "$DPI * $IW / $INCH" | bc` - -if [ $NW -ge $W ]; then - rm -f "$DFILE" -else - if [ -s "$DFILE" ] && \ - [ `identify -format "$FORMAT" "$DFILE"` -eq $NW ]; then - exit 0 - else - convert -verbose -resize $X$NW "$FILE" "$DFILE" - [ $MODE = eps ] && jpeg2ps "$DFILE" >"$DFILE_EPS" - fi -fi -\stopbuffer - -\def\Command{\immediate\write18} -\let\externalfigureO=\externalfigure -\def\externalfigure[#1][#2]{% - \getparameters[Deg][height=,#2]% - \processaction[\Degheight][% - \s!default =>\scratchdimen=\Degwidth \def\Deg@WH{w}, - \s!unknown =>\scratchdimen=\Degheight \def\Deg@WH{h}]% - \Command{bash ./\jobname-degrade-script.tmp #1 \ifcase\pdfoutput eps\else - pdf\fi\space\Deg@WH\space\DegRes\space\withoutpt\the\scratchdimen\space - \DegSDir\space\DegDir}% - \doiffileexistselse{\DegDir/#1.jpg}{\def\Deg@File{\DegDir/#1}}{% - \def\Deg@File{#1}}% - \externalfigureO[\Deg@File][#2]} - -\protect - -\doifnotmode{demo}{\endinput} - -%D Usage example: -%\usemodule[degrade] -% \setupDegrade[Res=200] Here you can adjust the resolution (unit = dpi). -\starttext -\externalfigure[hacker][width=0.2\textwidth] -\stoptext diff --git a/Master/texmf-dist/tex/context/third/fancybreak/t-fancybreak.mkii b/Master/texmf-dist/tex/context/third/fancybreak/t-fancybreak.mkii deleted file mode 100644 index 66ea139e7af..00000000000 --- a/Master/texmf-dist/tex/context/third/fancybreak/t-fancybreak.mkii +++ /dev/null @@ -1,272 +0,0 @@ -%D \module -%D [ file=t-fancybreak, -%D version=2013.04.27, -%D title=\CONTEXT\ User Module, -%D subtitle=Fancybreak, -%D author=Wolfgang Schuster, -%D date=\currentdate, -%D copyright=Wolfgang Schuster, -%D email=schuster.wolfgang@googlemail.com, -%D license=GNU General Public License] - -%C Copyright (C) 2010 Wolfgang Schuster -%C -%C This program is free software: you can redistribute it and/or modify -%C it under the terms of the GNU General Public License as published by -%C the Free Software Foundation, either version 3 of the License, or -%C any later version. -%C -%C This program is distributed in the hope that it will be useful, -%C but WITHOUT ANY WARRANTY; without even the implied warranty of -%C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -%C GNU General Public License for more details. -%C -%C You should have received a copy of the GNU General Public License -%C along with this program. If not, see <http://www.gnu.org/licenses/>. - -%M \usemodule[fancybreak] -%M \loadsetups[t-fancybreak.xml] - -%D \subject{Examples} -%D -%D \subsubject{The \letterbackslash fancybreak command} -%D -%D \starttyping -%D The Earth, as a habitat for animal life, is in old age … -%D \fancybreak{$* * *$} -%D The Earth, as a habitat for animal life, is in old age … -%D \stoptyping -%D -%D \input ward -%D \fancybreak{$* * *$} -%D \input ward -%D -%D \subsubject{The “spacebefore” and “spaceafter” keys} -%D -%D \starttyping -%D \setupfancybreak[spacebefore=line,spaceafter=line] -%D -%D The Earth, as a habitat for animal life, is in old age … -%D \fancybreak{$* * *$} -%D The Earth, as a habitat for animal life, is in old age … -%D \stoptyping -%D -%D \start -%D -%D \setupfancybreak[spacebefore=line,spaceafter=line] -%D -%D \input ward -%D \fancybreak{$* * *$} -%D \input ward -%D -%D \stop -%D -%D \subsubject{The argumentless version of the \letterbackslash fancybreak command} -%D -%D \starttyping -%D The Earth, as a habitat for animal life, is in old age … -%D \fancybreak -%D The Earth, as a habitat for animal life, is in old age … -%D \stoptyping -%D -%D \input ward -%D \fancybreak -%D \input ward -%D -%D \subsubject{The “spaceinbetween” key} -%D -%D \starttyping -%D \setupfancybreak[spaceinbetween=3*line] -%D -%D The Earth, as a habitat for animal life, is in old age … -%D \fancybreak -%D The Earth, as a habitat for animal life, is in old age … -%D \stoptyping -%D -%D \start -%D -%D \setupfancybreak[spaceinbetween=3*line] -%D -%D \input ward -%D \fancybreak -%D \input ward -%D -%D \stop -%D -%D \subsubject{The “symbol” key} -%D -%D \starttyping -%D \setupfancybreak[symbol=star] -%D -%D The Earth, as a habitat for animal life, is in old age … -%D \fancybreak -%D The Earth, as a habitat for animal life, is in old age … -%D \stoptyping -%D -%D \start -%D -%D \setupfancybreak[symbol=star] -%D -%D \input ward -%D \fancybreak -%D \input ward -%D -%D \stop -%D -%D \subsubject{How to create new \letterbackslash fancybreak commands} -%D -%D \starttyping -%D \definefancybreak[starbreak] [symbol=star] -%D \definefancybreak[squarebreak][symbol=square] -%D -%D The Earth, as a habitat for animal life, is in old age … -%D \starbreak -%D The Earth, as a habitat for animal life, is in old age … -%D \squarebreak -%D The Earth, as a habitat for animal life, is in old age … -%D \stoptyping -%D -%D \start -%D -%D \definefancybreak[starbreak] [symbol=star] -%D \definefancybreak[squarebreak][symbol=square] -%D -%D \input ward -%D \starbreak -%D \input ward -%D \squarebreak -%D \input ward -%D -%D \stop - -%D \subject{Implementation} - -\writestatus{loading}{ConTeXt User Module / Fancybreak} - -\unprotect - -\startinterface all - \setinterfacevariable {fancybreak} {fancybreak} -\stopinterface - -\def\????fancybreak{@@@@fancybreak} - -\def\fancybreakparameter#1{\csname\????fancybreak\currentfancybreak#1\endcsname} - -%D \macros -%D {setupfancybreak} -%D -%D \subsubject{\letterbackslash setupfancybreak} -%D -%D With the command \type{\setupfancybreak} one can change the settings of -%D a previous created command, the two argument version change only the values -%D of a certain command while the one argument version change the values of -%D all commands. -%D -%D \showsetup{setupfancybreak} - -\unexpanded\def\setupfancybreak - {\dodoubleempty\dosetupfancybreak} - -\def\dosetupfancybreak[#1][#2]% - {\ifsecondargument - \dodoubleargumentwithset\dodosetupfancybreak[#1][#2]% - \else - \dodosetupfancybreak[][#1]% - \fi} - -\def\dodosetupfancybreak[#1][#2]% - {\getparameters[\????fancybreak#1][#2]} - -%D \macros -%D {definefancybreak} -%D -%D \subsubject{\letterbackslash definefancybreak} -%D -%D The command \type{\fancybreak} is not hardcoded in the module but created with -%D \type{\definefancybreak}. The command takes two arguments, the first is the name -%D of the new command and the second parameter to change the style of the commands -%D content and distances to the surrounding text. -%D -%D In \MKII\ users can only change the spacing before and after the content and -%D the alignment of it while \MKIV\ user can also change the style and color of it. -%D -%D \showsetup{definefancybreak} - -\unexpanded\def\definefancybreak - {\dodoubleempty\dodefinefancybreak} - -\def\dodefinefancybreak[#1][#2]% - {\copyparameters - [\????fancybreak#1][\????fancybreak] - [\c!spacebefore,\c!spaceafter,\c!spaceinbetween,\c!align,\c!indentnext,\c!symbol]% - \getparameters[\????fancybreak#1][#2]% - \setvalue {#1}{\dodoubleempty\dofancybreak [#1]}% - \setvalue{\e!start#1}{\dodoubleempty\dostartfancybreak[#1]}% - \setvalue{\e!stop #1}{\dostopfancybreak }} - -%D \macros -%D {fancybreak} -%D -%D \subsubject{\letterbackslash fancybreak} -%D -%D The main macro of the module is the \type{\fancybreak} command (or a user defined -%D variant of it), it takes one argument which can be optional. -%D -%D \showsetup{fancybreak} -%D \showsetup{startfancybreak} - -\def\dofancybreak[#1][#2]% - {\par - \begingroup - \edef\currentfancybreak{#1}% - \ifsecondargument - \doifassignmentelse{#2} - {\getparameters[\????fancybreak\currentfancybreak][#2]} - {\setvalue{\????fancybreak\currentfancybreak\c!spaceinbetween}{#2}}% - \fi - \doifnextbgroupelse\dodofancybreak\nodofancybreak} - -\def\dodofancybreak - {\forgetall % \forgetparindent - \dowithnextboxcontent - {\setupalign[\fancybreakparameter\c!align]} - {\blank[\fancybreakparameter\c!spacebefore]% - \flushnextbox - \blank[\fancybreakparameter\c!spaceafter ]% - \checknextindentation[\fancybreakparameter\c!indentnext]% - \endgroup - \dorechecknextindentation} - \vbox} - -\def\nodofancybreak - {\doifsymboldefinedelse{\fancybreakparameter\c!symbol} - {\dodofancybreak{\symbol[\fancybreakparameter\c!symbol]}} - {\blank[\fancybreakparameter\c!spaceinbetween]% - \checknextindentation[\fancybreakparameter\c!indentnext]% - \endgroup - \dorechecknextindentation}} - -\def\dostartfancybreak[#1][#2]% - {\par - \begingroup - \edef\currentfancybreak{#1}% - \ifsecondargument - \getparameters[\????fancybreak#1][#2]% - \fi - \dodofancybreak\bgroup} - -\def\dostopfancybreak - {\egroup} - -\definefancybreak[\v!fancybreak] - -\setupfancybreak - [ \c!spacebefore=, - \c!spaceafter=\v!nowhite, - \c!spaceinbetween=\v!line, - \c!align=\v!middle, - \c!indentnext=\v!yes, - \c!symbol=] - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/third/fancybreak/t-fancybreak.mkvi b/Master/texmf-dist/tex/context/third/fancybreak/t-fancybreak.mkvi deleted file mode 100644 index 3e547186e85..00000000000 --- a/Master/texmf-dist/tex/context/third/fancybreak/t-fancybreak.mkvi +++ /dev/null @@ -1,493 +0,0 @@ -%D \module -%D [ file=t-fancybreak, -%D version=2015.04.18, -%D title=\CONTEXT\ User Module, -%D subtitle=Fancybreak, -%D author=Wolfgang Schuster, -%D date=\currentdate, -%D copyright=Wolfgang Schuster, -%D email=schuster.wolfgang@googlemail.com, -%D license=GNU General Public License] - -%C Copyright (C) 2010 Wolfgang Schuster -%C -%C This program is free software: you can redistribute it and/or modify -%C it under the terms of the GNU General Public License as published by -%C the Free Software Foundation, either version 3 of the License, or -%C any later version. -%C -%C This program is distributed in the hope that it will be useful, -%C but WITHOUT ANY WARRANTY; without even the implied warranty of -%C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -%C GNU General Public License for more details. -%C -%C You should have received a copy of the GNU General Public License -%C along with this program. If not, see <http://www.gnu.org/licenses/>. - -%M \usemodule[fancybreak] -%M \loadsetups[t-fancybreak.xml] - -%D \subject{Examples} -%D -%D \macros -%D {fancybreak} -%D -%D \subsubject{The \letterbackslash fancybreak command} -%D -%D \starttyping -%D Making oil requires a specific series of geological accidents ... -%D \fancybreak{$* * *$} -%D Making oil requires a specific series of geological accidents ... -%D \stoptyping -%D -%D results in -%D -%D \startexample -%D \input montgomery -%D \fancybreak{$* * *$} -%D \input montgomery -%D \stopexample -%D -%D \extras -%D {spacebefore,spaceafter} -%D -%D \subsubject{The “spacebefore” and “spaceafter” keys} -%D -%D \starttyping -%D \setupfancybreak[spacebefore=line,spaceafter=line] -%D -%D The Earth, as a habitat for animal life, is in old age … -%D \fancybreak{$* * *$} -%D The Earth, as a habitat for animal life, is in old age … -%D \stoptyping -%D -%D results in -%D -%D \start -%D -%D \setupfancybreak[spacebefore=line,spaceafter=line] -%D -%D \startexample -%D \input ward -%D \fancybreak{$* * *$} -%D \input ward -%D \stopexample -%D -%D \stop -%D -%D \extras -%D {style} -%D -%D \subsubject{The “style” key} -%D -%D \starttyping -%D \setupfancybreak[style=bold] -%D -%D The warm water spills north and south through a series of ocean currents ... -%D \fancybreak{* * *} -%D The warm water spills north and south through a series of ocean currents ... -%D \stoptyping -%D -%D \start -%D -%D \setupfancybreak[style=bold,spacebefore=medium] -%D -%D \input linden -%D \fancybreak{* * *} -%D \input linden -%D -%D \stop -%D -%D \extras -%D {color} -%D -%D \subsubject{The “color” key} -%D -%D \starttyping -%D \setupfancybreak[color=red] -%D -%D Had our solar system included two suns, the problem would ... -%D \fancybreak{* * *} -%D Had our solar system included two suns, the problem would ... -%D \stoptyping -%D -%D \start -%D -%D \setupfancybreak[color=red,spacebefore=medium] -%D -%D \input thuan -%D \fancybreak{* * *} -%D \input thuan -%D -%D \stop -%D -%D \extras -%D {indentnext} -%D -%D \subsubject{The “indentnext” key} -%D -%D \starttyping -%D The Earth, as a habitat for animal life, is in old age … -%D \fancybreak{$* * *$} -%D The Earth, as a habitat for animal life, is in old age … -%D \fancybreak[indentnext=no]{$* * *$} -%D The Earth, as a habitat for animal life, is in old age … -%D \stoptyping -%D -%D \start -%D -%D \setupindenting[yes,medium] -%D -%D \input ward -%D \fancybreak{$* * *$} -%D \input ward -%D \fancybreak[indentnext=no]{$* * *$} -%D \input ward -%D -%D \stop -%D -%D \macros -%D {fancybreak} -%D -%D \subsubject{The argumentless version of the \letterbackslash fancybreak command} -%D -%D \starttyping -%D Imagine trying to live in a world dominated by dihydrogen oxide ... -%D \fancybreak -%D Imagine trying to live in a world dominated by dihydrogen oxide ... -%D \stoptyping -%D -%D \input bryson -%D \fancybreak -%D \input bryson -%D -%D \extras -%D {spaceinbetween} -%D -%D \subsubject{The “spaceinbetween” key} -%D -%D \starttyping -%D \setupfancybreak[spaceinbetween=3*line] -%D -%D If [in 2600] you stacked all the new books being published ... -%D \fancybreak -%D If [in 2600] you stacked all the new books being published ... -%D \stoptyping -%D -%D \start -%D -%D \setupfancybreak[spaceinbetween=3*line] -%D -%D \input hawking -%D \fancybreak -%D \input hawking -%D -%D \stop -%D -%D \extras -%D {symbol} -%D -%D \subsubject{The “symbol” key} -%D -%D \starttyping -%D \setupfancybreak[symbol=star] -%D -%D This nation, turning 100 years old, had no {\em Odyssey}, ... -%D \fancybreak -%D This nation, turning 100 years old, had no {\em Odyssey}, ... -%D \stoptyping -%D -%D \start -%D -%D \setupfancybreak[symbol=star] -%D -%D \input davis -%D \fancybreak -%D \input davis -%D -%D \stop -%D -%D \macros -%D {startfancybreak} -%D -%D \subsubject{The fancybreak environment} -%D -%D \starttyping -%D \useMPlibrary[txt] -%D -%D \setupMPvariables[EnglishRule][width=.6\hsize] -%D -%D \setupfancybreak[spacebefore=line,spaceafter=line] -%D -%D The Earth, as a habitat for animal life, is in old age … -%D -%D \startfancybreak -%D \dontleavehmode\useMPgraphic{EnglishRule} -%D \stopfancybreak -%D -%D The Earth, as a habitat for animal life, is in old age … -%D \stoptyping -%D -%D \start -%D -%D \setupfancybreak[spacebefore=line,spaceafter=line] -%D -%D \useMPlibrary[txt] -%D -%D \setupMPvariables[EnglishRule][width=.6\hsize] -%D -%D \input ward -%D -%D \startfancybreak -%D \dontleavehmode\useMPgraphic{EnglishRule} -%D \stopfancybreak -%D -%D \input ward -%D -%D \stop -%D -%D \macros -%D {definefancybreak} -%D -%D \subsubject{How to create new \letterbackslash fancybreak commands} -%D -%D \starttyping -%D \definefancybreak[starbreak] [symbol=star] -%D \definefancybreak[squarebreak][symbol=square] -%D -%D The Earth, as a habitat for animal life, is in old age … -%D \starbreak -%D The Earth, as a habitat for animal life, is in old age … -%D \squarebreak -%D The Earth, as a habitat for animal life, is in old age … -%D \stoptyping -%D -%D \start -%D -%D \definefancybreak[starbreak] [symbol=star] -%D \definefancybreak[squarebreak][symbol=square] -%D -%D \input ward -%D \starbreak -%D \input bryson -%D \squarebreak -%D \input zapf -%D -%D \stop -%D -%D \subject{Implementation} - -\writestatus{loading}{ConTeXt User Module / Fancybreak} - -\unprotect - -\startinterface all - \setinterfacevariable {fancybreak} {fancybreak} -\stopinterface - -\installnamespace {fancybreak} -\installnamespace {fancybreakalternative} -\installnamespace {fancybreakrenderings} - -\installcommandhandler \????fancybreak {fancybreak} \????fancybreak -\installcommandhandler \????fancybreakalternative {fancybreakalternative} \????fancybreakalternative - -%D \macros -%D {setupfancybreak} -%D -%D \subsubject{\letterbackslash setupfancybreak} -%D -%D With the command \type{\setupfancybreak} one can change the settings of -%D a previous created command, the two argument version change only the values -%D of a certain command while the one argument version change the values of -%D all commands. -%D -%D \showsetup{setupfancybreak} -%D -%D \macros -%D {definefancybreak} -%D -%D \subsubject{\letterbackslash definefancybreak} -%D -%D The command \type{\fancybreak} is not hardcoded in the module but created with -%D \type{\definefancybreak}. The command takes two arguments, the first is the name -%D of the new command and the second parameter to change the style of the commands -%D content and distances to the surrounding text. -%D -%D In \MKII\ users can only change the spacing before and after the content and -%D the alignment of it while \MKIV\ user can also change the style and color of it. -%D -%D \showsetup{definefancybreak} - -\appendtoks - \setuevalue {\currentfancybreak}{\fancybreak [\currentfancybreak]}% - \setuevalue{\e!start\currentfancybreak}{\startfancybreak[\currentfancybreak]}% - \setuevalue{\e!stop \currentfancybreak}{\stopfancybreak }% -\to \everydefinefancybreak - -%D \macros -%D {fancybreak} -%D -%D \subsubject{\letterbackslash fancybreak} -%D -%D The main macro of the module is the \type{\fancybreak} command (or a user defined -%D variant of it), it takes one argument which can be optional. -%D -%D \showsetup{fancybreak} -%D \showsetup{startfancybreak} - -\definefancybreakalternative [\s!default] [\c!renderingsetup=\????fancybreakrenderings:\s!default] - -\startsetups[\????fancybreakrenderings:\s!default] - \blank[\fancybreakparameter\c!spacebefore] - \flushnextbox - \blank[\fancybreakparameter\c!spaceafter ] -\stopsetups - -\definefancybreakalternative [\v!test] [\c!renderingsetup=\????fancybreakrenderings:\v!test] - -\startsetups[\????fancybreakrenderings:\v!test] - \setbox\scratchboxone\vbox{\blank[\fancybreakparameter\c!spacebefore]} - \setbox\scratchboxtwo\vbox{\blank[\fancybreakparameter\c!spaceafter ]} - \ifzeropt\pagetotal - % begin of new page - \else - \ifdim\dimexpr\pagegoal-\pagetotal\relax<\dimexpr\nextboxhtdp+\ht\scratchboxone+\ht\scratchboxtwo\relax - \page % not enough space for the content - \else - \texsetup{\????fancybreakrenderings:\s!default} - \fi - \fi -\stopsetups - -\definefancybreakalternative [\v!auto] [\c!renderingsetup=\????fancybreakrenderings:\v!auto] - -\startsetups[\????fancybreakrenderings:\v!auto] - \setexpandedfancybreakparameter\c!spacebefore{\the\dimexpr\nextboxhtdp/2\relax} - \setexpandedfancybreakparameter\c!spaceafter {\the\dimexpr\nextboxhtdp \relax} - \texsetup{\????fancybreakrenderings:\v!test} -\stopsetups - -\unexpanded\def\fancybreak - {\par - \begingroup - \dodoubleempty\fancybreak_direct} - -\def\fancybreak_direct - {\ifsecondargument - \expandafter\fancybreak_direct_double - \else\iffirstargument - \doubleexpandafter\fancybreak_direct_single - \else - \doubleexpandafter\fancybreak_direct_zero - \fi\fi} - -\def\fancybreak_direct_double[#environment][#parameters]% - {\edef\currentfancybreak{#environment}% - \ifcsname\currentfancybreakhash\s!parent\endcsname - % the current environment does exist - \else - \let\currentfancybreak\empty - \fi - \doifassignmentelse{#parameters} - {\setupcurrentfancybreak[#parameters]} - {\setfancybreakparameter\c!spaceinbetween{#parameters}}% - \doifnextbgroupelse\fancybreak_direct_yes\fancybreak_direct_nop} - -\def\fancybreak_direct_single[#environment][#parameters]% - {\doifassignmentelse{#environment} - {\let\currentfancybreak\empty - \setupcurrentfancybreak[#environment]} - {\edef\currentfancybreak{#environment}% - \ifcsname\currentfancybreakhash\s!parent\endcsname - % the argument is the name of a environment - \else - \let\currentfancybreak\empty - \setfancybreakparameter\c!spaceinbetween{#parameters} - \fi}% - \doifnextbgroupelse\fancybreak_direct_yes\fancybreak_direct_nop} - -\def\fancybreak_direct_zero[#environment][#parameters]% - {\let\currentfancybreak\empty - \doifnextbgroupelse\fancybreak_direct_yes\fancybreak_direct_nop} - -\def\fancybreak_direct_yes - {\forgetparindent - \dowithnextboxcontent - {\dostarttagged\t!division\currentfancybreak - \usealignparameter\fancybreakparameter - \usefancybreakstyleandcolor\c!style\c!color} - {\edef\currentfancybreakalternative{\fancybreakparameter\c!alternative}% - \ifcsname\currentfancybreakalternativehash\s!parent\endcsname - % valid argument for the alternative key - \else - \let\currentfancybreakalternative\s!default - \fi - \edef\p_fancybreak_renderingsetup{\fancybreakalternativeparameter\c!renderingsetup}% - \texsetup\p_fancybreak_renderingsetup - \dostoptagged - \checknextindentation[\fancybreakparameter\c!indentnext]% - \endgroup - \dorechecknextindentation} - \vbox} - -\def\fancybreak_direct_nop - {\doifsymboldefinedelse{\fancybreakparameter\c!symbol} - {\fancybreak_direct_yes{\symbol[\fancybreakparameter\c!symbol]}} - {\blank[\fancybreakparameter\c!spaceinbetween]% - \checknextindentation[\fancybreakparameter\c!indentnext]% - \endgroup - \dorechecknextindentation}} - -\unexpanded\def\startfancybreak - {\par - \begingroup - \dodoubleempty\fancybreak_start} - -\def\fancybreak_start - {\ifsecondargument - \expandafter\fancybreak_start_double - \else\iffirstargument - \doubleexpandafter\fancybreak_start_single - \else - \doubleexpandafter\fancybreak_start_zero - \fi\fi} - -\def\fancybreak_start_double[#environment][#parameters]% - {\edef\currentfancybreak{#environment}% - \ifcsname\currentfancybreakhash\s!parent\endcsname - % the current environment does exist - \else - \let\currentfancybreak\empty - \fi - \setupcurrentfancybreak[#parameters]% - \fancybreak_direct_yes\bgroup} - -\def\fancybreak_start_single[#environment][#parameters]% - {\doifassignmentelse{#environment} - {\let\currentfancybreak\empty - \setupcurrentfancybreak[#parameters]} - {\edef\currentfancybreak{#environment}% - \ifcsname\currentfancybreakhash\s!parent\endcsname - % the current environment does exist - \else - \let\currentfancybreak\empty - \fi}% - \fancybreak_direct_yes\bgroup} - -\def\fancybreak_start_zero[#environment][#parameters]% - {\let\currentfancybreak\empty - \fancybreak_direct_yes\bgroup} - -\unexpanded\def\stopfancybreak - {\egroup} - -\setupfancybreak - [ \c!spacebefore=, - \c!spaceafter=\v!nowhite, - \c!spaceinbetween=\v!line, - \c!align=\v!middle, - \c!indentnext=\v!yes, - \c!symbol=] - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/third/french/t-french.mkiv b/Master/texmf-dist/tex/context/third/french/t-french.mkiv deleted file mode 100644 index ce9513a118e..00000000000 --- a/Master/texmf-dist/tex/context/third/french/t-french.mkiv +++ /dev/null @@ -1,98 +0,0 @@ -%D \module -%D [ file=t-french, -%D version=2011.11.09, -%D title=\CONTEXT\ User Module, -%D subtitle=For French documents, -%D author=Peter Münster, -%D date=\currentdate, -%D copyright=Peter Münster, -%D email=pmrb@free.fr, -%D license=GNU General Public License] - -%C Copyright (C) 2011 Peter Münster -%C -%C This program is free software: you can redistribute it and/or modify -%C it under the terms of the GNU General Public License as published by -%C the Free Software Foundation, either version 3 of the License, or -%C any later version. -%C -%C This program is distributed in the hope that it will be useful, -%C but without any warranty; without even the implied warranty of -%C merchantability or fitness for a particular purpose. See the -%C GNU General Public License for more details. -%C -%C You should have received a copy of the GNU General Public License -%C along with this program. If not, see <http://www.gnu.org/licenses/>. - -%D This module tries to do similar things as the frenchb.ldf in \LaTeX: -%D \startitemize -%D \item automatic space before » and after «, :, ?, ; and ! -%D \item changing symbol for itemize environment -%D \stopitemize -%D -%D If I remember right, the \LaTeX\ babel package does a much better job at -%D language switching, but I don't know, how this is possible in \ConTeXt... -%D -%D Many thanks to Hans Hagen and Wolfgang Schuster for their help! - -\writestatus{loading}{Typesetting French documents} - -\startsetups french - % Todo: This shoud be also active in footnotes, headers and footers, - % and not active in verbatim text: - \setcharacterspacing[frenchpunctuation] - % A question of style: - \setupitemize[symbol=2] -\stopsetups -\startsetups not-french - \setcharacterspacing[reset] - \setupitemize[symbol=\currentitemlevel] -\stopsetups -\setuplanguage [default] [setups=not-french] -\setuplanguage [fr] [setups=french] -\mainlanguage [fr] - -\ifx \ieme \undefined \def\ieme {\highordinalstr{e}} \fi -\ifx \iemes \undefined \def\iemes {\highordinalstr{es}} \fi -\ifx \ier \undefined \def\ier {\highordinalstr{er}} \fi -\ifx \iere \undefined \def\iere {\highordinalstr{re}} \fi -\ifx \iers \undefined \def\iers {\highordinalstr{ers}} \fi -\ifx \ieres \undefined \def\ieres {\highordinalstr{res}} \fi - -\continueifinputfile{t-french.mkiv} - -%D Usage example: -\startbuffer[items] - \startitemize - \item test - \item test - \startitemize - \item test - \item test - \startitemize - \item test - \item test - \stopitemize - \stopitemize - \stopitemize -\stopbuffer - -\usemodule[french] - -\starttext -\startbuffer - Voilà: Voilà? Voilà! Voilà; - \start - \language[en] - some English text: «English» or \quotation{French}, ok? - \stop - «voilà» \quote{voilà} \quotation{voilà} - \getbuffer[items] - \start - \language[en] - \getbuffer[items] - \stop -\stopbuffer -\typebuffer -\getbuffer -\stoptext diff --git a/Master/texmf-dist/tex/context/third/fullpage/t-fullpage.mkii b/Master/texmf-dist/tex/context/third/fullpage/t-fullpage.mkii deleted file mode 100644 index ab87124cb69..00000000000 --- a/Master/texmf-dist/tex/context/third/fullpage/t-fullpage.mkii +++ /dev/null @@ -1,321 +0,0 @@ -%D \module -%D [ file=t-fullpage, -%D version=2011.01.26, -%D title=\CONTEXT\ User Module, -%D subtitle=Fullpage documents, -%D author=Wolfgang Schuster, -%D date=\currentdate, -%D copyright=Wolfgang Schuster, -%D email=schuster.wolfgang@googlemail.com, -%D license=GNU General Public License] - -%C Copyright (C) 2010 Wolfgang Schuster -%C -%C This program is free software: you can redistribute it and/or modify -%C it under the terms of the GNU General Public License as published by -%C the Free Software Foundation, either version 3 of the License, or -%C any later version. -%C -%C This program is distributed in the hope that it will be useful, -%C but WITHOUT ANY WARRANTY; without even the implied warranty of -%C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -%C GNU General Public License for more details. -%C -%C You should have received a copy of the GNU General Public License -%C along with this program. If not, see <http://www.gnu.org/licenses/>. - -%M \loadsetups[t-fullpage.xml] - -%D \subject{Introduction} -%D -%D The \filename {fullpage} module is a port of the \LATEX\ package -%D with the same name. The module was written after Mohammed Bana -%D asked on the \CONTEXT\ mailing list if a module with the same -%D function as the \LATEX\ package is available for \CONTEXT. -%D -%D The purpose of the module is to easily change the margins of -%D all four margins of the page to the same value without the need -%D of \type {\setuplayout} in the document. -%D -%D \subject{Usage} -%D -%D To use the module you have to load it with the \type {\usemodule} -%D command. Parameters for the module can be either set with the -%D \type {\setupfullpage} command or as argument to \type {\usemodule} -%D when you load the module for your document. -%D -%D A example how to use the module is: -%D -%D \starttyping -%D \usemodule[fullpage][style={cm,empty}] -%D -%D \starttext -%D \input knuth -%D \stoptext -%D \stoptyping -%D -%D You can give for \type {\usemodule} the same argument as you can -%D give to \type {\setupfullpage}, which has the following sytnax: -%D -%D \showsetup{setupfullpage} -%D -%D The meaning of the values for the “style” key is: -%D -%D \starttable[|Bl|l|] -%D \HL -%D \NC in \NC set the margins to 1in \NC\AR -%D \NC cm \NC set the margins to 1.5cm \NC\AR -%D \NC margin \NC set the margins to the “margin” value \NC\AR -%D \NC plain \NC no header and narrow footer with 0.5cm \NC\AR -%D \NC headings \NC narrow header and footer with 0.5cm \NC\AR -%D \NC empty \NC no header and footer \NC\AR -%D \HL -%D \stoptable -%D -%D The “margin” value is only usefull when you use also the margin key -%D which expects a dimension as argument because it’s default value is -%D 0pt which result otherwise in no margins at all. You can see the -%D result of all combinations of the style argument \at{at page}[sec:examples], -%D the examples for the margin argument use a value of 4cm for the margin key. -%D -%D \subject[sec:examples]{Examples} -%D -%D \startbuffer[none] -%D \usemodule[fullpage][style=none] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[headings] -%D \usemodule[fullpage][style=headings] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[plain] -%D \usemodule[fullpage][style=plain] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[empty] -%D \usemodule[fullpage][style=empty] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[in] -%D \usemodule[fullpage][style={in}] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[in+headings] -%D \usemodule[fullpage][style={in,headings}] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[in+plain] -%D \usemodule[fullpage][style={in,plain}] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[in+empty] -%D \usemodule[fullpage][style={in,empty}] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[cm] -%D \usemodule[fullpage][style={cm}] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[cm+headings] -%D \usemodule[fullpage][style={cm,headings}] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[cm+plain] -%D \usemodule[fullpage][style={cm,plain}] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[cm+empty] -%D \usemodule[fullpage][style={cm,empty}] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[margin] -%D \usemodule[fullpage][style={margin},margin=4cm] -%D \showframe[text] -%D \starttext -%D \dorecurse{4}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[margin+headings] -%D \usemodule[fullpage][style={margin,headings},margin=4cm] -%D \showframe[text] -%D \starttext -%D \dorecurse{4}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[margin+plain] -%D \usemodule[fullpage][style={margin,plain},margin=4cm] -%D \showframe[text] -%D \starttext -%D \dorecurse{4}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[margin+empty] -%D \usemodule[fullpage][style={margin,empty},margin=4cm] -%D \showframe[text] -%D \starttext -%D \dorecurse{4}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startcombination[4*4] -%D {\typesetbuffer[none] [frame=on,width=.2\textwidth]}{none} -%D {\typesetbuffer[headings] [frame=on,width=.2\textwidth]}{headings} -%D {\typesetbuffer[plain] [frame=on,width=.2\textwidth]}{plain} -%D {\typesetbuffer[empty] [frame=on,width=.2\textwidth]}{empty} -%D {\typesetbuffer[in] [frame=on,width=.2\textwidth]}{in} -%D {\typesetbuffer[in+headings] [frame=on,width=.2\textwidth]}{in + headings} -%D {\typesetbuffer[in+plain] [frame=on,width=.2\textwidth]}{in + plain} -%D {\typesetbuffer[in+empty] [frame=on,width=.2\textwidth]}{in + empty} -%D {\typesetbuffer[cm] [frame=on,width=.2\textwidth]}{cm} -%D {\typesetbuffer[cm+headings] [frame=on,width=.2\textwidth]}{cm + headings} -%D {\typesetbuffer[cm+plain] [frame=on,width=.2\textwidth]}{cm + plain} -%D {\typesetbuffer[cm+empty] [frame=on,width=.2\textwidth]}{cm + empty} -%D {\typesetbuffer[margin] [frame=on,width=.2\textwidth]}{margin} -%D {\typesetbuffer[margin+headings][frame=on,width=.2\textwidth]}{margin + headings} -%D {\typesetbuffer[margin+plain] [frame=on,width=.2\textwidth]}{margin + plain} -%D {\typesetbuffer[margin+empty] [frame=on,width=.2\textwidth]}{margin + empty} -%D \stopcombination - -\writestatus{loading}{ConTeXt User Module / Fullpage} - -\unprotect - -\startmodule[fullpage] - -\startinterface all - \setinterfacevariable {fullpage} {fullpage} - \setinterfacevariable {in} {in} - \setinterfacevariable {cm} {cm} - \setinterfacevariable {plain} {plain} - \setinterfacevariable {headings} {headings} -\stopinterface - -\def\????fullpage{@@@@fullpage} % FullPage - -\def\fullpageparameter#1% - {\csname\????fullpage#1\endcsname} - -\setupmodule - [ \c!style={\v!in,\v!plain}, - \c!margin=0pt] - -\startsetups[\v!fullpage:\v!in] - - \setuplayout - [\c!backspace=1in, - \c!width=\v!middle, - \c!topspace=1in, - \c!height=\v!middle] - -\stopsetups - -\startsetups[\v!fullpage:\v!cm] - - \setuplayout - [\c!backspace=15mm, - \c!width=\v!middle, - \c!topspace=15mm, - \c!height=\v!middle] - -\stopsetups - -\startsetups[\v!fullpage:\v!margin] - - \setuplayout - [\c!backspace=\fullpageparameter\c!margin, - \c!width=\v!middle, - \c!topspace=\fullpageparameter\c!margin, - \c!height=\v!middle] - -\stopsetups - -\startsetups[\v!fullpage:\v!plain] - - \setuplayout - [\c!header=0pt, - \c!footer=.5in] - -\stopsetups - -\startsetups[\v!fullpage:\v!empty] - - \setuplayout - [\c!header=0pt, - \c!footer=0pt] - -\stopsetups - -\startsetups[\v!fullpage:\v!headings] - - \setuplayout - [\c!header=.5in, - \c!footer=.5in] - -\stopsetups - -\unexpanded\def\setupfullpage - {\dosingleargument\dosetupfullpage} - -\def\dosetupfullpage[#1]% - {\getparameters[\????fullpage][#1]% - \def\dodosetupfullpage##1{\setup[\v!fullpage:##1]}% - \processcommacommand[\fullpageparameter\c!style]\dodosetupfullpage} - -\normalexpanded{\setupfullpage - [ \c!style={\currentmoduleparameter\c!style}, - \c!margin={\currentmoduleparameter\c!margin}]} - -\stopmodule - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/third/fullpage/t-fullpage.mkiv b/Master/texmf-dist/tex/context/third/fullpage/t-fullpage.mkiv deleted file mode 100644 index 6c0b361b669..00000000000 --- a/Master/texmf-dist/tex/context/third/fullpage/t-fullpage.mkiv +++ /dev/null @@ -1,325 +0,0 @@ -%D \module -%D [ file=t-fullpage, -%D version=2011.01.26, -%D title=\CONTEXT\ User Module, -%D subtitle=Fullpage documents, -%D author=Wolfgang Schuster, -%D date=\currentdate, -%D copyright=Wolfgang Schuster, -%D email=schuster.wolfgang@googlemail.com, -%D license=GNU General Public License] - -%C Copyright (C) 2010 Wolfgang Schuster -%C -%C This program is free software: you can redistribute it and/or modify -%C it under the terms of the GNU General Public License as published by -%C the Free Software Foundation, either version 3 of the License, or -%C any later version. -%C -%C This program is distributed in the hope that it will be useful, -%C but WITHOUT ANY WARRANTY; without even the implied warranty of -%C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -%C GNU General Public License for more details. -%C -%C You should have received a copy of the GNU General Public License -%C along with this program. If not, see <http://www.gnu.org/licenses/>. - -%M \loadsetups[t-fullpage.xml] - -%D \subject{Introduction} -%D -%D The \filename {fullpage} module is a port of the \LATEX\ package -%D with the same name. The module was written after Mohammed Bana -%D asked on the \CONTEXT\ mailing list if a module with the same -%D function as the \LATEX\ package is available for \CONTEXT. -%D -%D The purpose of the module is to easily change the margins of -%D all four margins of the page to the same value without the need -%D of \type {\setuplayout} in the document. -%D -%D \subject{Usage} -%D -%D To use the module you have to load it with the \type {\usemodule} -%D command. Parameters for the module can be either set with the -%D \type {\setupfullpage} command or as argument to \type {\usemodule} -%D when you load the module for your document. -%D -%D A example how to use the module is: -%D -%D \starttyping -%D \usemodule[fullpage][style={cm,empty}] -%D -%D \starttext -%D \input knuth -%D \stoptext -%D \stoptyping -%D -%D You can give for \type {\usemodule} the same argument as you can -%D give to \type {\setupfullpage}, which has the following sytnax: -%D -%D \showsetup{setupfullpage} -%D -%D The meaning of the values for the “style” key is: -%D -%D \starttable[|Bl|l|] -%D \HL -%D \NC in \NC set the margins to 1in \NC\AR -%D \NC cm \NC set the margins to 1.5cm \NC\AR -%D \NC margin \NC set the margins to the “margin” value \NC\AR -%D \NC plain \NC no header and narrow footer with 0.5cm \NC\AR -%D \NC headings \NC narrow header and footer with 0.5cm \NC\AR -%D \NC empty \NC no header and footer \NC\AR -%D \HL -%D \stoptable -%D -%D The “margin” value is only usefull when you use also the margin key -%D which expects a dimension as argument because it’s default value is -%D 0pt which result otherwise in no margins at all. You can see the -%D result of all combinations of the style argument \at{at page}[sec:examples], -%D the examples for the margin argument use a value of 4cm for the margin key. -%D -%D \subject[sec:examples]{Examples} -%D -%D \startbuffer[none] -%D \usemodule[fullpage][style=none] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[headings] -%D \usemodule[fullpage][style=headings] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[plain] -%D \usemodule[fullpage][style=plain] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[empty] -%D \usemodule[fullpage][style=empty] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[in] -%D \usemodule[fullpage][style={in}] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[in+headings] -%D \usemodule[fullpage][style={in,headings}] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[in+plain] -%D \usemodule[fullpage][style={in,plain}] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[in+empty] -%D \usemodule[fullpage][style={in,empty}] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[cm] -%D \usemodule[fullpage][style={cm}] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[cm+headings] -%D \usemodule[fullpage][style={cm,headings}] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[cm+plain] -%D \usemodule[fullpage][style={cm,plain}] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[cm+empty] -%D \usemodule[fullpage][style={cm,empty}] -%D \showframe[text] -%D \starttext -%D \dorecurse{8}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[margin] -%D \usemodule[fullpage][style={margin},margin=4cm] -%D \showframe[text] -%D \starttext -%D \dorecurse{4}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[margin+headings] -%D \usemodule[fullpage][style={margin,headings},margin=4cm] -%D \showframe[text] -%D \starttext -%D \dorecurse{4}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[margin+plain] -%D \usemodule[fullpage][style={margin,plain},margin=4cm] -%D \showframe[text] -%D \starttext -%D \dorecurse{4}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startbuffer[margin+empty] -%D \usemodule[fullpage][style={margin,empty},margin=4cm] -%D \showframe[text] -%D \starttext -%D \dorecurse{4}{\input knuth\par} -%D \stoptext -%D \stopbuffer -%D -%D \startcombination[4*4] -%D {\typesetbuffer[none] [frame=on,width=.2\textwidth]}{none} -%D {\typesetbuffer[headings] [frame=on,width=.2\textwidth]}{headings} -%D {\typesetbuffer[plain] [frame=on,width=.2\textwidth]}{plain} -%D {\typesetbuffer[empty] [frame=on,width=.2\textwidth]}{empty} -%D {\typesetbuffer[in] [frame=on,width=.2\textwidth]}{in} -%D {\typesetbuffer[in+headings] [frame=on,width=.2\textwidth]}{in + headings} -%D {\typesetbuffer[in+plain] [frame=on,width=.2\textwidth]}{in + plain} -%D {\typesetbuffer[in+empty] [frame=on,width=.2\textwidth]}{in + empty} -%D {\typesetbuffer[cm] [frame=on,width=.2\textwidth]}{cm} -%D {\typesetbuffer[cm+headings] [frame=on,width=.2\textwidth]}{cm + headings} -%D {\typesetbuffer[cm+plain] [frame=on,width=.2\textwidth]}{cm + plain} -%D {\typesetbuffer[cm+empty] [frame=on,width=.2\textwidth]}{cm + empty} -%D {\typesetbuffer[margin] [frame=on,width=.2\textwidth]}{margin} -%D {\typesetbuffer[margin+headings][frame=on,width=.2\textwidth]}{margin + headings} -%D {\typesetbuffer[margin+plain] [frame=on,width=.2\textwidth]}{margin + plain} -%D {\typesetbuffer[margin+empty] [frame=on,width=.2\textwidth]}{margin + empty} -%D \stopcombination - -\writestatus{loading}{ConTeXt User Module / Fullpage} - -\unprotect - -\startmodule[fullpage] - -\startinterface all - \setinterfacevariable {fullpage} {fullpage} - \setinterfacevariable {in} {in} - \setinterfacevariable {cm} {cm} - \setinterfacevariable {plain} {plain} - \setinterfacevariable {headings} {headings} -\stopinterface - -\definenamespace - [fullpage] - [ type=module, - comment=Fullpage, - version=2011.01.26, - name=fullpage, - style=no, - command=yes, - setup=yes, - \s!parent=fullpage] - -\appendtoks - \startprocesscommacommand[\fullpageparameter\c!style]% - \setup[\v!fullpage:\currentcommalistitem]% - \stopprocesscommacommand -\to \everysetupfullpage - -\setupmodule - [ \c!style={\v!in,\v!plain}, - \c!margin=0pt] - -\startsetups[\v!fullpage:\v!in] - - \setuplayout - [\c!backspace=1in, - \c!width=\v!middle, - \c!topspace=1in, - \c!height=\v!middle] - -\stopsetups - -\startsetups[\v!fullpage:\v!cm] - - \setuplayout - [\c!backspace=15mm, - \c!width=\v!middle, - \c!topspace=15mm, - \c!height=\v!middle] - -\stopsetups - -\startsetups[\v!fullpage:\v!margin] - - \setuplayout - [\c!backspace=\fullpageparameter\c!margin, - \c!width=\v!middle, - \c!topspace=\fullpageparameter\c!margin, - \c!height=\v!middle] - -\stopsetups - -\startsetups[\v!fullpage:\v!plain] - - \setuplayout - [\c!header=0pt, - \c!footer=.5in] - -\stopsetups - -\startsetups[\v!fullpage:\v!empty] - - \setuplayout - [\c!header=0pt, - \c!footer=0pt] - -\stopsetups - -\startsetups[\v!fullpage:\v!headings] - - \setuplayout - [\c!header=.5in, - \c!footer=.5in] - -\stopsetups - -\normalexpanded{\setupfullpage - [ \c!style={\currentmoduleparameter\c!style}, - \c!margin={\currentmoduleparameter\c!margin}]} - -\stopmodule - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/third/gantt/gantt-s-mp.tex b/Master/texmf-dist/tex/context/third/gantt/gantt-s-mp.tex deleted file mode 100644 index a8a310cf21c..00000000000 --- a/Master/texmf-dist/tex/context/third/gantt/gantt-s-mp.tex +++ /dev/null @@ -1,369 +0,0 @@ -%D \module -%D [ file=t-gantt, -%D version=2012.08.19, -%D title=\CONTEXT\ User Module, -%D subtitle=Drawing Gantt charts, -%D author={Adam Reviczky and Aditya Mahajan}, -%D date=\currentdate, -%D copyright={Adam Reviczky and Aditya Mahajan}, -%D license=Public Domain] - -%D Some macros for drawing Gantt charts using MetaPost. - -\writestatus{loading}{ConTeXt User Module / metapost gantt chart} - -\startmodule[gantt-s-mp] -\unprotect - -\def\????gantt{@@@@gantt} - -\definesystemvariable{gantt} - -\startMPinclusions - % temporary solution for a pattern substitute - input hatching; -\stopMPinclusions - -\newcount\ganttnum -\newcount\gantttitlenum -\newcount\ganttwidth - -\newdimen\ganttlastx \ganttlastx = 0cm -\newdimen\nextganttlastx -\newdimen\titleunitlength \titleunitlength = 1cm -\newdimen\ganttunitlength \ganttunitlength = 1cm - -\newdimen\gantttmpa -\newdimen\gantttmpb - -% workaround for titleelement -\def\!!row{\numexpr\ganttnum-1\relax} - -\unexpanded\def\setupgantt - {\bgroup - \dosingleempty - \dosetupgantt} - -\unexpanded\def\dosetupgantt[#1]% - {\egroup - \getparameters[\????gantt][#1]} - -\setupgantt - [factor=1, - xunitlength=1cm, - style=\tf, - titlestyle=\tfx, - drawledgerline=false] - -\unexpanded\def\setupganttbar - {\bgroup - \dosingleempty - \dosetupganttbar} - -\unexpanded\def\dosetupganttbar[#1]% - {\egroup - \getparameters[\????gantt][#1]} - -\setupganttbar - [pattern=north east lines, - color=black] - -% The gantt environment draws the canvas of a gantt figure (realized as tikzpicture) -% The usage is \startgantt[...]{no of Tasks to plot}{no of time slots} -% The optional argument [...] can be filled in a key=value syntax, using one or more of the following keys: -% -% xunitlength - length of one time slot (default: 1cm) -% style - style of labels (default: \tf) -% titlestyle - style of title section (default: \tfx) -% drawledgerline - Switch to enable/disable the drawing of horizontal ledger lines (default value: false) -\unexpanded\long\def\dostartgantt[#1]#2#3% - {\getparameters[\????gantt][#1]% - \gdef\gantt!factor{\@@@@ganttfactor} - \gdef\gantt!ganttunitlength{\@@@@ganttxunitlength} - \gdef\gantt!style{\getvalue{@@@@ganttstyle}} - \gdef\gantt!titlestyle{\getvalue{@@@@gantttitlestyle}} - \gdef\gantt!drawledgerline{\@@@@ganttdrawledgerline} - - \bgroup - \newcount\ganttx \ganttx=0 - \newcount\ganttheight - - \def\ganttxstringtop{} - \def\ganttxstringbottom{} - - \global\ganttwidth=#3 - \global\ganttnum=0 - - \ganttheight=#2 - \advance\ganttheight by 1 - - \startMPdrawing - linecap := squared; - linejoin := mitered; - - draw (0,0.5cm)--(0,1.4cm-\the\ganttheight*cm); - draw (\the\ganttwidth*\gantt!ganttunitlength,0.5cm)--(\the\ganttwidth*\gantt!ganttunitlength,1.4cm-\the\ganttheight*cm); - % draw x axis - draw (0cm,-#2*cm+0.4cm)--(\the\ganttwidth*\gantt!ganttunitlength,-#2*cm+0.4cm); - - % draw grid - for t=1 upto \the\ganttwidth: - draw (\gantt!ganttunitlength*t,-0.5cm)--(\gantt!ganttunitlength*t,1.4cm-\the\ganttheight*cm) dashed withdots; - endfor - \stopMPdrawing - \egroup - } - -\unexpanded\def\startgantt% - {\dosingleempty\dostartgantt} - -\unexpanded\def\stopgantt% - {\startMPdrawing - % debug - % draw bbox currentpicture withcolor .625red; - currentpicture := currentpicture scaled \gantt!factor; - \stopMPdrawing - \MPdrawingdonetrue\getMPdrawing - \resetMPdrawing - \doglobal\ganttnum=0 - } - -% ganttitle is the environment for drawing the title section -\definestartstop[ganttitle][ - before={ - \ganttlastx = 0cm - \doglobal\advance\ganttnum by 1 - }, - after={ - \ganttlastx = 0cm - } - ] - -% \titleelement draws one element of the title -% usage: \titleelement{label}{length} -\unexpanded\long\def\dotitleelement#1#2% - {\gantttmpa=\dimexpr\gantt!ganttunitlength*#2\relax - \divide\gantttmpa by 2 - - \startMPdrawing - draw (\the\ganttlastx,0.5cm-\the\!!row*cm)--(\the\ganttlastx+#2*\gantt!ganttunitlength,0.5cm-\the\!!row*cm)--(\the\ganttlastx+#2*\gantt!ganttunitlength,0.5cm-0.6cm-\the\!!row*cm)--(\the\ganttlastx,0.5cm-0.6cm-\the\!!row*cm)--cycle; - path diam; diam = (\the\ganttlastx,0.5cm-\the\!!row*cm)--(\the\ganttlastx+#2*\gantt!ganttunitlength,0.5cm-0.6cm-\the\!!row*cm); - label (textext("\getvalue{gantt!titlestyle}{#1}"), center diam); - \stopMPdrawing - - \ganttlastx=\dimexpr\ganttlastx+\gantt!ganttunitlength*#2\relax - } - -\unexpanded\def\titleelement% - {\dotitleelement} - -% \numtitle draws a numbered sequence of title elements -% usage: \numtitle{start number}{increment}{end number}{length of each title element} -\unexpanded\long\def\donumtitle#1#2#3#4% - {\gantttitlenum=#1 - \dostepwiserecurse{#1}{#3}{#2}{ - \titleelement{\the\gantttitlenum}{#4} - \advance\gantttitlenum by #2 - } - } - -\unexpanded\def\numtitle% - {\donumtitle} - -% \ganttbar draws a single, unconnected bar for representing a task -% usage: \ganttbar[pattern=<pattern>,color=<color>]{label}{start}{length} -% where the optional comma separated arguments are: -% pattern - not implemented with MetaPost yet! (FIXME) -% color - a color of the pattern (e.g. red, green blue gray, dark gray) -\unexpanded\long\def\doganttbar[#1]#2#3#4% - {\bgroup - \getparameters[\????gantt][#1]% - \edef\gantt!pattern{\@@@@ganttpattern} - \edef\gantt!color{\@@@@ganttcolor} - - \gantttmpa=\dimexpr\gantt!ganttunitlength*#3\relax - \gantttmpb=\dimexpr\gantt!ganttunitlength*#4+\gantttmpa\relax - - \doif{\gantt!drawledgerline}{true}{ - \startMPdrawing - draw (0,-\the\ganttnum*cm-0.2cm)--(\the\ganttwidth*\gantt!ganttunitlength,-\the\ganttnum*cm-0.2cm) dashed withdots; - \stopMPdrawing - } - \startMPdrawing - path diag; diag = (0,-\the\ganttnum*cm+0.1cm)--(0,-\the\ganttnum*cm+0.5cm); - label.lft (textext("\getvalue{gantt!style}{#2}"), center diag); - path f; f := (\the\gantttmpa,-\the\ganttnum*cm+0.1cm)--(\the\gantttmpb,-\the\ganttnum*cm+0.1cm)--(\the\gantttmpb,-\the\ganttnum*cm+0.5cm)--(\the\gantttmpa,-\the\ganttnum*cm+0.5cm)--cycle; - - hatchoptions(withcolor \gantt!color); - draw f withcolor black; - % workaround for transparent bug - % hatchfill f withcolor transparent("normal",0,white) withcolor (45,1mm,-0.5bp); - hatchfill f withcolor (45,1mm,-0.5bp); - \stopMPdrawing - - \global\ganttlastx=\gantttmpb - \egroup - \doglobal\advance\ganttnum by 1 - } - -\unexpanded\def\ganttbar - {\dosingleempty\doganttbar} - -% \ganttcon draws an arrow between to bars with specified coordinates -% usage: \ganttcon{startx}{starty}{endx}{endy} -\unexpanded\long\def\doganttcon#1#2#3#4% - {\bgroup - \startMPdrawing - begingroup; - interim linecap := squared; - interim linejoin := rounded; - - drawarrow (#1*\gantt!ganttunitlength,-#2*cm+0.1cm+0.2cm)--(#1*\gantt!ganttunitlength+0.4*\gantt!ganttunitlength,-#2*cm+0.1*cm+0.2*cm)--(#1*\gantt!ganttunitlength+0.4*\gantt!ganttunitlength,-#2*cm-0.4*cm+0.2*cm)--(#1*\gantt!ganttunitlength-0.4*\gantt!ganttunitlength,-#2*cm-0.4*cm+0.2*cm)--(#1*\gantt!ganttunitlength-0.4*\gantt!ganttunitlength,-#4*cm+0.1*cm+0.2*cm)--(#3*\gantt!ganttunitlength,-#4*cm+0.1*cm+0.2*cm); - endgroup; - \stopMPdrawing - \egroup - } - -\unexpanded\def\ganttcon - {\doganttcon} - -% \ganttbarcon draws a single bar *and* connects the bar with the previous bar for -% consecutive tasks -% usage: \ganttbarcon[pattern=<pattern>,color=<color>]{label}{start}{length} -% where the optional pattern argument are the same as for \ganttbar -\unexpanded\long\def\doganttbarcon[#1]#2#3#4% - {\bgroup - \getparameters[\????gantt][#1]% - \edef\gantt!pattern{\@@@@ganttpattern} - \edef\gantt!color{\@@@@ganttcolor} - - \nextganttlastx = \dimexpr\ganttlastx+\ganttunitlength*1\relax - \ifdim\nextganttlastx>\dimexpr\gantt!ganttunitlength*#3\relax - \startMPdrawing - begingroup; - interim linecap := squared; - interim linejoin := rounded; - - drawarrow (\the\ganttlastx,-\the\ganttnum*cm+1.1*cm+0.2*cm)--(\the\ganttlastx+0.4*\gantt!ganttunitlength,-\the\ganttnum*cm+1.1*cm+0.2*cm)--(\the\ganttlastx+0.4*\gantt!ganttunitlength,-\the\ganttnum*cm+0.6*cm+0.2*cm)--(\the\ganttlastx-0.4*\gantt!ganttunitlength,-\the\ganttnum*cm+0.6*cm+0.2*cm)--(\the\ganttlastx-0.4*\gantt!ganttunitlength,-\the\ganttnum*cm+0.1*cm+0.2*cm)--(#3*\gantt!ganttunitlength,-\the\ganttnum*cm+0.1*cm+0.2*cm); - endgroup; - \stopMPdrawing - \else - \startMPdrawing - begingroup; - interim linecap := squared; - interim linejoin := rounded; - - drawarrow (\the\ganttlastx,-\the\ganttnum*cm+1.1*cm+0.2*cm)--(\the\ganttlastx+0.4*\gantt!ganttunitlength,-\the\ganttnum*cm+1.1*cm+0.2*cm)--(\the\ganttlastx+0.4*\gantt!ganttunitlength,-\the\ganttnum*cm+0.1*cm+0.2*cm)--(#3*\gantt!ganttunitlength,-\the\ganttnum*cm+0.1*cm+0.2*cm); - endgroup; - \stopMPdrawing - \fi - - \ganttbar[#1]{#2}{#3}{#4} - \egroup - \doglobal\advance\ganttnum by 1 - } - -\unexpanded\def\ganttbarcon - {\dosingleempty\doganttbarcon} - -% \ganttgroup draws a bar to group tasks -% usage: \ganttgroup{label}{start}{length} -\unexpanded\long\def\doganttgroup#1#2#3% - {\bgroup - \gantttmpa=\dimexpr\gantt!ganttunitlength*#2\relax - \gantttmpb=\dimexpr\gantt!ganttunitlength*#3+\gantttmpa\relax - - \doif{\gantt!drawledgerline}{true}{ - \startMPdrawing - draw (0,-\the\ganttnum*cm-0.2cm)--(\the\ganttwidth*\gantt!ganttunitlength,-\the\ganttnum*cm-0.2cm) dashed withdots; - \stopMPdrawing - } - \startMPdrawing - pen diamond; diamond := makepen fulldiamond; - path diag; diag = (0,-\the\ganttnum*cm+0.1cm)--(0,-\the\ganttnum*cm+0.5cm); - label.lft (textext("\getvalue{gantt!style}{\bf #1}"), center diag); - fill (\the\gantttmpa-0.14*cm,-\the\ganttnum*cm+0.2cm)--(\the\gantttmpb+0.14*cm,-\the\ganttnum*cm+0.2cm)--(\the\gantttmpb+0.14*cm,-\the\ganttnum*cm+0.4cm)--(\the\gantttmpa-0.14*cm,-\the\ganttnum*cm+0.4cm)--cycle withcolor black; - fill fulldiamond scaled 0.3cm shifted (\the\gantttmpa+0.01cm,-\the\ganttnum*cm+0.2cm) withcolor black; - fill fulldiamond scaled 0.3cm shifted (\the\gantttmpb-0.01cm,-\the\ganttnum*cm+0.2cm) withcolor black; - \stopMPdrawing - - \global\ganttlastx=\gantttmpb - \egroup - \doglobal\advance\ganttnum by 1 - } - -\unexpanded\def\ganttgroup - {\doganttgroup} - -% \ganttmilestone, draw a diamond to represent a milestone -% usage: \ganttgroup[color=<color>]{label}{start} -% color - a tikz color of the pattern (e.g. red, green blue gray, dark gray) -% for more information see the tikz documentation - -% Declaring layers to abvoid superposition when you connect a \ganttmileston with a task -\unexpanded\long\def\doganttmilestone[#1]#2#3% - {\bgroup - \getparameters[\????gantt][#1]% - \edef\gantt!color{\@@@@ganttcolor} - - \gantttmpa=\dimexpr\gantt!ganttunitlength*#3\relax - \gantttmpb=\dimexpr\gantt!ganttunitlength*0+\gantttmpa\relax - - \doif{\gantt!drawledgerline}{true}{ - \startMPdrawing - draw (0,-\the\ganttnum*cm-0.2cm)--(\the\ganttwidth*\gantt!ganttunitlength,-\the\ganttnum*cm-0.2cm) dashed withdots; - \stopMPdrawing - } - \startMPdrawing - pen diamond; diamond := makepen fulldiamond; - path diag; diag = (0,-\the\ganttnum*cm+0.1cm)--(0,-\the\ganttnum*cm+0.5cm); - label.lft (textext("\getvalue{gantt!style}{#2}"), center diag); - fill fulldiamond scaled 0.3cm shifted (\the\gantttmpb,-\the\ganttnum*cm+0.3cm) withcolor \gantt!color; - \stopMPdrawing - - \global\ganttlastx=\gantttmpb - \egroup - \doglobal\advance\ganttnum by 1 - } - -\unexpanded\def\ganttmilestone - {\dosingleempty\doganttmilestone} - -% \ganttmilestonecon draws a single diamond *and* connects the diamond with the previous task -% usage: \ganttmilestonecon[color=<color>]{label}{start}{length} -% where the optional color argument are the same as for \ganttbar and \ganttmilestone -\unexpanded\long\def\doganttmilestonecon[#1]#2#3% - {\bgroup - \getparameters[\????gantt][#1]% - \edef\gantt!color{\@@@@ganttcolor} - - \nextganttlastx = \dimexpr\ganttlastx+\ganttunitlength*1\relax - \ifdim\nextganttlastx>\dimexpr\gantt!ganttunitlength*#3\relax - \startMPdrawing - begingroup; - interim linecap := squared; - interim linejoin := rounded; - - drawarrow (\the\ganttlastx,-\the\ganttnum*cm+1.1*cm+0.2*cm)--(\the\ganttlastx+0.4*\gantt!ganttunitlength,-\the\ganttnum*cm+1.1*cm+0.2*cm)--(\the\ganttlastx+0.4*\gantt!ganttunitlength,-\the\ganttnum*cm+0.6*cm+0.2*cm)--(\the\ganttlastx-0.4*\gantt!ganttunitlength-0.14*cm,-\the\ganttnum*cm+0.6*cm+0.2*cm)--(\the\ganttlastx-0.4*\gantt!ganttunitlength-0.14*cm,-\the\ganttnum*cm+0.1*cm+0.2*cm)--(#3*\gantt!ganttunitlength-0.14*cm,-\the\ganttnum*cm+0.1*cm+0.2*cm); - endgroup; - \stopMPdrawing - \else - \startMPdrawing - begingroup; - interim linecap := squared; - interim linejoin := rounded; - - drawarrow (\the\ganttlastx,-\the\ganttnum*cm+1.1*cm+0.2*cm)--(\the\ganttlastx+0.4*\gantt!ganttunitlength,-\the\ganttnum*cm+1.1*cm+0.2*cm)--(\the\ganttlastx+0.4*\gantt!ganttunitlength,-\the\ganttnum*cm+0.1*cm+0.2*cm)--(#3*\gantt!ganttunitlength-0.14*cm,-\the\ganttnum*cm+0.1*cm+0.2*cm); - endgroup; - \stopMPdrawing - \fi - - \ganttmilestone[#1]{#2}{#3} - \egroup - \doglobal\advance\ganttnum by 1 - } - -\unexpanded\def\ganttmilestonecon - {\dosingleempty\doganttmilestonecon} - -\protect \stopmodule diff --git a/Master/texmf-dist/tex/context/third/gantt/gantt-s-tikz.tex b/Master/texmf-dist/tex/context/third/gantt/gantt-s-tikz.tex deleted file mode 100644 index bb0f1a7c8c9..00000000000 --- a/Master/texmf-dist/tex/context/third/gantt/gantt-s-tikz.tex +++ /dev/null @@ -1,312 +0,0 @@ -%D \module -%D [ file=t-gantt-tikz, -%D version=2012.08.19, -%D title=\CONTEXT\ User Module, -%D subtitle=Drawing Gantt charts, -%D author=Adam Reviczky, -%D date=\currentdate, -%D copyright=Adam Reviczky, -%D license=Public Domain] - -%D Some macros for drawing Gantt charts using TikZ. - -\writestatus{loading}{ConTeXt User Module / tikz gantt chart} - -\startmodule[gantt-s-tikz] -\unprotect - -\def\??gantt-tikz{@@gantt-tikz} - -\usemodule[tikz,pgffor] -\usetikzlibrary[arrows,patterns] - -\definesystemvariable{gantt} - -\newcount\ganttnum -\newcount\gantttitlenum -\newcount\ganttwidth - -\newdimen\ganttlastx \ganttlastx = 0cm -\newdimen\nextganttlastx -\newdimen\titleunitlength \titleunitlength = 1cm -\newdimen\ganttunitlength \ganttunitlength = 1cm - -\newdimen\gantttmpa -\newdimen\gantttmpb - -% workaround for titleelement -\def\!!row{\numexpr\ganttnum-1\relax} - -\unexpanded\def\setupgantt - {\bgroup - \dosingleempty - \dosetupgantt} - -\unexpanded\def\dosetupgantt[#1]% - {\egroup - \getparameters[\??gantt][#1]} - -\setupgantt - [xunitlength=1cm, - fontsize=\tf, - titlefontsize=\tfx, - drawledgerline=false] - -\unexpanded\def\setupganttbar - {\bgroup - \dosingleempty - \dosetupganttbar} - -\unexpanded\def\dosetupganttbar[#1]% - {\egroup - \getparameters[\??gantt][#1]} - -\setupganttbar - [pattern=north east lines, - color=black] - -% The gantt environment draws the canvas of a gantt figure (realized as tikzpicture) -% The usage is \startgantt[...]{no of Tasks to plot}{no of time slots} -% The optional argument [...] can be filled in a key=value syntax, using one or more of the following keys: -% -% xunitlength - length of one time slot (default: 1 cm) -% fontsize - fontsize of labels (default: \tf) -% titlefontsize - fontsize of title section (default: \tfx) -% drawledgerline - Switch to enable/disable the drawing of horizontal ledger lines (default value: false) - -\unexpanded\long\def\dostartgantt[#1]#2#3% - {\getparameters[\??gantt][#1]% - \gdef\gantt!ganttunitlength{\getvalue{@@ganttxunitlength}} - \gdef\gantt!fontsize{\getvalue{@@ganttfontsize}} - \gdef\gantt!titlefontsize{\getvalue{@@gantttitlefontsize}} - \gdef\gantt!drawledgerline{\@@ganttdrawledgerline} - - \bgroup - \tikzstyle{time}=[coordinate] - - \newcount\ganttx \ganttx=0 - \newcount\ganttheight - - \def\ganttxstringtop{} - \def\ganttxstringbottom{} - - \global\ganttwidth=#3 - \global\ganttnum=0 - - \ganttheight=#2 - \advance\ganttheight by 1; - - \draw (0,0.5) node[above] {\ganttxstringtop} -- (0,1.4-\ganttheight) node[below] {\ganttxstringbottom}; - \draw (\ganttwidth*\gantt!ganttunitlength,0.5) node[above] {\ganttxstringtop} -- (\ganttwidth*\gantt!ganttunitlength,1.4-\ganttheight) node[below] {\ganttxstringbottom}; - - % draw grid - \foreach \!!t in {1,2,...,\ganttwidth}{ - \draw[dotted] (\gantt!ganttunitlength*\!!t,-0.5) node[above] {\ganttxstringtop} -- (\gantt!ganttunitlength*\!!t,1.4-\ganttheight) node[below] {\ganttxstringbottom}; - } - - % draw x axis - \draw[] (0,-#2+0.4) -- (\ganttwidth*\gantt!ganttunitlength,-#2+0.4); - \egroup - } - -\unexpanded\def\startgantt% - {\starttikzpicture[draw=black,yscale=.7,xscale=1] - \dosingleempty\dostartgantt} - -\unexpanded\def\stopgantt% - {\doglobal\ganttnum=0 - \stoptikzpicture} - -% ganttitle is the environment for drawing the title section -\definestartstop[ganttitle][ - before={ - \ganttlastx = 0cm - \doglobal\advance\ganttnum by 1 - }, - after={ - \ganttlastx = 0cm - } - ] - -% \titleelement draws one element of the title -% usage: \titleelement{label}{length} -\unexpanded\long\def\dotitleelement#1#2% - {\gantttmpa=\dimexpr\gantt!ganttunitlength*#2\relax - \divide\gantttmpa by 2; - - \def\!!xoffset{1.5} - - \draw (\ganttlastx,-\the\!!row) rectangle (\ganttlastx+#2*\gantt!ganttunitlength,-\the\!!row+0.6); - \node [text height=1.5ex,text depth=0.7ex] at (\ganttlastx+\gantttmpa-\!!xoffset,-\the\!!row+0.25) {% - \getvalue{gantt!titlefontsize} #1% - }; - - \ganttlastx=\dimexpr\ganttlastx+\gantt!ganttunitlength*#2\relax - } - -\unexpanded\def\titleelement% - {\dotitleelement} - -% \numtitle draws a numbered sequence of title elements -% usage: \numtitle{start number}{increment}{end number}{length of each title element} -\unexpanded\long\def\donumtitle#1#2#3#4% - {\gantttitlenum=#1 - \dostepwiserecurse{#1}{#3}{#2}{ - \titleelement{\the\gantttitlenum}{#4} - \advance\gantttitlenum by #2; - } - } - -\unexpanded\def\numtitle% - {\donumtitle} - -% \ganttbar draws a single, unconnected bar for representing a task -% usage: \ganttbar[pattern=<pattern>,color=<color>]{label}{start}{length} -% where the optional comma separated arguments are: -% pattern - is a tikz pattern (e.g. north east lines (default), north west lines, crosshatch, crosshatch dots, grid, ...) -% color - a tikz color of the pattern (e.g. red, green blue gray, dark gray) -% for more information see the tikz documentation -\unexpanded\long\def\doganttbar[#1]#2#3#4% - {\bgroup - \getparameters[\??gantt][#1]% - \edef\gantt!pattern{\@@ganttpattern} - \edef\gantt!color{\@@ganttcolor} - - \gantttmpa=\dimexpr\gantt!ganttunitlength*#3\relax - \gantttmpb=\dimexpr\gantt!ganttunitlength*#4+\gantttmpa\relax - - \doif{\gantt!drawledgerline}{true}{ - \draw[dotted] (0,-\the\ganttnum-0.2) -- (\ganttwidth*\gantt!ganttunitlength,-\the\ganttnum-0.2); - } - \node at (0,-\the\ganttnum+0.1) [anchor=base east] {% - \getvalue{gantt!fontsize} #2% - }; - \draw[pattern=\gantt!pattern,pattern color=\gantt!color] (\gantttmpa,-\the\ganttnum+0.1) rectangle (\gantttmpb,-\the\ganttnum+0.5); - \global\ganttlastx=\gantttmpb - \egroup - \doglobal\advance\ganttnum by 1 - } - -\unexpanded\def\ganttbar - {\dosingleempty\doganttbar} - -% \ganttcon draws an arrow between to bars with specified coordinates -% usage: \ganttcon{startx}{starty}{endx}{endy} -\unexpanded\long\def\doganttcon#1#2#3#4% - {\bgroup - \draw[-latex,rounded corners=1pt] (#1*\gantt!ganttunitlength,-#2+0.1+0.2) -- (#1*\gantt!ganttunitlength+0.4*\gantt!ganttunitlength,-#2+0.1+0.2) -- (#1*\gantt!ganttunitlength+0.4*\gantt!ganttunitlength,-#2-0.4+0.2) -- (#1*\gantt!ganttunitlength-0.4*\gantt!ganttunitlength,-#2-0.4+0.2) -- (#1*\gantt!ganttunitlength-0.4*\gantt!ganttunitlength,-#4+0.1+0.2) -- (#3*\gantt!ganttunitlength,-#4+0.1+0.2); - \egroup - } - -\unexpanded\def\ganttcon - {\doganttcon} - -% \ganttbarcon draws a single bar *and* connects the bar with the previous bar for -% consecutive tasks -% usage: \ganttbarcon[pattern=<pattern>,color=<color>]{label}{start}{length} -% where the optional pattern argument are the same as for \ganttbar -\unexpanded\long\def\doganttbarcon[#1]#2#3#4% - {\bgroup - \getparameters[\??gantt][#1]% - \edef\gantt!pattern{\@@ganttpattern} - \edef\gantt!color{\@@ganttcolor} - - \nextganttlastx = \dimexpr\ganttlastx+\ganttunitlength*1\relax - \ifdim\nextganttlastx>\dimexpr\gantt!ganttunitlength*#3\relax - \draw[-latex,rounded corners=1pt] (\ganttlastx,-\the\ganttnum+1.1+0.2) -- (\ganttlastx+0.4*\gantt!ganttunitlength,-\the\ganttnum+1.1+0.2) -- (\ganttlastx+0.4*\gantt!ganttunitlength,-\the\ganttnum+0.6+0.2) -- (\ganttlastx-0.4*\gantt!ganttunitlength,-\the\ganttnum+0.6+0.2) -- (\ganttlastx-0.4*\gantt!ganttunitlength,-\the\ganttnum+0.1+0.2) -- (#3*\gantt!ganttunitlength,-\the\ganttnum+0.1+0.2); - \else - \draw[-latex,rounded corners=1pt] (\ganttlastx,-\the\ganttnum+1.1+0.2) -- (\ganttlastx+0.4*\gantt!ganttunitlength,-\the\ganttnum+1.1+0.2) -- (\ganttlastx+0.4*\gantt!ganttunitlength,-\the\ganttnum+0.1+0.2) -- (#3*\gantt!ganttunitlength,-\the\ganttnum+0.1+0.2); - \fi - - %hbox overfull! - \ganttbar[#1]{#2}{#3}{#4} - \egroup - \doglobal\advance\ganttnum by 1 - } - -\unexpanded\def\ganttbarcon - {\dosingleempty\doganttbarcon} - -% \ganttgroup draws a bar to group tasks -% usage: \ganttgroup{label}{start}{length} -\unexpanded\long\def\doganttgroup#1#2#3% - {\bgroup - \gantttmpa=\dimexpr\gantt!ganttunitlength*#2\relax - \gantttmpb=\dimexpr\gantt!ganttunitlength*#3+\gantttmpa\relax - - \doif{\gantt!drawledgerline}{true}{ - \draw[dotted] (0,-\the\ganttnum-0.2) -- (\ganttwidth*\gantt!ganttunitlength,-\the\ganttnum-0.2); - } - \node at (0,-\the\ganttnum+0.1) [anchor=base east] {% - \getvalue{gantt!fontsize}\bf #1% - }; - \fill[black] (\gantttmpa-0.14cm,-\the\ganttnum+0.2) rectangle (\gantttmpb+0.14cm,-\the\ganttnum+0.4); - \draw[diamond-diamond] (\gantttmpa-0.14cm,-\the\ganttnum+0.2) -- (\gantttmpb+0.14cm,-\the\ganttnum+0.2); - - \global\ganttlastx=\gantttmpb - \egroup - \doglobal\advance\ganttnum by 1 - } - -\unexpanded\def\ganttgroup - {\doganttgroup} - -% \ganttmilestone, draw a diamond to represent a milestone -% usage: \ganttmilestone[color=<color>]{label}{start} -% color - a tikz color of the pattern (e.g. red, green blue gray, dark gray) -% for more information see the tikz documentation - -% Declaring layers to abvoid superposition when you connect a \ganttmileston with a task -\pgfdeclarelayer{background} -\pgfdeclarelayer{foreground} -\pgfsetlayers{background,main,foreground} - -\unexpanded\long\def\doganttmilestone[#1]#2#3% - {\bgroup - \getparameters[\??gantt][#1]% - \edef\gantt!color{\@@ganttcolor} - - \gantttmpa=\dimexpr\gantt!ganttunitlength*#3\relax - \gantttmpb=\dimexpr\gantt!ganttunitlength*0+\gantttmpa\relax - - \doif{\gantt!drawledgerline}{true}{ - \draw[dotted] (0,-\the\ganttnum-0.2) -- (\ganttwidth*\gantt!ganttunitlength,-\the\ganttnum-0.2); - } - \node at (0,-\the\ganttnum) [anchor=base east] {% - \getvalue{gantt!fontsize} #2% - }; - \pgfonlayer{foreground} - \draw[diamond-, color=\gantt!color] (\gantttmpa,-\the\ganttnum+0.1) -- (\gantttmpb,-\the\ganttnum+0.4); - \endpgfonlayer - \global\ganttlastx=\gantttmpb - \egroup - \doglobal\advance\ganttnum by 1 - } - -\unexpanded\def\ganttmilestone - {\dosingleempty\doganttmilestone} - -% \ganttmilestonecon draws a single diamond *and* connects the diamond with the previous task -% usage: \ganttmilestonecon[color=<color>]{label}{start} -% where the optional color argument are the same as for \ganttbar and \ganttmilestone -\unexpanded\long\def\doganttmilestonecon[#1]#2#3% - {\bgroup - \getparameters[\??gantt][#1]% - \edef\gantt!color{\@@ganttcolor} - - \nextganttlastx = \dimexpr\ganttlastx+\ganttunitlength*1\relax - \ifdim\nextganttlastx>\dimexpr\gantt!ganttunitlength*#3\relax - \draw[-latex,rounded corners=1pt] (\ganttlastx,-\the\ganttnum+1.1+0.2) -- (\ganttlastx+0.4*\gantt!ganttunitlength,-\the\ganttnum+1.1+0.2) -- (\ganttlastx+0.4*\gantt!ganttunitlength,-\the\ganttnum+0.6+0.2) -- (\ganttlastx-0.4*\gantt!ganttunitlength-1.8,-\the\ganttnum+0.6+0.2) -- (\ganttlastx-0.4*\gantt!ganttunitlength-1.8,-\the\ganttnum+0.1+0.2) -- (#3*\gantt!ganttunitlength-1.8,-\the\ganttnum+0.1+0.2); - \else - \draw[-latex,rounded corners=1pt] (\ganttlastx,-\the\ganttnum+1.1+0.2) -- (\ganttlastx+0.4*\gantt!ganttunitlength,-\the\ganttnum+1.1+0.2) -- (\ganttlastx+0.4*\gantt!ganttunitlength,-\the\ganttnum+0.1+0.2) -- (#3*\gantt!ganttunitlength-1.8,-\the\ganttnum+0.1+0.2); - \fi - - \ganttmilestone[#1]{#2}{#3} - \egroup - \doglobal\advance\ganttnum by 1 - } - -\unexpanded\def\ganttmilestonecon - {\dosingleempty\doganttmilestonecon} - -\protect \stopmodule diff --git a/Master/texmf-dist/tex/context/third/gantt/t-gantt.tex b/Master/texmf-dist/tex/context/third/gantt/t-gantt.tex deleted file mode 100644 index 06cecfb54a7..00000000000 --- a/Master/texmf-dist/tex/context/third/gantt/t-gantt.tex +++ /dev/null @@ -1,23 +0,0 @@ -%D \module -%D [ file=t-gantt, -%D version=2012.08.19, -%D title=\CONTEXT\ Module, -%D subtitle=Gantt Module, -%D author={Adam Reviczky and Aditya Mahajan}, -%D date=\currentdate, -%D copyright={Adam Reviczky and Aditya Mahajan}, -%D license=Public Domain] - -\writestatus{loading}{module gantt} - -\startmodule[gantt] - -\unprotect -\setupmodule[alternative=] - -\doifdefinedelse{\currentmoduleparameter{\c!alternative}} - {\usemodule[gantt-s-mp]} - {\usemodule[gantt-s-\currentmoduleparameter{\c!alternative}]} - -\protect -\stopmodule diff --git a/Master/texmf-dist/tex/context/third/layout/t-layout.tex b/Master/texmf-dist/tex/context/third/layout/t-layout.tex deleted file mode 100644 index 7ca9d6e1b6f..00000000000 --- a/Master/texmf-dist/tex/context/third/layout/t-layout.tex +++ /dev/null @@ -1,411 +0,0 @@ -%% Last Change: Fri Apr 22 11:06:09 2005 - -%D \module -%D [ file=t-layout, -%D version=2003.03.26, -%D title=\CONTEXT\ User Module, -%D subtitle=show layout, -%D author=Patrick Gundlach, -%D date=\currentdate, -%D copyright={Patrick Gundlach}] - - -%C filename: t-layout.tex -%C module layout, shows layout of current page - - -%C copyright 2003,2007 Patrick Gundlach, patrick@gundla.ch -%C may be distributed under the terms of the GNU General Public License -%C URL: http://levana.de/context/ - -%D \subject{Introduction} -%D This third-party module \quote{layout} draws a representation of -%D the of the layout of the -%D current page and displays the sizes of the widths and heights of the -%D margins, header, footer and text body. - -%D \subject{Usage} -%D Include this module into your ConTeXt files: -%D \type{\usemodule[t][layout]} and show the layout with \type{\ShowLayout}. - -%D You can set some parameters using \type{\SetupShowLayout}. The -%D parameters are: units, digits, round, showmore and graphonly. -%D If graphonly (0/1) is 0, this module shows the lenghts of some text areas. -%D units (cm, mm, in or pt) sets the unit in which the lengths will be -%D displayed, digits (any number $\geq 0$) -%D sets the number of digits after the decimal period, round (any -%D number $\neq 0$) states -%D the place where rounding of the displayed numbers should occur -%D (\TeX\ is bad at calculating such things) and showmore (0/1) tells -%D this module to display information about the edge and top/bottom. - -%D Example: -%D \starttyping -%D \ShowLayout -%D [units=cm, -%D digits=2, -%D round=0.1, -%D showmore=1, -%D graphonly=1] -%D -%D \stoptyping - -%D The idea was taken from the \type{\layout} command from the layout LaTeX -%D package. (Kent McPherson and others) - -%C the following settings will be recognized: -%C units = cm, mm, in or pt -%C digits = any number >= 0, those are the digits after the decimal period -%C round = any number != 0, just play with it, example 0.1 or 0.01. -%C Explanation will be done later - -%D \subject{The code} - -%D This section is not meant as documentation - -\newdimen\ShowLayoutdimen - -\setvalue{Layoutmm}{0.351459804} % 2.54/72.27 * 10 -\setvalue{Layoutcm}{0.0351459804} % 2.54/72.27 -\setvalue{Layoutin}{0.0138370001} % 1/72.27 -\setvalue{Layoutpt}{1} - -\def\ShowLayoutB(#1.#2)#3{% - \counttokens #2\to\scratchcounter - #1\ifnum#3>0% - \ifnum#3 > \the\scratchcounter \else \scratchcounter=#3 \fi - \splitofftokens \scratchcounter \from #2 \to\test .\test \fi} - -% taken from ConTeXt source -\def\LayoutConvert#1#2#3% - {\ShowLayoutdimen=\getvalue{ShowLayoutround}pt - \begingroup - \scratchdimen#1\relax - \scratchdimen\getvalue{Layout#2}\scratchdimen - \advance\scratchdimen by 0.5\ShowLayoutdimen - \divide\scratchdimen by \ShowLayoutdimen - \multiply\scratchdimen by \ShowLayoutdimen - \expandafter\ShowLayoutB\expandafter(\number\withoutpt{\the\scratchdimen}){#3}\thinspace #2 - \endgroup} - -\def\ShowLayoutA#1{% - \LayoutConvert{#1}% - {\getvalue{ShowLayoutunits}}% - {\getvalue{ShowLayoutdigits}}}% - -\startuniqueMPgraphic{ShowLayout}{showmore} -% make sure that the label is on the same side as the posa -vardef swapifnecessary (suffix posa, posb)(expr labelpos) = - if ( (labelpos < posa) and (posa > posb)) - or ( (labelpos > posa) and (posa < posb)) : - save c; %swap 'em - c:=posa; - posa:=posb; - posb:= c; - fi -enddef; -% num: labelnumber -% vertical: horizontal or vertical label? -% pos: for horizontal the y coord, for vertical the x corrd -% posa, posb: positions of the borders (x coord for horizontal) -% labelpos: position for label, only for outer labels, given in the -% same direction as posa, posb -def layoutshowmark(expr num, vertical, pos, posa, posb, labelpos) = - save b,e,c,p,arrow; - numeric b,e; pair p[]; path arrow[],c; - - b:=posa; - e:=posb; - - % p0 is labelposition - % p1 is from - % p2 is to - % p3 is opposite arrow in outer marking - - if labelpos = 0 : % inner label |<----(n)---->| - p0 := (.5[b,e], pos); - else: % outer label --->| |<----(n) - swapifnecessary (b,e, labelpos); - p0 := (labelpos, pos); - p3 := ( if b < labelpos: e-5mm else: e+5mm fi ,pos); - fi - - p1 := (b,pos); - p2 := (e,pos); - - if vertical: - p0:=(ypart p0,xpart p0); - p1:=(ypart p1,xpart p1); - p2:=(ypart p2,xpart p2); - p3:=(ypart p3,xpart p3); - fi - c:= fullcircle scaled .7cm shifted p0; - - if (center(c) -- p1) intersectiontimes c = (-1,-1): - % don't draw the arrows, because there is not enough room for them. - else: - arrow1 :=center(c) -- p1 cutbefore (center(c) -- p1) intersectionpoint c ; - arrow2 := - if labelpos = 0 : % inner - center(c) -- p2 cutbefore (center(c) -- p2) intersectionpoint c - else: - p3 -- p2 - fi; - - label (decimal (num), center(c)); - draw c; - drawarrow arrow1; - drawarrow arrow2; - fi - -enddef; - - - -StartPage; -numeric xpos,ypos; - -path body,leftmargin,header,footer,rightmargin; - - -% backspace: -draw llcorner Page shifted (BackSpace,0) -- - ulcorner Page shifted (BackSpace,0) dashed evenly; - -%topspace -draw urcorner Page shifted (0,-TopSpace) -- - ulcorner Page shifted (0,-TopSpace) dashed evenly; - - -header := Field [Header] [Text]; -footer := Field [Footer] [Text]; -leftmargin := Field [LeftMargin] [Text]; -rightmargin:= Field [RightMargin][Text]; -body := Field [Text] [Text]; - -pickup pencircle scaled 2pt; - -draw Page; -draw leftmargin; -draw rightmargin; -draw header; -draw footer; -draw body; - - - -label ("Body", center (body)); -label ("Header",center (header)); -label ("Left Margin", center (leftmargin)); -label ("Right Margin", center (rightmargin)); -label ("Footer", center (footer)); -%% label (textext("\tfb Body"), center (body)); -%% label (textext("\tfa Header"),center (header)); -%% label (textext("Left Margin"), center (leftmargin)); -%% label (textext("Right Margin"), center (rightmargin)); -%% label (textext("\tfa Footer"), center (footer)); - - -if \MPvar{showmore}=1: - path top, bot, leftedge, rightedge; - - top := Field [Top] [Text]; - bot := Field [Bottom] [Text]; - leftedge := Field [LeftEdge] [Text]; - rightedge := Field [RightEdge][Text]; - - draw top; - draw bot; - draw leftedge; - draw rightedge; -fi - -pickup pencircle scaled 1pt; - -% (num, vertical, pos, from, to, labelpos) - -%backspace -layoutshowmark (1, false, .5[ypart(ulcorner Page),Vstep[Top]], 0,BackSpace,0) - - -ypos := Vstep[HeaderSeparator] -1cm; - -% leftmargin -layoutshowmark (2, false, ypos, - Hstep[LeftMargin], - Hstep[LeftMargin]+Hsize[LeftMargin],0); - -% leftmargindistance -layoutshowmark (3, false, ypos -1cm, - Hstep[LeftMarginSeparator], - Hstep[Text], - Hstep[Text]+1cm); - -% makeupwidth -layoutshowmark (4, false, Vstep[Text]+2cm, - Hstep[Text], Hstep[Text]+Hsize[Text],0); - -% rightmargin -layoutshowmark (5, false, ypos, - Hstep[RightMargin], - Hstep[RightMargin]+Hsize[RightMargin],0); - -% rightmargindistance -layoutshowmark (6, false, ypos-1cm, - Hstep[RightMargin], - Hstep[RightMarginSeparator], - Hstep[RightMarginSeparator] -1cm); - - -%topspace - -xpos:=xpart(ulcorner Page)+BackSpace+1cm; -layoutshowmark (7, true, xpos, PaperHeight,PaperHeight-TopSpace,0) - -%header -xpos:=xpos+1cm; -ypos:=.5[PaperHeight,PaperHeight-TopSpace]; -layoutshowmark (8, true, xpos , - Vstep[Header], - Vstep[Header]+Vsize[Header],ypos); - -%headerseparator -xpos:=xpos+1cm; -layoutshowmark (9, true,xpos, - Vstep[HeaderSeparator], - Vstep[HeaderSeparator]+Vsize[HeaderSeparator],ypos); - -xpos:=xpos+1cm; - -if \MPvar{showmore}=1: - % top - layoutshowmark (17, true, xpos, - Vstep[Top], - Vstep[Top]+Vsize[Top], ypos); - - xpos:=xpos+1cm; - layoutshowmark (18, true, xpos, - Vstep[TopSeparator], - Vstep[TopSeparator]+Vsize[TopSeparator], ypos); - -fi - -% makeupheight -layoutshowmark (10, true,Hstep[RightMarginSeparator]-2cm, - Vstep[Header]+Vsize[Header], - Vstep[Footer],0); - - -%footerseparator -xpos:=xpart(ulcorner Page)+BackSpace+2cm; -ypos:=.5(Vstep[Footer]); - -layoutshowmark (11, true,xpos, - Vstep[FooterSeparator], - Vstep[FooterSeparator]+Vsize[FooterSeparator],ypos); - -%footer -xpos:=xpos+1cm; -layoutshowmark (12, true,xpos, - Vstep[Footer],Vstep[Footer]+Vsize[Footer],ypos); - -xpos:=xpos+1cm; - -if \MPvar{showmore}=1: - % bottom - layoutshowmark (19, true, xpos, - Vstep[Bottom], - Vstep[Bottom]+Vsize[Bottom], ypos); - xpos:=xpos+1cm; - layoutshowmark (20, true, xpos, - Vstep[BottomSeparator], - Vstep[BottomSeparator]+Vsize[BottomSeparator], ypos); - -fi - -if \MPvar{showmore}=1: - - ypos := Vstep[HeaderSeparator] -3cm; - - % LeftEdge - layoutshowmark (13, false, ypos, - Hstep[LeftEdge], - Hstep[LeftEdge]+Hsize[LeftEdge],Hstep[Text]+1cm); - ypos := ypos-1cm; - % LeftEdgeSeparator - layoutshowmark (14, false, ypos, - Hstep[LeftEdgeSeparator], - Hstep[LeftEdgeSeparator]+Hsize[LeftEdgeSeparator], - Hstep[Text]+1cm); - - ypos := Vstep[HeaderSeparator] -3cm; - - layoutshowmark (15, false, ypos, - Hstep[RightEdge], - Hstep[RightEdge]+Hsize[RightEdge], - Hstep[RightMarginSeparator] -1cm); - - ypos := ypos-1cm; - - layoutshowmark (16, false, ypos, - Hstep[RightEdge], - Hstep[RightEdgeSeparator], - Hstep[RightMarginSeparator] -1cm); - - - -fi - -currentpicture := currentpicture scaled .5; - -\stopuniqueMPgraphic -\defineoverlay[ShowLayout][\uniqueMPgraphic{ShowLayout}] - -\def\SetupShowLayout{\dosingleempty\getparameters[ShowLayout]} -\SetupShowLayout[units=pt,digits=1,round=0.1,showmore=0,graphonly=0] - -\def\ShowLayout{\dosingleempty\doShowLayout} - - -\def\doShowLayout[#1]{% - \getparameters[ShowLayout][#1] - \setMPvariables[ShowLayout][showmore=\getvalue{ShowLayoutshowmore}] - \framed[width=.5\paperwidth, - height=.5\paperheight, - background=ShowLayout, - frame=off, -% frame=on, - ]{}% -\ifnum\getvalue{ShowLayoutgraphonly}=0 - \bgroup\tfxx -\startcolumns[n=2] -\starttabulate[|r|l|] -\NC 1 \NC backspace \ShowLayoutA{\the\backspace} \NR -\NC 2 \NC leftmargin \ShowLayoutA{\the\leftmarginwidth}\NR -\NC 3 \NC leftmargindistance \ShowLayoutA{\the\leftmargindistance}\NR -\NC 4 \NC width \ShowLayoutA{\the\makeupwidth}\NR -\NC 5 \NC rightmargin \ShowLayoutA{\the\rightmarginwidth}\NR -\NC 6 \NC rightmargindistance \ShowLayoutA{\the\rightmargindistance}\NR -\NC 7 \NC topspace \ShowLayoutA{\the\topspace}\NR -\NC 8 \NC header \ShowLayoutA{\the\headerheight}\NR -\NC 9 \NC headerdistance \ShowLayoutA{\the\headerdistance}\NR -\NC 10\NC height \ShowLayoutA{\the\makeupheight}\NR -\NC 11\NC footerdistance \ShowLayoutA{\the\footerdistance}\NR -\NC 12\NC footer \ShowLayoutA{\the\footerheight}\NR -\ifnum\getvalue{ShowLayoutshowmore}=1% -\NC 13\NC leftedge \ShowLayoutA{\the\leftedgewidth}\NR -\NC 14\NC leftedgedistance \ShowLayoutA{\the\leftedgedistance}\NR -\NC 15\NC rightedge \ShowLayoutA{\the\rightedgewidth}\NR -\NC 16\NC rightedgedistance \ShowLayoutA{\the\rightedgedistance}\NR -\NC 17\NC top \ShowLayoutA{\the\topheight}\NR -\NC 18\NC topdistance \ShowLayoutA{\the\topdistance}\NR -\NC 19\NC bottom \ShowLayoutA{\the\bottomheight}\NR -\NC 20\NC bottomdistance \ShowLayoutA{\the\bottomdistance}\NR -\fi -\NC \NC paperwidth \ShowLayoutA{\the\paperwidth}\NR -\NC \NC paperheight \ShowLayoutA{\the\paperheight}\NR -\stoptabulate -\stopcolumns -\egroup -\fi -} diff --git a/Master/texmf-dist/tex/context/third/rst/rst_context.lua b/Master/texmf-dist/tex/context/third/rst/rst_context.lua deleted file mode 100644 index 699064e5726..00000000000 --- a/Master/texmf-dist/tex/context/third/rst/rst_context.lua +++ /dev/null @@ -1,1326 +0,0 @@ -#!/usr/bin/env texlua --------------------------------------------------------------------------------- --- FILE: rst_context.lua --- USAGE: called by rst_parser.lua --- DESCRIPTION: Complement to the reStructuredText parser --- AUTHOR: Philipp Gesang (Phg), <phg42.2a@gmail.com> --- CHANGED: 2013-03-26 22:46:17+0100 --------------------------------------------------------------------------------- --- ---- TODO ---- Find an appropriate way to handle generic tables irrespective of the grid ---- settings. The problem is: ---- http://archive.contextgarden.net/message/20100912.112605.8a1aaf13.en.html ---- Seems we'll have to choose either the grid or split tables as default. Not ---- good. - - -local helpers = helpers or thirddata and thirddata.rst_helpers -local rst_directives = rst_directives or thirddata and thirddata.rst_directives - -local utf = unicode.utf8 -local utflen = utf.len -local utflower = utf.lower -local utfupper = utf.upper -local iowrite = io.write -local tableconcat = table.concat - -local stringgmatch = string.gmatch -local stringgsub = string.gsub -local stringmatch = string.match -local stringsub = string.sub -local stringformat = string.format - -local dbg_write = helpers.dbg_writef - -local C, Cb, Cc, Cg, Cmt, Cp, - Cs, Ct, P, R, S, V, lpegmatch - = lpeg.C, lpeg.Cb, lpeg.Cc, lpeg.Cg, lpeg.Cmt, lpeg.Cp, - lpeg.Cs, lpeg.Ct, lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.match - --- This one should ignore escaped spaces. -do - local stripper = P{ - [1] = "stripper", - stripper = V"space"^0 * C((V"space"^0 * (V"escaped" + V"nospace")^1)^0), - space = S(" \t\v\n"), - nospace = 1 - V"space", - escaped = P"\\" * V"space" - } - function string.strip(str) - return lpegmatch(stripper, str) or "" - end -end -local stringstrip = string.strip - -local err = function(str) - if str then - iowrite("\n*[rstctx] Error: " .. str .. "\n\n") - end -end - -local rst_context = thirddata.rst - -rst_context.collected_adornments = {} -rst_context.last_section_level = 0 -rst_context.anonymous_targets = 0 -rst_context.anonymous_links = {} - -rst_context.collected_references = {} -rst_context.context_references = {} -rst_context.structure_references = {} -rst_context.anonymous_set = {} - -rst_context.substitutions = {} -rst_context.lastitemnumber = 0 -- enumerations in RST allow arbitrary skips - -rst_context.current_footnote_number = 0 -rst_context.current_symbolnote_number = 0 - -function rst_context.addsetups(item) - local state = rst_context.state - state.addme[item] = state.addme[item] or true - return 0 -end - -function rst_context.footnote_reference (label) - local tf = rst_context.state.footnotes - if stringmatch(label, "^%d+$") then -- all digits - local c = tonumber(label) - return [[\\footnote{\\getbuffer[__footnote_number_]].. c .."]}" - elseif label == "#" then --autonumber - local rc = rst_context.current_footnote_number - rc = rc + 1 - rst_context.current_footnote_number = rc - return [[\\footnote{\\getbuffer[__footnote_number_]].. rc .."]}" - elseif stringmatch(label, "^#.+$") then - local thelabel = stringmatch(label, "^#(.+)$") - return [[\\footnote{\\getbuffer[__footnote_label_]].. thelabel .."]}" - elseif label == "*" then - local rc = rst_context.current_symbolnote_number - rc = rc + 1 - rst_context.current_symbolnote_number = rc - return [[\\symbolnote{\\getbuffer[__footnote_symbol_]].. rc .."]}" - else -- “citation reference” for now treating them like footnotes - rst_context.addsetups("citations") - return [[\\cite{]] .. label .. [[}]] - end -end - -do - local w = S" \v\t\n" / "_" - local wp = Cs((w + 1)^1) - function rst_context.whitespace_to_underscore(str) - return str and lpegmatch(wp, str) or "" - end -end - ---- So we can use crefs[n][2] to refer to the place where the reference was ---- created. -local function get_context_reference (str) - local crefs = rst_context.context_references - local srefs = rst_context.structure_references - srefs[str] = true - refstring = "__target_" .. rst_context.whitespace_to_underscore(str) - crefs[#crefs + 1] = { refstring, str } - return refstring -end - -function rst_context.emphasis (str) - return [[{\\em ]] .. str .. [[}]] -end - -function rst_context.strong_emphasis (str) - return [[{\\sc ]] .. str .. [[}]] -end - -function rst_context.literal (str) - return [[\\type{]] .. str .. [[}]] -end - ---- ROLES for interpreted text - -rst_context.roles = {} -rst_context.roles.emphasis = rst_context.emphasis -rst_context.roles.strong_emphasis = rst_context.strong_emphasis -rst_context.roles.literal = rst_context.literal -rst_context.roles.bold = function(str) - return [[{\\bold ]] .. str .. [[}]] -end -rst_context.roles.bf = rst_context.roles.bold - -rst_context.roles.italic = function(str) - return [[{\\italic ]] .. str .. [[}]] -end -rst_context.roles.it = rst_context.roles.italic - -rst_context.roles.sans = function(str) - return [[{\\ss ]] .. str .. [[}]] -end -rst_context.roles.sans_serif = rst_context.roles.sans -rst_context.roles.ss = rst_context.roles.sans - -rst_context.roles.uppercase = function(str) - return utfupper(str) -end - -rst_context.roles.lowercase = function(str) - return utflower(str) -end - -rst_context.roles.color = function(color, str) - local p = helpers.patterns - local definition = stringmatch(color, "^color_(.+)$") - if stringmatch(definition, "^rgb_") then -- assume rgb - local rgb = lpegmatch(p.rgbvalues, definition) - definition = stringformat([[r=%s,g=%s,b=%s]], rgb[1], rgb[2], rgb[3]) - end - return stringformat([[\\colored[%s]{%s}]], definition, str) -end - --------------------------------------------------------------------------------- ---- Inofficial text roles for my private bib --------------------------------------------------------------------------------- - --- Afterthought: --- Different citation commands are essentially typographical instructions: --- they are concerned with the final representation of the data with respect to --- a concrete implementation. Not the thing at all that would make reST --- portable. But then its support for Python-style string escaping &c. ain’t at --- all portable either. The problem is the same with XML written to be --- processed with ConTeXt -- when processing the text directly in MkIV you’ll --- always find yourself adding setups that allow fine-grained control of the --- typeset output. At the same time those instructions directly contradict the --- main reason for XML: to provide an application-independent data markup. --- Typesetting XML (and now reST) with TeX, you will always end up writing TeX --- code disguised in XML brackets. (Btw. the docutils reST specification has --- the same kind of inclination to HTML -- some of its components don’t even --- have a meaning save in HTML peculiarities.) If you strive to avoid this --- *and* would like to have decent typesetting, you should use the --- automatically generated TeX code as a starting point for the actual --- typesetting job. Wish it was possible to have both -- the data in a --- universal form and the output in the Optimal Typesetting System -- but --- that’s a dream for now. If you really read these musings, then prove me --- wrong if you can! Or go tell those digital publishers and their willing --- subordinates, the authors, who think they can save a few pennys, --- substituting the typesetter and editor by some fancy software. Keep in mind --- that zapf.tex is not just random dummy text. </rant> - -function rst_context.roles.ctsh(str) -- shorthand - rst_context.addsetups("citator") - return [[\\ctsh{]] .. str .. [[}]] -end - -function rst_context.roles.ctas(str) -- short cite - rst_context.addsetups("citator") - return [[\\ctas{]] .. str .. [[}]] -end - -function rst_context.roles.ctau(str) -- author only - rst_context.addsetups("citator") - return [[\\ctau{]] .. str .. [[}]] -end - -function rst_context.roles.cttt(str) -- title only - rst_context.addsetups("citator") - return [[\\cttt{]] .. str .. [[}]] -end - -function rst_context.roles.ctay(str) -- author year - rst_context.addsetups("citator") - return [[\\ctay{]] .. str .. [[}]] -end - -function rst_context.roles.ctfu(str) -- full cite - rst_context.addsetups("citator") - return [[\\ctfu{]] .. str .. [[}]] -end - -function rst_context.roles.nocite(str) -- nocite - rst_context.addsetups("citator") - return [[\\nocite[]] .. str .. [=[]]=] -end - --------------------------------------------------------------------------------- ---- End citator roles --------------------------------------------------------------------------------- - --------------------------------------------------------------------------------- ---- Experimental roles. --------------------------------------------------------------------------------- - ---- Feature request by Philipp A. -function rst_context.roles.math(str) - return [[\\mathematics{]] .. str .. [[}]] -end - --------------------------------------------------------------------------------- ---- End roles --------------------------------------------------------------------------------- - -function rst_context.interpreted_text (...) - local tab = { ... } - local role, str - role = stringmatch(tab[1], "^:(.*):$") or stringmatch(tab[3], "^:(.*):$") - str = tab[2] - - if not role then -- implicit role - role = "emphasis" - end - - if stringmatch(role, "^color_") then - return rst_context.roles.color(role, str) - end - - return rst_context.roles[role](str) -end - -function rst_context.link_standalone (str) - return "\n" - .. [[\\goto{\\hyphenatedurl{]] .. str .. [[}}[url(]] .. str .. [=[)]]=] -end - -function rst_context.reference (str) - rst_context.addsetups("references") - str = stringmatch(str, "^`?([^`]+)`?_$") - return [[\\RSTchoosegoto{__target_]] .. rst_context.whitespace_to_underscore(str) .. "}{" - .. str .. "}" -end - -function rst_context.anon_reference (str) - rst_context.addsetups("references") - str = stringmatch(str, "^`?([^`]+)`?__$") - rst_context.anonymous_links[#rst_context.anonymous_links+1] = str - link = "__target_anon_" .. #rst_context.anonymous_links - return stringformat([[\\RSTchoosegoto{%s}{%s}]], link, str) -end - -local whitespace = S" \n\t\v" -local nowhitespace = 1 - whitespace -local removewhitespace = Cs((nowhitespace^1 + Cs(whitespace / ""))^0) - -function rst_context.target (tab) - rst_context.addsetups("references") - --local tab = { ... } - local refs = rst_context.collected_references - local arefs = rst_context.anonymous_set - local target = tab[#tab] -- Ct + C could be clearer but who cares - tab[#tab] = nil - - local function create_anonymous () - rst_context.anonymous_targets = rst_context.anonymous_targets + 1 - return { "anon_" .. rst_context.anonymous_targets, rst_context.anonymous_targets } - end - - local insert = "" - - if target == "" then -- links here - for _, id in next, tab do - insert = insert .. "\n\\reference[__target_" .. id .. "]{}" - end - else - for i=1,#tab do - local id = tab[i] - if id == "" then -- anonymous - local anon = create_anonymous() - id, arefs[anon[1]] = anon[1], anon[2] - else - local tmp = tab[i] - tmp = stringgsub(tmp, "\\:",":") - tmp = stringmatch(tmp, "`?([^`]+)`?") - id = tmp - --id = tab[i]:gsub("\\:",":"):match("`?([^`]+)`?") -- deescaping - end - if id then - refs[id] = refs[id] or target - end - end - end - - return insert -end - -function rst_context.inline_internal_target (str) - return "\\\\reference[__target_" .. rst_context.whitespace_to_underscore(str) .."]{}" -end - -function rst_context.substitution_reference (str, underscores) - local sub = "" - rst_context.addsetups "substitutions" - if underscores == "_" then -- normal reference - sub = sub .. [[\\reference[__target_]] .. rst_context.whitespace_to_underscore(stringstrip(str)) .. "]{}" - elseif underscores == "__" then -- normal reference - rst_context.anonymous_targets = rst_context.anonymous_targets + 1 - sub = sub .. [[\\reference[__target_anon_]] .. rst_context.anonymous_targets .. "]{}" - end - return sub .. [[{\\RSTsubstitution]] .. stringgsub(str, "%s", "") .. "}" -end - -do - -- see catc-sym.tex - local escape_me = { - ["&"] = [[\letterampersand ]], - ["$"] = [[\letterdollar ]], - ["#"] = [[\letterhash ]], - ["^"] = [[\letterhat ]], - ["_"] = [[\letterunderscore ]], - } - - local chars - for chr, repl in next, escape_me do - chars = chars and chars + (P(chr) / repl) or P(chr) / repl - end - - local p_escape = P{ - [1] = Cs((V"skip" - --+ V"literal" -- achieved via gsub later - + chars - + 1)^1), - skip1 = P"\\starttyping" * (1 - P"\\stoptyping")^1, - balanced = P"{" * (V"balanced" + (1 - P"}"))^0 * P"}", - skip2 = P"\\type" * V"balanced", - skip3 = P"\\mathematics" * V"balanced", - skip = V"skip1" + V"skip2" + V"skip3", - --literal = Cs(P"\\" / "") * 1 - } - - function rst_context.escape (str) - str = stringgsub(str, "\\(.)", "%1") - return lpegmatch(p_escape, str) - end -end - -function rst_context.joinindented (tab) - return tableconcat (tab, "") -end - -local corresponding = { - ['"'] = '"', - ["'"] = "'", - ["{"] = "}", - ["("] = ")", - ["["] = "]", - ["<"] = ">", -} - -local inline_parser = P{ - [1] = "block", - - block = Cs(V"inline_as_first"^-1 * (V"except" + V"inline_element" + V"normal_char")^0), - - inline_element = V"precede_inline" - * Cs(V"inline_do_elements") - * #V"succede_inline" - + V"footnote_reference" - , - - -- Ugly but needed in case the first element of a paragraph is inline - -- formatted. - inline_as_first = V"inline_do_elements" * #V"succede_inline", - - except = P"\\starttyping" * (1 - P"\\stoptyping")^1 * P"\\stoptyping" - + V"enclosed" - , - - inline_do_elements = V"strong_emphasis" - + V"substitution_reference" - + V"anon_reference" - + V"inline_literal" - + V"reference" - + V"emphasis" - + V"interpreted_text" - + V"inline_internal_target" - + V"link_standalone" - , - - precede_inline = V"spacing" - + V"eol" - + -P(1) - + S[['"([{<-/:]] - + P"‘" + P"“" + P"’" + P"«" + P"¡" + P"¿" - + V"inline_delimiter" - + P"„", -- not in standard Murkin reST - - succede_inline = V"spacing" - + V"eol" - + S[['")]}>-/:.,;!?\]] - + P"’" + P"”" + P"»" - + V"inline_delimiter" - + -P(1) - + P"“" -- non-standard again but who cares - , - - enclosed = V"precede_inline"^-1 - * Cg(V"quote_single" + V"quote_double" + V"leftpar", "lastgroup") - * V"inline_delimiter" - * Cmt(C(V"quote_single" + V"quote_double" + V"rightpar") * Cb("lastgroup"), function(s, i, char, oldchar) - return corresponding[oldchar] == char - end) - * V"succede_inline"^-1 - * -V"underscore" - , - - space = P" ", - whitespace = (P" " + Cs(P"\t") / " " + Cs(S"\v") / " "), - spacing = V"whitespace"^1, - - eol = P"\n", - --inline_delimiters = P"‐" + P"‑" + P"‒" + P"–" + V"emdash" + V"space", -- inline markup - inline_delimiter = P"‐" + P"‑" + P"‒" + P"–" + V"emdash" + V"space" - + V"bareia" - + V"asterisk" - + V"bar" - + V"lbrack" + V"rbrack" - , -- inline markup - asterisk = P"*", - quote_single = P"'", - quote_double = P'"', - double_asterisk = V"asterisk" * V"asterisk", - bareia = P"`", - backslash = P"\\", - bar = P"|", - double_bareia = V"bareia" * V"bareia", - escaped_bareia = (Cs(V"backslash") / "" * V"bareia") + 1, - colon = P":", - escaped_colon = (Cs(V"backslash") / "" * V"colon") + 1, - semicolon = P";", - underscore = P"_", - double_underscore = V"underscore" * V"underscore", - dot = P".", - interpunct = P"·", - comma = P",", - dash = P"-", - emdash = P"—", - ellipsis = P"…" + P"...", - exclamationmark = P"!", - questionmark = P"?", - interrobang = P"‽", - double_dash = V"dash" * V"dash", - triple_dash = V"double_dash" * V"dash", - hyphen = P"‐", - dashes = V"dash" + P"‒" + P"–" + V"emdash" + P"―", - - lparenthesis = P"(", - rparenthesis = P")", - lbrack = P"[", - rbrack = P"]", - lbrace = P"{" / [[{\\letterleftbrace}]], - rbrace = P"}" / [[{\\letterrightbrace}]], - less = P"<", - greater = P">", - leftpar = V"lparenthesis" + V"lbrack" + V"lbrace" + V"less", - rightpar = V"rparenthesis" + V"rbrack" + V"rbrace" + V"greater", - - normal_char = V"lbrace" + V"rbrace" + V"lbrack" + V"rbrack" -- escape those if in input - + 1 - , - - --groupchars = S"()[]{}", - groupchars = V"leftpar" + V"rightpar", - apostrophe = P"’" + P"'", - - guillemets = P"«" + P"»", - quotationmarks= P"‘" + P"’" + P"“" + P"”", - solidus= P"⁄", - slash = P"/", - - gartenzaun = P"#", - digit = R"09", - letter = R"az" + R"AZ", - - punctuation = V"apostrophe" - + V"colon" - + V"comma" - + V"dashes" - + V"dot" - + V"ellipsis" - + V"exclamationmark" - + V"guillemets" - + V"hyphen" - + V"interpunct" - + V"interrobang" - + V"questionmark" - + V"quotationmarks" - + V"semicolon" - + V"slash" - + V"solidus" - + V"underscore" - , - - emphasis = (V"asterisk" - V"double_asterisk") - * Cs((V"normal_char" - V"spacing" - V"eol" - V"asterisk") - * ((V"normal_char" - (V"normal_char" * V"asterisk"))^0 - * (V"normal_char" - V"spacing" - V"eol" - V"asterisk"))^-1) - * V"asterisk" - / rst_context.emphasis, - - strong_emphasis = V"double_asterisk" - * Cs((V"normal_char" - V"spacing" - V"eol" - V"asterisk") - * ((V"normal_char" - (V"normal_char" * V"double_asterisk"))^0 - * (V"normal_char" - V"spacing" - V"eol" - V"asterisk"))^-1) - * V"double_asterisk" - / rst_context.strong_emphasis, - - inline_literal = V"double_bareia" - * C ((V"escaped_bareia" - V"spacing" - V"eol" - V"bareia") - * ((V"escaped_bareia" - (V"normal_char" * V"double_bareia"))^0 - * (V"escaped_bareia" - V"spacing" - V"eol" - V"bareia"))^-1) - * V"double_bareia" - / rst_context.literal, - - interpreted_single_char = (V"normal_char" - V"spacing" - V"eol" - V"bareia") * #V"bareia", - interpreted_multi_char = (V"normal_char" - V"spacing" - V"eol" - V"bareia") * (V"normal_char" - (1 * V"bareia"))^0 * (1 - V"spacing" - V"eol" - V"bareia"), - - interpreted_text = C(V"role_marker"^-1) - * (V"bareia" - V"double_bareia") - * C(V"interpreted_single_char" + V"interpreted_multi_char") - * V"bareia" - * C(V"role_marker"^-1) - / rst_context.interpreted_text, - - role_marker = V"colon" * (V"backslash" * V"colon" + V"letter" + V"digit" + V"dash" + V"underscore" + V"dot")^1 * V"colon", - - link_standalone = C(V"uri") - / rst_context.link_standalone, - - anon_reference = Cs(V"anon_phrase_reference" + V"anon_normal_reference") - / rst_context.anon_reference, - - anon_normal_reference = C((1 - V"underscore" - V"spacing" - V"eol" - V"punctuation" - V"groupchars")^1) * V"double_underscore", - - anon_phrase_reference = (V"bareia" - V"double_bareia") - * C((1 - V"bareia")^1) - * V"bareia" * V"double_underscore" - , - - reference = Cs(V"normal_reference" + V"phrase_reference") - / rst_context.reference, - - normal_reference = (1 - V"underscore" - V"spacing" - V"eol" - V"punctuation" - V"groupchars")^1 * V"underscore", - - phrase_reference = (V"bareia" - V"double_bareia") - * C((1 - V"bareia")^1) - * V"bareia" * V"underscore" - , - - footnote_reference = V"lbrack" - * Cs(V"footnote_label" + V"citation_reference_label") - * V"rbrack" - * V"underscore" - / rst_context.footnote_reference - , - - footnote_label = V"digit"^1 - + V"gartenzaun" * V"letter"^1 - + V"gartenzaun" - + V"asterisk" - , - - citation_reference_label = V"letter" * (1 - V"rbrack")^1, - - inline_internal_target = V"underscore" - * V"bareia" - * Cs((1 - V"bareia")^1) - * V"bareia" - / rst_context.inline_internal_target - , - - substitution_reference = V"bar" - * C((1 - V"bar")^1) - * V"bar" - * C((V"double_underscore" + V"underscore")^-1) - / rst_context.substitution_reference - , - --------------------------------------------------------------------------------- --- Urls --------------------------------------------------------------------------------- - uri = V"url_protocol" * V"url_domain" * V"url_path_char"^0, - - url_protocol = (P"http" + P"ftp" + P"shttp" + P"sftp") * P"://", - url_domain_char = 1 - V"dot" - V"spacing" - V"eol" - V"punctuation", - url_domain = V"url_domain_char"^1 * (V"dot" * V"url_domain_char"^1)^0, - url_path_char = R("az", "AZ", "09") + S[[-_.!~*'()/]], -} - -rst_context.inline_parser = inline_parser - -function rst_context.paragraph (data) - local str - if not data then - return "" - elseif type(data) == "table" then --- str = #data > 1 and helpers.string.wrapat(lpegmatch(inline_parser, tableconcat(data, " ")), 65) --- or inline_parser:match(data[1]) - if #data > 1 then - str = helpers.string.wrapat( - lpegmatch(inline_parser, tableconcat(data, " ")) - , 65) - else - str = lpegmatch(inline_parser, data[1]) - end - else - str = data - end - return stringformat([[ - -\\startparagraph -%s -\\stopparagraph -]], str) -end - -local sectionlevels = { - [1] = "chapter", - [2] = "section", - [3] = "subsection", - [4] = "subsubsection", - [5] = "subsubsubsection", -} - -local function get_line_pattern (chr) - return P(chr)^1 * (-P(1)) -end - ---[[-- - Quoth the spec: - An underline-only adornment is distinct from an - overline-and-underline adornment using the same character. - - We store the depths by hashing the adorn character and distinguish - the overlined ones from only underlined ones by prefixing them with - “O” and “U”, respectively. ---]]-- - -function rst_context.section (first, second, third) - local section = true - local str = "" - local adornchar = nil - local ulen = utflen - if third then --- overlined - adornchar = "O" .. stringsub(first, 1,1) - section = ulen(first) >= ulen(second) - str = stringstrip(second) - else -- underline-only - adornchar = "U" .. stringsub(second, 1,1) - section = ulen(first) <= ulen(second) - str = stringstrip(first) - end - - if section then -- determine level - local level = rst_context.last_section_level - local rca = rst_context.collected_adornments - if rca[adornchar] then - level = rca[adornchar] - else - level = level + 1 - rca[adornchar] = level - rst_context.last_section_level = level - end - - local ref = get_context_reference (str) - - str = stringformat("\n\\\\%s[%s]{%s}\n", - sectionlevels[level], - ref, - str) - return str or "" - end - return [[{\\bf fix your sectioning!}\\endgraf}]] -end - --- Prime time for the fancybreak module. -function rst_context.transition (str) - rst_context.addsetups("breaks") - --return "\\fancybreak\n" - return "\\fancybreak{$* * *$}\n" -end - -function rst_context.bullet_marker(str) - return "marker" -end - --- This one should ignore escaped spaces. -do - local stripper = P{ - [1] = "stripper", - stripper = V"space"^0 * C((V"space"^0 * V"nospace"^1)^0), - space = S(" \t\v\n"), - escaped = P"\\" * V"space", - nospace = V"escaped" + (1 - V"space"), - } - function stringstrip(str) - return lpegmatch(stripper, str) or "" - end -end - -local enumeration_types = { - ["*"] = "*", -- unordered bulleted - ["+"] = "*", - ["-"] = "*", - ["•"] = "*", - ["‣"] = "*", - ["⁃"] = "*", - - ["#"] = "n", -- numbered lists and conversion - ["A"] = "A", - ["a"] = "a", - ["I"] = "R", - ["i"] = "r", -} - --- \setupitemize[left=(, right=), margin=4em, stopper=] - -local stripme = S"()." -local dontstrip = 1 - stripme -local itemstripper = stripme^0 * C(dontstrip^1) * stripme^0 - -local function parse_itemstring(str) - local offset = nil - local setup = ",fit][itemalign=flushright," - if stringmatch(str, "^%(") then - setup = setup .. [[left=(,]] - end - if stringmatch(str, "%)$") then - setup = setup .. [[right=)]] - end - if stringmatch(str, "%.$") then - setup = setup .. [[stopper={.\\space}]] - end - local num = stringmatch(str, "^%d") - if num then - -- http://thread.gmane.org/gmane.comp.tex.context/61728/focus=61729 - setup = setup .. ",start=" .. num - str = "n" - end - - str = lpegmatch(itemstripper, str) - str = enumeration_types[str] or str - return { setup = setup, str = str } -end - -function rst_context.startitemize(str) - local setup = "" - local result = "" - str = stringstrip(str) - - local listtype = enumeration_types[str] or parse_itemstring(str) - - if type(listtype) == "table" then - setup = listtype.setup - listtype = listtype.str - end - - result = [[ -\\startitemize[]] .. listtype .. setup .. [[] -]] - return result -end - -local item_stack = { } - -function rst_context.stopitemize(str) - item_stack[#item_stack] = nil - return str .. [[ -\\stopitemize -]] -end - -function rst_context.bullet_item (tab) - -- The capture of the first item has the \startitemize as - -- *second* element in the array. - local content = #tab == 2 and tab[2] or tab[3] - local startstr = #tab == 3 and tab[2] or nil - local itemtype = tab[1] - local result = startstr or "" - if startstr then - item_stack[#item_stack + 1] = itemtype - elseif next (item_stack) then - local current_item = item_stack [#item_stack] - if helpers.list.successor(itemtype, current_item) then - -- just leave it alone - elseif helpers.list.greater(itemtype, current_item) then - local itemnum = tonumber(stringstrip(itemtype)) or helpers.list.get_decimal(itemtype) - result = result .. stringformat([[ -\\setnumber[itemgroup:itemize]{%s} -]], itemnum) - end - item_stack[#item_stack] = itemtype - end - - return result .. [[ - -\\item ]] .. lpegmatch(inline_parser, content) .. [[ - -]] -end - --------------------------------------------------------------------------------- --- Definition lists --------------------------------------------------------------------------------- --- TODO define proper setups (probably bnf-like and some narrower for def-paragraphs) - -function rst_context.deflist (list) - rst_context.addsetups("deflist") - - local deflist = [[ -\\startRSTdefinitionlist -]] - for nd=1, #list do - local item = list[nd] - local term = item[1] - local nc = 2 - local tmp = [[ - - \\RSTdeflistterm{]] .. stringstrip(term) .. "}" - if #item > 2 then - while nc < #item do - tmp = tmp .. [[ - - \\RSTdeflistclassifier{]] .. stringstrip(item[nc]) .. "}" - nc = nc + 1 - end - end - tmp = tmp .. [[ - - \\RSTdeflistdefinition{% -]] - local final = item[#item] - for np=1, #final do - local par = final[np] - tmp = tmp .. [[ - \\RSTdeflistparagraph{% -]] .. lpegmatch(inline_parser, par) .. "}\n" - end - tmp = tmp .. " }" - deflist = deflist .. tmp - end - return deflist .. [[ - -\\stopRSTdefinitionlist -]] -end - --------------------------------------------------------------------------------- --- Field lists --------------------------------------------------------------------------------- - --- TODO Do something useful with field lists. For now I'm not sure what as the --- bibliography directives from the reST specification seem to make sense only --- when using docinfo and, after all, we have .bib files that are portable. - -function rst_context.field_list (str) - rst_context.addsetups("fieldlist") - return [[ - -\\startRSTfieldlist]] .. str .. [[\\eTABLEbody\\stopRSTfieldlist -]] -end - -function rst_context.field_name (str) - return [[\\fieldname{]] .. str .. [[}]] -end - -function rst_context.field_body (str) - return [[\\fieldbody{]] .. lpegmatch(inline_parser, str) .. [[}]] -end - -function rst_context.field (tab) - local name, body = tab[1], tab[2] - return stringformat([[ - - \\RSTfieldname{%s} - \\RSTfieldbody{%s} -]], name, lpegmatch(inline_parser, body)) -end - -function rst_context.line_comment (str) - return "% " .. str -end - -function rst_context.block_comment (str) - return stringformat([[ - -\iffalse %% start block comment -%s\fi %% stop block comment -]], str) -end - -function rst_context.option_list (str) - return [[ -\\setupTABLE[c][first] [background=color, backgroundcolor=grey, style=\tt] -\\setupTABLE[c][each] [frame=off] -\\setupTABLE[r][each] [frame=off] -\\bTABLE[split=yes,option=stretch] -\\bTABLEhead -\\bTR - \\bTH Option \\eTH - \\bTH Description \\eTH -\\eTR -\\eTABLEhead -\\bTABLEbody -]] .. lpegmatch(inline_parser, str) .. [[ - -\\eTABLEbody -\\eTABLE -]] -end - -function rst_context.option_item (tab) - return stringformat([[\\bTR\\bTC %s \\eTC\\bTC %s \\eTC\\eTR -]], tab[1], tab[2]) -end - -function rst_context.test(str) - return ":" -end - -function rst_context.literal_block (str, included) - local indent = P" "^1 - local stripme = #str - for line in stringgmatch(str, "[^\n]+") do - -- setting to the lowest indend of all lines - local idt = lpegmatch(indent, line) - if line and idt then - stripme = idt < stripme and idt or stripme - end - end - - local strip = P{ - [1] = "strip", - strip = Cs(V"line"^1), - eol = P"\n", - restofline = (1 - V"eol")^0, - stop = Cs(V"eol" * P" "^0) * -P(1) / "", -- remove trailing blank lines - line = Cs(V"restofline" * (V"stop" + V"eol")) / function (line) - return #line > stripme and line:sub(stripme) or line - end, - } - - str = lpegmatch(strip, str) - str = [[ - -\starttyping[lines=hyphenated] -]] .. str .. [[ - -\stoptyping -]] - if included then -- escaping can ruin your day - str = str:gsub("\\", "\\\\") - end - return str -end - -function rst_context.included_literal_block (str) - return rst_context.literal_block(str, true) -end - -function rst_context.line_block (str) - rst_context.addsetups("lines") - return [[ - -\\startlines -]] .. lpegmatch(inline_parser, str) .. [[\\stoplines -]] -end - -function rst_context.line_block_line(str) - str = str:gsub("\n", " ") - return str .. "\n" -end - -function rst_context.line_block_empty() - return "\n" -end - -function rst_context.block_quote (tab) - rst_context.addsetups("blockquote") - local str = [[ -\\startlinecorrection -\\blank[small] -\\startblockquote -]] .. lpegmatch(inline_parser, tab[1]) .. [[ - -\\stopblockquote -]] - - return tab[2] and str .. [[ -\\blank[small] -\\startattribution -]] .. lpegmatch(inline_parser, tab[2]) .. [[ -\\stopattribution -\\blank[small] -\\stoplinecorrection -]] or str .. [[ -\\blank[small] -\\stoplinecorrection -]] -end - ---function rst_context.table (str) - --return [[ ---\\startlinecorrection ---]] .. str .. [[ - ---\\stoplinecorrection ---]] ---end - -function rst_context.grid_table (tab) - local body = "" - local nr = 1 - local head - if tab.has_head then - head = [[ -\\setupTABLE[c][each] [frame=off] -\\setupTABLE[r][each] [frame=off] -%\\startlinecorrection -\\bTABLE[split=repeat,option=stretch] -\\bTABLEhead -]] - while nr <= tab.head_end do - local r = tab.rows[nr] - local isempty = true - for n=1, #r do - local cell = r[n] - if cell.variant == "normal" then - isempty = false - break - end - end - - if not isempty then - local row = [[\\bTR]] - for n=1, #r do - local c = r[n] - if not (c.parent or - c.variant == "separator") then - local celltext = lpegmatch(inline_parser, c.stripped) - if c.span.x or c.span.y then - local span_exp = "[" - if c.span.x then - span_exp = span_exp .. "nc=" .. c.span.x .. "," - end - if c.span.y then - span_exp = span_exp .. "nr=" .. c.span.y - end - celltext = span_exp .. "] " .. celltext - - end - - row = row .. "\n " .. [[\\bTH ]] .. celltext .. [[\\eTH]] - end - end - head = head .. row .. "\n" .. [[\\eTR]] .. "\n" - end - nr = nr + 1 - end - head = head .. [[ -\\eTABLEhead -\\bTABLEbody -]] - else - head = [[ -\\setupTABLE[c][each] [frame=off] -\\setupTABLE[r][each] [frame=off] -%\\startlinecorrection -\\bTABLE[split=repeat,option=stretch] -\\bTABLEbody -]] - end - while nr <= #tab.rows do - local r = tab.rows[nr] - local isempty = true - for n=1, #r do - local cell = r[n] - if cell.variant == "normal" then - isempty = false - break - end - end - - if not isempty then - local row = [[\\bTR]] - for n=1, #r do - local c = r[n] - if not (c.parent or - c.variant == "separator") then - local celltext = lpegmatch(inline_parser, c.stripped) - if c.span.x or c.span.y then - local span_exp = "[" - if c.span.x then - span_exp = span_exp .. "nc=" .. c.span.x .. "," - end - if c.span.y then - span_exp = span_exp .. "nr=" .. c.span.y - end - celltext = span_exp .. "] " .. celltext - - end - - row = row .. "\n " .. [[\\bTC ]] .. celltext .. [[\\eTC]] - end - end - body = body .. row .. "\n" .. [[\\eTR]] .. "\n" - end - nr = nr + 1 - end - local tail = [[ -\\eTABLEbody -\\eTABLE -%\\stoplinecorrection -]] - return head .. body .. tail -end - - -function rst_context.simple_table(tab) - local head - local nr = 1 - if tab.head_end then - head = [[ -\\setupTABLE[c][each] [frame=off] -\\setupTABLE[r][each] [frame=off] -%\\startlinecorrection -\\bTABLE[split=yes,option=stretch] -\\bTABLEhead -]] - while nr <= tab.head_end do - local row = tab[nr] - if not row.ignore then - dbg_write(">hr>" .. #row) - head = head .. [[\\bTR]] - for nc=1, #row do - local cell = row[nc] - dbg_write("%7s | ", cell.content) - local celltext = lpegmatch(inline_parser, cell.content) - if cell.span then - head = head .. stringformat([=[\\bTH[nc=%s]%s\\eTH]=], cell.span.x, celltext or "") - else - head = head .. [[\\bTH ]] .. celltext .. [[\\eTH]] - end - end - dbg_write("\n") - head = head .. "\\\\eTR\n" - end - nr = nr + 1 - end - - head = head .. [[ -\\eTABLEhead -\\bTABLEbody -]] - else - head = [[ -\\setupTABLE[c][each] [frame=off] -\\setupTABLE[r][each] [frame=off] -%\\startlinecorrection -\\bTABLE[split=yes,option=stretch] -\\bTABLEbody -]] - end - local tail = [[ -\\eTABLEbody -\\eTABLE -%\\stoplinecorrection -]] - local body = "" - while nr <= #tab do - local row = tab[nr] - if not row.ignore then - dbg_write(">tr>" .. #row) - body = body .. [[\\bTR]] - for nc=1, #row do - local cell = row[nc] - dbg_write("%7s | ", cell.content) - local celltext = lpegmatch(inline_parser, cell.content) - if cell.span then - body = body .. stringformat([=[\\bTC[nc=%s]%s\\eTC]=], cell.span.x, celltext or "") - else - body = body .. [[\\bTC ]] .. celltext .. [[\\eTC]] - end - end - dbg_write("\n") - body = body .. "\\\\eTR\n" - end - nr = nr + 1 - end - return head .. body .. tail -end - -function rst_context.footnote (label, content) - local tf = rst_context.state.footnotes - rst_context.addsetups("footnotes") - if stringmatch(label, "^%d+$") then -- all digits - tf.numbered[tonumber(label)] = - rst_context.escape(lpegmatch(inline_parser, content)) - elseif label == "#" then --autonumber - repeat -- until next unrequested number - tf.autonumber = tf.autonumber + 1 - until tf.numbered[tf.autonumber] == nil - tf.numbered[tf.autonumber] = - rst_context.escape(lpegmatch(inline_parser, content)) - elseif stringmatch(label, "^#.+$") then - local thelabel = stringmatch(label, "^#(.+)$") - tf.autolabel[thelabel] = - rst_context.escape(lpegmatch(inline_parser, content)) - elseif label == "*" then - rst_context.addsetups("footnote_symbol") - tf.symbol[#tf.symbol+1] = - rst_context.escape(lpegmatch(inline_parser, content)) - else -- “citation reference” treated like ordinary footnote - repeat -- until next unrequested number - tf.autonumber = tf.autonumber + 1 - until tf.numbered[tf.autonumber] == nil - tf.numbered[tf.autonumber] = - rst_context.escape(lpegmatch(inline_parser, content)) - end - return "" -end - ---- hack to differentiate inline images -local special_substitutions = { - image = "inline_image", -} - -function rst_context.substitution_definition (subtext, directive, data) - local special = special_substitutions[directive] - if special then - --- override; pass data directly - directive = special - else - local tmp - if data.first ~= "" then - tmp = { data.first } - else - tmp = { } - end - data.first = nil - for i=1, #data do -- paragraphs - local current = tableconcat(data[i], "\n") - --current = lpegmatch(inline_parser, current) - --current = rst_context.escape(current) - tmp[#tmp+1] = current - end - data = tableconcat(tmp, "\n\n") - data = stringstrip(data) - end - subtext = stringgsub(subtext, "%s", "") - rst_context.substitutions[subtext] = { directive = directive, - data = data } - return "" -end - --- not to be confused with the directive definition table rst_directives -function rst_context.directive(directive, data) - local fun = rst_directives[directive] - if fun then - rst_context.addsetups("directive") - local result = "" - result = fun(data) - return result - end - return "" -end - --- vim:ft=lua:sw=4:ts=4:expandtab diff --git a/Master/texmf-dist/tex/context/third/rst/rst_directives.lua b/Master/texmf-dist/tex/context/third/rst/rst_directives.lua deleted file mode 100644 index f5572b7be72..00000000000 --- a/Master/texmf-dist/tex/context/third/rst/rst_directives.lua +++ /dev/null @@ -1,381 +0,0 @@ -#!/usr/bin/env texlua --------------------------------------------------------------------------------- --- FILE: rst_directives.lua --- USAGE: called by rst_parser.lua --- DESCRIPTION: Complement to the reStructuredText parser --- AUTHOR: Philipp Gesang (Phg), <phg42.2a@gmail.com> --- CHANGED: 2013-06-03 18:52:35+0200 --------------------------------------------------------------------------------- --- - -local helpers = helpers or thirddata and thirddata.rst_helpers - --------------------------------------------------------------------------------- --- Directives for use with |substitutions| --------------------------------------------------------------------------------- - -local rst_directives = { } -thirddata.rst_directives = rst_directives -local rst_context = thirddata.rst - -local lpegmatch = lpeg.match -local stringformat = string.format -local stringstrip = string.strip -local tableconcat = table.concat -local tableflattened = table.flattened -local type = type - ---rst_directives.anonymous = 0 -rst_directives.images = {} -rst_directives.images.done = {} -rst_directives.images.values = {} - - -rst_directives.images.keys = { - ["width"] = "width", - ["size"] = "width", - ["caption"] = "caption", - ["alt"] = "caption", - ["scale"] = "scale", -} - -rst_directives.images.values.scale = function (orig) - -- http://wiki.contextgarden.net/Reference/en/useexternalfigure - -- scale=1000 is original size; to get 72%, use scale=720. - return tonumber(orig) * 1000 -end - -rst_directives.images.values.width = { - ["fit"] = "\\hsize", - ["hsize"] = "\\hsize", - ["broad"] = "\\hsize", - ["normal"] = "local", - ["normal"] = "local", -} - --- we won't allow passing arbitrary setups to context -local permitted_setups = { - "width", - "scale" -} - -local function img_setup (properties) - local result = "" - for _, prop in next, permitted_setups do - if properties[prop] then - result = result .. prop .. "=" .. properties[prop] .. "," - end - end - if result ~= "" then - result = "[" .. result .. "]" - end - return result -end - -local collect_image_properties = function (data) - local image_directives = rst_directives.images - local p_keyval = helpers.patterns.colon_keyval - local properties = { } - - data = tableflattened(data) - for i=1, #data do - local str = stringstrip(data[i]) - local key, val = lpegmatch(p_keyval, str) - if key and val then - key = image_directives.keys[key] -- sanitize key expression - local valtype = type(image_directives.values[key]) - if valtype == "table" then - val = image_directives.values[key][val] - elseif valtype == "function" then - val = image_directives.values[key](val) - end - properties[key] = val - end - end - return properties -end - ---- ordinary image directives are converted to floats - -local float_image = function (data) - rst_context.addsetups "image" - local inline_parser = rst_context.inline_parser - local properties - local anon = false - local rdi = rst_directives.images - local hp = helpers.patterns - local caption = "" - local name = "" - - if data.name then - name = stringstrip(data.name) - data.name = nil - else - if next(data[1]) then - name = data[1][1] - end - end - - --rd.anonymous = rd.anonymous + 1 - --anon = true -- indicates a nameless picture - --name = "anonymous" .. rd.anonymous - - properties = collect_image_properties(data) - - if properties.caption then - caption = lpegmatch(inline_parser, properties.caption) - caption = rst_context.escape(caption) - end - - properties.setup = img_setup(properties) or "" - local img = "" --- local images_done = rdi.done --- if not anon then -- TODO: implement? --- if not images_done[name] then --- img = img .. stringformat([[ --- ---\useexternalfigure[%s][%s][]%% ---]], name, data) --- images_done[name] = true --- end --- img = img .. stringformat([[ ---\def\RSTsubstitution%s{%% --- \placefigure[here]{%s}{\externalfigure[%s]%s}%% ---} ---]], name, rst_context.escape(lpegmatch(inline_parser, properties.caption)), name, properties.setup) --- else -- image won't be referenced but used instantly - img = stringformat( - "\n\\placefigure[here]{%s}{\\externalfigure[%s]%s}", - caption, - name, - properties.setup) --- end - return img -end - ---- inline substitutions are converted to bare external figures -local inline_image = function (name, data) - rst_context.addsetups "image" - local filename = data.first - local p_keyval = helpers.patterns.colon_keyval - local properties - - if not filename then --- garbage, ignore - return "" - end - data.first = nil - filename = stringstrip(filename) - properties = collect_image_properties(data) - - local scheme = "\n\\def\\RSTsubstitution%s{\n \\externalfigure[%s]%s%%\n}\n" - local options = "" - if next(properties) then - local tmp = { } - tmp[#tmp+1] = "[" - for key, value in next, properties do - tmp[#tmp+1] = key - tmp[#tmp+1] = "={" - tmp[#tmp+1] = rst_context.escape(value) - tmp[#tmp+1] = "}," - end - tmp[#tmp+1] = "]" - options = tableconcat(tmp) - end - return stringformat(scheme, name, filename, options) -end - -rst_directives.image = float_image -rst_directives.inline_image = inline_image - -rst_directives.caution = function(data) - local inline_parser = rst_context.inline_parser - rst_context.addsetups("dbend") - rst_context.addsetups("caution") - local text = { } - for i=1, #data do -- paragraphs - local current = tableconcat(data[i], "\n") - current = lpegmatch(inline_parser, current) - current = rst_context.escape(current) - text[i] = current - end - return stringformat([[ -\startRSTcaution -%s -\stopRSTcaution -]], tableconcat(text, "\n\n")) -end - -rst_directives.danger = function(data) - local inline_parser = rst_context.inline_parser - rst_context.addsetups("dbend") - rst_context.addsetups("danger") - local text = { } - for i=1, #data do -- paragraphs - local current = tableconcat(data[i], "\n") - current = lpegmatch(inline_parser, current) - current = rst_context.escape(current) - text[i] = current - end - return stringformat([[ -\startRSTdanger -%s -\stopRSTdanger -]], tableconcat(text, "\n\n")) -end - --- http://docutils.sourceforge.net/docs/ref/rst/directives.html -rst_directives.DANGER = function(data) - local inline_parser = rst_context.inline_parser - local text = { } - for i=1, #data do -- paragraphs - local current = tableconcat(data[i], "\n") - current = lpegmatch(inline_parser, current) - current = rst_context.escape(current) - text[i] = current - end - return stringformat([[ - -%% The Rabbit of Caerbannog -\startlinecorrection -\blank[force,big] -\framed[frame=on, - corner=round, - rulethickness=5pt, - align=middle, - width=\hsize, - frameoffset=.5em, - backgroundoffset=1em, - background=color, - backgroundcolor=red, - foreground=color, - foregroundcolor=black]{%% - \language[en-gb]\tfb\bf - Follow only if ye be men of valour, for the entrance to this cave is guarded - by a creature so foul, so cruel that no man yet has fought with it and lived. - Bones of full fifty men lie strewn about its lair. So, brave knights, if you - do doubt your courage or your strength, come no further, for death awaits you - all with nasty, big, pointy teeth.%% - \blank[force,big] - %s%% -} -\blank[force,big] -\stoplinecorrection -]], tableconcat(text, "\n\n")) -end - -rst_directives.mp = function(name, data) - local mpcode = stringformat([[ -\startreusableMPgraphic{%s} -%s -\stopreusableMPgraphic -]], name, data) - mpcode = mpcode .. stringformat([[ -\def\RSTsubstitution%s{%% - \reuseMPgraphic{%s}%% -} -]], name, name) - return mpcode -end - ---- There’s an issue with buffers leaving trailing spaces due to their ---- implementation. ---- http://archive.contextgarden.net/message/20111108.175913.1d994624.en.html -rst_directives.ctx = function(name, data) - local ctx = stringformat([[ - -\startbuffer[%s] -%s\stopbuffer -\def\RSTsubstitution%s{%% - \getbuffer[%s]\removeunwantedspaces%% -} -]], name, data, name, name) - return ctx -end - -rst_directives.lua = function(name, data) - local luacode = stringformat([[ - -\startbuffer[%s] -\startluacode -%s -\stopluacode -\stopbuffer -\def\RSTsubstitution%s{%% - \getbuffer[%s]\removeunwantedspaces%% -} -]], name, data, name, name) - return luacode -end - --------------------------------------------------------------------------------- ---- Experimental math directive --------------------------------------------------------------------------------- - -rst_directives.math = function (name, data) - data = data or name - local formula - if type(data) == "table" then - local last, i = #data, 1 - while i <= last do - local line = stringstrip(data[i]) - if line and line ~= "" then - formula = formula and formula .. " " .. line or line - end - i = i + 1 - end - end - return stringformat([[ -\startformula -%s -\stopformula -]], formula) -end - --------------------------------------------------------------------------------- ---- End math directive --------------------------------------------------------------------------------- - -rst_directives.replace = function(name, data) - return stringformat([[ - -\def\RSTsubstitution%s{%s} -]], name, data) -end - --------------------------------------------------------------------------------- ---- Containers. --------------------------------------------------------------------------------- - ---- *data*: ---- { [1] -> directive name, ---- [>1] -> paragraphs } - -rst_directives.container = function(data) - local inline_parser = rst_context.inline_parser - local tmp = { } - for i=1, #data do -- paragraphs - local current = tableconcat(data[i], "\n") - current = lpegmatch(inline_parser, current) - current = rst_context.escape(current) - tmp[i] = current - end - local content = tableconcat(tmp, "\n\n") - local name = data.name - if name and name ~= "" then - name = stringstrip(data.name) - return stringformat([[ -\start[%s]%% -%s%% -\stop -]], name, content) - else - return stringformat([[ -\begingroup%% -%s%% -\endgroup -]], content) - end -end - --- vim:ft=lua:sw=4:ts=4:expandtab - diff --git a/Master/texmf-dist/tex/context/third/rst/rst_helpers.lua b/Master/texmf-dist/tex/context/third/rst/rst_helpers.lua deleted file mode 100644 index ba6abfb1232..00000000000 --- a/Master/texmf-dist/tex/context/third/rst/rst_helpers.lua +++ /dev/null @@ -1,657 +0,0 @@ -#!/usr/bin/env texlua --------------------------------------------------------------------------------- --- FILE: rst_helpers.lua --- USAGE: called by rst_parser.lua --- DESCRIPTION: Complement to the reStructuredText parser --- AUTHOR: Philipp Gesang (Phg), <phg42.2a@gmail.com> --- CHANGED: 2014-03-02 19:20:28+0100 --------------------------------------------------------------------------------- --- - -local P, R, S, V, lpegmatch - = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.match - -local C, Carg, Cb, Cc, Cg, - Cmt, Cp, Cs, Ct - = lpeg.C, lpeg.Carg, lpeg.Cb, lpeg.Cc, lpeg.Cg, - lpeg.Cmt, lpeg.Cp, lpeg.Cs, lpeg.Ct - -local helpers -helpers = thirddata.rst_helpers -helpers.table = {} -helpers.cell = {} - -local utf = unicode.utf8 -local utflen = utf.len - -local stringstrip = string.strip -local stringformat = string.format - -function helpers.dbg_writef(...) - if helpers.rst_debug then - io.write(stringformat(...)) - end -end - -local dbg_write = helpers.dbg_writef - -helpers.patterns = {} - -do - local p = helpers.patterns - p.dash = P"-" - p.equals = P"=" - p.plus = P"+" - p.bar = P"|" - p.eol = P"\n" - p.last = -P(1) - p.space = P" " - - p.dash_or_equals = p.dash + p.equals - - p.celldelim = p.bar + p.plus - p.cellcontent = (1 - p.celldelim) - p.cell = p.celldelim * C((1 - p.celldelim)^1) * #p.celldelim - p.cell_line = p.plus * p.dash^1 * #p.plus - p.dashesonly = p.dash^1 * p.last - p.spacesonly = p.space^1 * p.last - - p.col_start = Cp() * p.dash_or_equals^1 - p.col_stop = p.dash_or_equals^1 * Cp() - p.column_starts = Ct(p.col_start * ( p.space^1 * p.col_start)^1) - p.column_stops = Ct(p.col_stop * ( p.space^1 * p.col_stop)^1) - - p.st_headsep = p.equals^1 * (p.space^1 * p.equals^1)^1 - p.st_colspan = p.dash^1 * (p.space^1 * p.dash^1)^0 * p.space^0 * p.last - p.st_span_starts = Ct(Cp() * p.dash^1 * (p.space^1 * Cp() * p.dash^1)^0) - p.st_span_stops = Ct(p.dash^1 * Cp() * (p.space^1 * p.dash^1 * Cp())^0) - - - p.cells = P{ - [1] = "cells", - cells = p.celldelim - * (C(V"in_cell") - * (V"matchwidth" * C(V"in_cell"))^1), - - in_cell = p.cellcontent^1 - + (p.dash - p.cellcontent)^1, - - matchwidth = Cmt(C(p.celldelim) * Carg(1), function(s,i,del, layout) - local pos = 1 - local lw = layout.widths - for n=1, #lw do - pos = pos + lw[n] + 1 - if (i - 1) == pos then return true end - end - return false - end), - } - - p.sep_line = p.plus * (p.dash^1 * p.plus)^1 * p.last - p.sep_head = p.plus * (p.equals^1 * p.plus)^1 * p.last - - p.sep_part = ((1 - p.cell_line)^0 * p.cell_line) - p.sep_line - - p.new_row = p.sep_line + p.sep_head + p.sep_part - - p.whitespace = S" \t\v\r\n"^1 - p.strip = p.whitespace^0 * C((1 - (p.whitespace * p.last))^1) * p.whitespace^0 * p.last - - - local colon = P":" - local escaped_colon = P"\\:" - local nocolon = (escaped_colon + (1 - colon))^1 - p.colon_right = nocolon * colon - p.colon_keyval = colon^-1 * C(nocolon) * colon * p.space^1 * C((1 - (p.space^0 * P(-1)))^1) - - -- color expression matching for text roles - local digit = R"09" - local dot = P"." - local colvalue = digit * dot * digit^1 - + digit - + dot * digit^1 - local coldelim = P"_" + P"-" - p.rgbvalues = P"rgb_" - * Ct( C(colvalue) * coldelim * C(colvalue) * coldelim * C(colvalue) ) -end - -function helpers.cell.create(raw, n_row, n_col, parent, variant) - local p = helpers.patterns - local cell = {} - cell.stripped = raw and p.strip:match(raw) or "" - cell.content = raw - cell.width = raw and utflen(raw) or 0 - cell.bytes = raw and #raw or 0 - cell.variant = "normal" -- [normal|separator|y_continue|x_continue] - cell.pos = {} - cell.pos.x = n_col - cell.pos.y = n_row - cell.span = {} - cell.span.x = 1 - cell.span.y = 1 - cell.parent = parent - return cell -end - -function helpers.cell.get_x_span(content, layout, init) - local acc = 0 - local lw = layout.widths - for n=init, #lw do - acc = acc + lw[n] + 1 - if utflen(content) + 1 == acc then - return n - init - end - end - return false -end - - --- Extending a cell by 1 cell horizontally. -function helpers.cell.add_x (cell) - cell.span.x = cell.span.x + 1 -end - - -local function set_layout (line) - local p = helpers.patterns - local layout = {} - local slice = Ct((p.plus * C(p.dash^1) * #p.plus)^1) - - layout.widths = {} - layout.slices = {} - local elms = lpegmatch(slice, line) - for n=1, #elms do - local elm = elms[n] - layout.widths[n] = #elm - layout.slices[n] = elm - end - return layout -end - -function helpers.table.create(raw) - local newtab = {} - newtab.rows = {} - newtab.layout = set_layout(raw[1]) - - local p = helpers.patterns - - newtab.resolve_parent = function(row, col, array) - local array = array or newtab.rows - local cell = array[row][col] - local par_row, par_col = row, col - if cell.parent then - par_row, par_col = newtab.resolve_parent(cell.parent.y, cell.parent.x) - end - return par_row, par_col - end - - newtab.__init = function() - local hc = helpers.cell - local rowcount = 0 - local newtablayout = newtab.layout - for nr=1, #raw do - local row = raw[nr] - newtab.rows[nr] = {} - local this_row = newtab.rows[nr] - this_row.sepline = p.sep_line:match(row) - this_row.sephead = p.sep_head:match(row) - this_row.seppart = p.sep_part:match(row) - if this_row.sephead then - newtab.has_head = true - newtab.head_end = nr - end - - local splitted = { p.cells:match(row, 1, newtablayout) } - local pos_layout, pos_row = 1, 1 - local make_empty = {} - make_empty.n, make_empty.parent = 0, nil - - while pos_layout <= #newtablayout.widths do - local splitpos = splitted[pos_layout] - local layoutwidth = newtablayout.widths[pos_layout] - local span = 1 - local this - - if make_empty.n > 0 then - make_empty.n = make_empty.n - 1 - this = hc.create("", nr, pos_layout, make_empty.parent) - this.parent = make_empty.parent - p_row, p_col = newtab.resolve_parent(this.parent.y, this.parent.x) - local thisparent = newtab.rows[p_row][p_col] - if this_row.sepline or this_row.sephead or - newtab.rows[p_row][p_col].variant == "separator" then - this.variant = "separator" - else - this.variant = "empty1" - end - else - local cellwidth = utflen(splitpos) - if cellwidth > layoutwidth then - span = span + hc.get_x_span(splitpos, newtablayout, pos_layout) - end - pos_row = pos_row + span - this = hc.create(splitpos, nr, pos_layout, nil) - if p.dashesonly:match(splitpos) or - this_row.sepline or this_row.sephead then - this.variant = "separator" - end - this.span.x = span - make_empty.n = span - 1 - make_empty.parent = span > 1 and { y = nr, x = pos_layout } or nil - end - - this_row[pos_layout] = this - pos_layout = pos_layout + 1 - end -- while - end -- for loop over rows - - local oldrows = newtab.rows - local newrows = oldrows - for nc=1, #newtablayout.widths do - local width = newtablayout.widths[nc] - -- this is gonna be extremely slow but at least it's readable - local newrow - local currentrow = 1 - for nr=1, #newrows do - local row = newrows[nr] - local cell = row[nc] - dbg_write("nc: %s, nr:%2s | %9s | ", nc, nr,cell.variant) - if row.sepline or row.sephead - or p.dashesonly:match(cell.content) - or cell.variant == "separator" then -- separator; skipping and beginning new row - newrows[nr][nc] = cell - currentrow = currentrow + 1 - newrow = true - dbg_write("new >%24s< ", cell.stripped) - if cell.parent then dbg_write("parent |") else dbg_write("no par |") end - else - dbg_write("old >%24s< ", cell.stripped) - if cell.parent then dbg_write("parent |") else dbg_write("no par |") end - if newrow then - newrows[nr][nc] = cell - currentrow = currentrow + 1 - else -- continuing parent - - local par_row, par_col - local parent - if cell.parent then - par_row, par_col = newtab.resolve_parent(cell.parent.y, cell.parent.x, newrows) - dbg_write(" use %s,%2s | ", par_col, par_row) - else -- Using vertical predecessor. - par_row, par_col = newtab.resolve_parent(nr-1,nc, newrows) - dbg_write(" new %s,%2s | ", par_col, par_row) - end - parent = newrows[par_row][par_col] - - if newrows[nr].seppart then - dbg_write("span++") - parent.span.y = parent.span.y + 1 - end - - parent.content = parent.content .. cell.content - parent.stripped = parent.stripped .. " " .. cell.stripped - cell.variant = "empty2" - cell.parent = { x = par_col, y = par_row } - end - newrow = false - end - dbg_write("\n") - newrows[nr][nc] = cell - end -- for loop over rows - end -- for loop over columns - --newtab.rows = oldrows - newtab.rows = newrows - end - - newtab.__init() - ---[[ - newtab.__draw_debug = function() - for nr=1, #newtab.rows do - local row = newtab.rows[nr] - for nc=1, #row do - local cell = row[nc] - local field = cell.variant:sub(1,7) - if cell.parent then - field = field .. string.format(" %s,%2s",cell.parent.x, cell.parent.y) - end - dbg_write("%12s | ", field) - end - dbg_write("\n") - end - end ---]] - - return newtab -end - - - -function helpers.table.resolve_parent (row, col, array) - local cell = array[row][col] - local par_row, par_col = row, col - if cell.parent then - par_row, par_col = self.resolve_parent(cell.parent.y, cell.parent.x) - end - return par_row, par_col -end - - --- Check the column boundaries of a simple table. -function helpers.get_st_boundaries (str) - local p_column_starts = helpers.patterns.column_starts - local p_column_stops = helpers.patterns.column_stops - local starts, stops, slices, elms = { }, { }, { }, nil - - elms = lpegmatch(p_column_starts, str) - for n=1, #elms do - local elm = elms[n] - slices[n] = { start = elm } - starts[elm] = true - end - - elms = lpegmatch(p_column_stops, str) - for n=1, #elms do - local elm = elms[n] - slices[n]["stop"] = elm - stops[elm] = true - end - return { starts = starts, stops = stops, slices = slices } -end - -function helpers.table.simple(raw) - local rows = {} - local multispans = {} - local bounds = helpers.get_st_boundaries(raw[1]) - local p = helpers.patterns - - for nr=1, #raw do - local row = raw[nr] - local newrow = {} - if not p.st_headsep:match(row) and - not p.st_colspan:match(row) then - local starts, stops = {}, {} - local check_span = false - if p.st_colspan:match(raw[nr+1]) then -- expect spans over several columns - starts = p.st_span_starts:match(raw[nr+1]) - stops = p.st_span_stops :match(raw[nr+1]) - check_span = true - else - for ncol=1, #bounds.slices do - local slice = bounds.slices[ncol] - starts[ncol] = slice.start - stops [ncol] = slice.stop - end - end - - for nc=1, #starts do - local start = starts[nc] - -- last column can exceed layout width - local stop = nc ~= #starts and stops[nc] or #row - local cell = { - content = "", - span = { x = 1, y = 1 }, - } - cell.content = stringstrip(row:sub(start, stop)) - if check_span then - local start_at, stop_at - for ncol=1, #bounds.slices do - local slice = bounds.slices[ncol] - if slice.start == start then - start_at = ncol - end - if start_at and - not (ncol == #bounds.slices) then - if slice.stop == stop then - stop_at = ncol - break - end - else -- last column, width doesn't matter - stop_at = ncol - end - end - cell.span.x = 1 + stop_at - start_at - end - newrow[nc] = cell - end - elseif p.st_colspan:match(row) then - newrow.ignore = true - elseif not rows.head_end and - nr > 1 and #raw > nr then -- ends the header - rows.head_end = nr - newrow.head_sep = true - newrow.ignore = true - else - newrow.ignore = true - end - rows[nr] = newrow - end - - for nr=1, #rows do - local row = rows[nr] - if not row.ignore and row[1].content == "" then - row.ignore = true - for nc=1, #row do - local cell = row[nc] - local par_row, par_col = helpers.table.resolve_parent(nr - 1, nc, rows) - parent = rows[par_row][par_col] - parent.content = parent.content .. " " .. cell.content - cell.content = "" - end - - end - end - - return rows -end - -helpers.list = {} - -do - local c = {} - c.roman = S"ivxlcdm"^1 - c.Roman = S"IVXLCDM"^1 - c.alpha = R"az" - P"i" - P"v" - P"x" - P"l" - c.Alpha = R"AZ" - P"I" - P"V" - P"X" - P"L" - c.digit = R"09"^1 - c.auto = P"#" - - local stripme = S" ()." - local dontstrip = 1 - stripme - local itemstripper = stripme^0 * C(dontstrip^1) * stripme^0 - - local con = function (str) - str = itemstripper:match(str) - for conv, pat in next, c do - if pat:match(str) then - return conv - end - end - return false - end - helpers.list.conversion = con - - local rnums = { - i = 1, - v = 5, - x = 10, - l = 50, - c = 100, - d = 500, - m = 1000, - } - - local function roman_to_arab (str) - local n = 1 - local curr, succ - local max_three = { } - local value = 0 - while n <= #str do - if curr and curr == max_three[#max_three] then - if #max_three >= 3 then - return "Not a number" - else - max_three[#max_three+1] = curr - end - else - max_three = { curr } - end - - curr = rnums[str:sub(n,n)] or 1 - - n = n + 1 - succ = str:sub(n,n) - - if succ and succ ~= "" then - succ = rnums[succ] - if curr < succ then - --n = n + 1 - --value = value + succ - curr - value = value - curr - else - value = value + curr - end - else - value = value + curr - end - end - return value - end - helpers.list.roman_to_arab = roman_to_arab - - local suc = function (str, old) - str, old = itemstripper:match(str), itemstripper:match(old) - local n_str, n_old = tonumber(str), tonumber(old) - if n_str and n_old then -- arabic numeral - return n_str == n_old + 1 - end - - local con_str, con_old = con(str), con(old) - if con_str == "alpha" or - con_str == "Alpha" then - return str:byte() == old:byte() + 1 - else -- “I'm a Roman!” - “A woman?” - “No, *Roman*! - Au!” - “So your father was a woman?” - if not (str:lower() == str or - str:upper() == str) then -- uneven cased --> fail - return false - end - - local trc = thirddata.rst.state.roman_cache - n_str = trc[str] or nil - n_old = trc[old] or nil - if not n_str then - n_str = roman_to_arab(str:lower()) - trc[str] = n_str - end - if not n_old then - n_old = roman_to_arab(old:lower()) - trc[old] = n_old - end - return n_str == n_old + 1 - end - end - helpers.list.successor = suc - - local greater = function (str, old) - str, old = itemstripper:match(str), itemstripper:match(old) - local n_str, n_old = tonumber(str), tonumber(old) - if n_str and n_old then -- arabic numeral - return n_str > n_old - end - - local con_str, con_old = con(str), con(old) - if con_str == "alpha" or - con_str == "Alpha" then - return str:byte() > old:byte() - else - if not (str:lower() == str or - str:upper() == str) then -- uneven cased --> fail - return false - end - - - local trc = thirddata.rst.state.roman_cache - n_str = trc[str] or nil - n_old = trc[old] or nil - if not n_str then - n_str = roman_to_arab(str:lower()) - trc[str] = n_str - end - if not n_old then - n_old = roman_to_arab(old:lower()) - trc[old] = n_old - end - return n_str > n_old - end - end - helpers.list.greater = greater - - local gd = function(str) - str = itemstripper:match(str) - local value - local con_str = con(str) - if con_str == "alpha" or - con_str == "Alpha" then - return str:byte() - else - if not (str:lower() == str or - str:upper() == str) then - return false - end - - local trc = thirddata.rst.state.roman_cache - n_str = trc[str] or nil - if not n_str then - n_str = roman_to_arab(str:lower()) - trc[str] = n_str - end - return n_str - end - end - - helpers.list.get_decimal = gd -end - -helpers.string = {} - -do - --- This grammar inside the function is slightly faster than the - --- same as an upvalue with the value of “width” repeatedly given - --- via lpeg.Carg(). This holds for repeated calls as well. - local ulen = utflen - function helpers.string.wrapat (str, width) - local width = width or 65 - local linelength = 0 - local wrap = P{ - [1] = "wrapper", - - wrapper = Cs(V"nowhitespace"^0 * (Cs(V"wrapme") + V"other")^1), - whitespace = S" \t\v" + P"\n" / function() linelength = 0 end, - nowhitespace = 1 - V"whitespace", - typing = P[[\\type{]] * (1 - P"}")^0 * P"}", - typingenv = P[[\\starttyping]] * (1 - P[[\\stoptyping]])^0 * P[[\\stoptyping]], - ignore = V"typing" + V"typingenv", - --- the initial whitespace of the “other” pattern must not - --- be enforced (“^1”) as it will break the exceptions - --- (“ignore” pattern)! In general it is better to have the - --- wrapper ignore some valid breaks than to not have it - --- matching some valid strings at all. - other = Cmt(V"whitespace"^0 * (V"ignore" + (1 - V"whitespace")^1), function(s,i,w) - linelength = linelength + ulen(w) - return true - end), - wrapme = Cmt(V"whitespace"^1 * (1 - V"whitespace" - V"ignore")^1, function(s,i,w) - local lw = ulen(w) - if linelength + lw > width then - linelength = lw - return true - end - return false - end) / function (word) return "\n" .. word:match("[^%s]+") end, - } - - local reflowed = wrap:match(str) - return reflowed - end -end - diff --git a/Master/texmf-dist/tex/context/third/rst/rst_parser.lua b/Master/texmf-dist/tex/context/third/rst/rst_parser.lua deleted file mode 100644 index a3a59ae3653..00000000000 --- a/Master/texmf-dist/tex/context/third/rst/rst_parser.lua +++ /dev/null @@ -1,1635 +0,0 @@ -#!/usr/bin/env texlua --------------------------------------------------------------------------------- --- FILE: rst_parser.lua --- USAGE: refer to doc/documentation.rst --- DESCRIPTION: https://bitbucket.org/phg/context-rst/overview --- AUTHOR: Philipp Gesang (Phg), <phg42.2a@gmail.com> --- VERSION: 0.6c --- CHANGED: 2014-03-02 19:20:17+0100 --------------------------------------------------------------------------------- --- - -local usage_info = [[ -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - rstConTeXt -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Functionality has been moved, the reST converter can now be -accessed via mtxrun: - - $mtxrun --script rst - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -]] - -local main = function () - io.write("\n"..usage_info.."\n") - return -1 -end - -thirddata = thirddata or { } -thirddata.rst = { } -thirddata.rst_helpers = { rst_debug = false } - -if context then - if environment.argument "debug" == true then - thirddata.rst_helpers.rst_debug = true - end -elseif not scripts then - return main() -end - -environment.loadluafile"rst_helpers" -environment.loadluafile"rst_directives" -environment.loadluafile"rst_setups" -environment.loadluafile"rst_context" - -local rst = thirddata.rst -local helpers = thirddata.rst_helpers -local optional_setups = thirddata.rst_setups - -rst.strip_BOM = true -rst.expandtab = true -rst.shiftwidth = 4 -rst.crlf = true - -local utf = unicode.utf8 - -local ioopen = io.open -local iowrite = io.write -local select = select -local stringfind = string.find -local stringformat = string.format -local stringgsub = string.gsub -local stringlen = string.len -local stringmatch = string.match -local stringstrip = string.strip -local stringsub = string.sub -local tableconcat = table.concat -local utflen = utf.len - -local context = context - -local warn -do - local ndebug = 0 - warn = function(str, ...) - if not helpers.rst_debug then return false end - ndebug = ndebug + 1 - local slen = #str + 3 - --str = "*["..str.."]" - str = stringformat("*[%4d][%s]", ndebug, str) - for i=1, select ("#", ...) do - local current = select (i, ...) - if 80 - i * 8 - slen < 0 then - local indent = "" - for i=1, slen do - indent = indent .. " " - end - str = str .. "\n" .. indent - end - str = str .. stringformat(" |%6s", stringstrip(tostring(current))) - end - iowrite(str .. " |\n") - return 0 - end -end - -local C, Cb, Cc, Cg, - Cmt, Cp, Cs, Ct - = lpeg.C, lpeg.Cb, lpeg.Cc, lpeg.Cg, - lpeg.Cmt, lpeg.Cp, lpeg.Cs, lpeg.Ct - -local P, R, S, V, lpegmatch - = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.match - -local utf = unicode.utf8 - -local state = {} -thirddata.rst.state = state - -state.depth = 0 -state.bullets = {} -- mapping bullet forms to depth -state.bullets.max = 0 -state.lastbullet = "" -state.lastbullets = {} -state.roman_cache = {} -- storing roman numerals that were already converted -state.currentindent = "" -- used in definition lists and elsewhere -state.previousindent = "" -- for literal blocks included in paragraphs to restore the paragraph indent -state.currentwidth = 0 -- table layout -state.currentlayout = {} -- table layout -state.previousadorn = nil -- section underlining and overlining - -state.footnotes = {} -state.footnotes.autonumber = 0 -state.footnotes.numbered = {} -state.footnotes.labeled = {} -state.footnotes.autolabel = {} -state.footnotes.symbol = {} - -state.addme = {} - -local valid_adornment -do - --[[-- - - valid_adornment -- This subpattern tests if the string consists - entirely of one repeated adornment char. - - --]]-- - local first_adornment = "" - local adornment_char = S[[!"#$%&'()*+,-./:;<=>?@[]^_`{|}~]] + P[[\\]] - local check_first = Cmt(adornment_char, function(_,_, first) - first_adornment = first - return true - end) - local check_other = Cmt(adornment_char, function(_,_, char) - return char == first_adornment - end) - valid_adornment = check_first * check_other^1 * -P(1) -end - -local enclosed_mapping = { - ["'"] = "'", - ['"'] = '"', - ["("] = ")", - ["["] = "]", - ["{"] = "}", - ["<"] = ">", -} - -local utfchar = P{ -- from l-lpeg.lua, modified to use as grammar - [1] = "utfchar", - utf8byte = R("\128\191"), - utf8one = R("\000\127"), - utf8two = R("\194\223") * V"utf8byte", - utf8three = R("\224\239") * V"utf8byte" * V"utf8byte", - utf8four = R("\240\244") * V"utf8byte" * V"utf8byte" * V"utf8byte", - utfchar = V"utf8one" + V"utf8two" + V"utf8three" + V"utf8four", -} - - - -local rst_parser = P { - [1] = V"document", - - document = V"blank_line"^0 * Cs(V"block"^1), - --------------------------------------------------------------------------------- --- Blocks --------------------------------------------------------------------------------- - - block = V"explicit_markup" - + Cs(V"section") / rst.escape - + V"target_block" - + V"literal_block" - + Cs(V"list") / rst.escape - + Cs(V"line_block") / rst.escape - + Cs(V"table_block") / rst.escape - + V"transition" --/ rst.escape - + V"comment_block" - + Cs(V"block_quote") / rst.escape - + Cs(V"paragraph") / rst.escape - , - --------------------------------------------------------------------------------- --- Explicit markup block --------------------------------------------------------------------------------- - - explicit_markup_start = V"double_dot" * V"whitespace", - - explicit_markup = V"footnote_block" - + V"directive_block" - + V"substitution_definition" - , - - explicit_markup_block = V"explicit_markup"^1 - , - --------------------------------------------------------------------------------- --- Directives block --------------------------------------------------------------------------------- - - directive_block = V"directive" - --* (V"blank_line"^-1 * V"directive")^0 - * V"end_block" - , - - directive = V"explicit_markup_start" - * C(((V"escaped_colon" + (1 - V"colon" - V"eol")) - - V"substitution_text")^1) --> directive name - * V"double_colon" - * Ct(V"directive_block_multi" + V"directive_block_single") --> content - / rst.directive - , - - directive_block_multi = Cg((1 - V"eol")^0, "name") -- name - * V"eol" - * V"blank_line"^0 -- how many empty lines are permitted? - * V"directive_indented_lines" - , - - directive_block_single = V"whitespace"^1 * Ct(C((1 - V"eol")^1)) * V"eol", - --------------------------------------------------------------------------------- --- Substitution definition block --------------------------------------------------------------------------------- - - substitution_definition = V"explicit_markup_start" - * V"substitution_text" - * V"whitespace"^1 - * C((1 - V"colon" - V"space" - V"eol")^1) -- directive - * V"double_colon" - * Ct(V"data_directive_block") - * V"end_block"^-1 - / rst.substitution_definition - , - - substitution_text = V"bar" - * C((1 - V"bar" - V"eol")^1) - * V"bar" - , - - data_directive_block = V"data_directive_block_multi" - + V"data_directive_block_single" - , - data_directive_block_single = Ct(C((1 - V"eol")^0)) * V"eol", - - data_directive_block_multi = Cg((1 - V"eol")^0, "first") * V"eol" - * V"directive_indented_lines" - , - - directive_indented_lines = Ct(V"directive_indented_first" - * V"directive_indented_other"^0) - * (V"blank_line"^1 * Ct(V"directive_indented_other"^1))^0 - , - - - directive_indented_first = Cmt(V"space"^1, function(s,i,indent) - warn("sub-i", #indent, i) - state.currentindent = indent - return true - end) - * C((1 - V"eol")^1) * V"eol" - , - - directive_indented_other = Cmt(V"space"^1, function(s,i,indent) - warn("sub-m", - #state.currentindent <= #indent, - #indent, - #state.currentindent, - i) - return #state.currentindent <= #indent - end) - * C((1 - V"eol")^1) * V"eol" - , - - --------------------------------------------------------------------------------- --- Explicit markup footnote block --------------------------------------------------------------------------------- - - footnote_block = V"footnote"^1 * V"end_block", - - footnote = V"explicit_markup_start" - * (V"footnote_marker" + V"citation_reference_label") - * C(V"footnote_content") - * (V"blank_line" - V"end_block")^-1 - / rst.footnote - , - - footnote_marker = V"lsquare" * C(V"footnote_label") * V"rsquare" * V"whitespace"^0 - , - - citation_reference_label = V"lsquare" * C(V"letter" * (1 - V"rsquare")^1) * V"rsquare" * V"whitespace"^0, - - footnote_label = V"digit"^1 - + (V"gartenzaun" * V"letter"^1) - + V"gartenzaun" - + V"asterisk" - , - - footnote_content = V"footnote_long" -- single line - + V"footnote_simple" - , - - footnote_simple = (1 - V"eol")^1 * V"eol" - , - - footnote_long = (1 - V"eol")^1 * V"eol" - * V"footnote_body" - , - - footnote_body = V"fn_body_first" - * (V"fn_body_other" + V"fn_body_other_block")^0 - , - - fn_body_first = Cmt(V"space"^1, function(s, i, indent) - warn("fn-in", true, #indent) - state.currentindent = indent - return true - end) - * (1 - V"eol")^1 * V"eol" - , - - fn_matchindent = Cmt(V"space"^1, function(s, i, indent) - local tc = state.currentindent - warn("fn-ma", tc == indent, #tc, #indent, i) - return tc == indent - end) - , - - fn_body_other = V"fn_body_other_regular" - * (V"blank_line" * V"fn_body_other_regular")^0 - , - - fn_body_other_regular = V"fn_matchindent" - * (1 - V"eol")^1 * V"eol" - , - - -- TODO find a way to get those to work in footnotes! - fn_body_other_block = V"line_block" - + V"table_block" - + V"transition" - + V"block_quote" - + V"list" - , - --------------------------------------------------------------------------------- --- Table block --------------------------------------------------------------------------------- - - table_block = V"simple_table" - + V"grid_table" - , - --------------------------------------------------------------------------------- --- Simple tables --------------------------------------------------------------------------------- - - simple_table = Ct(V"st_first_row" - * V"st_other_rows") - * V"end_block" - / function (tab) - return rst.simple_table(helpers.table.simple(tab)) - end - , - - st_first_row = V"st_setindent" - * C(V"st_setlayout") - * V"space"^0 - * V"eol" - , - - st_setindent = Cmt(V"space"^0, function(s, i, indent) - warn("sta-i", "true", #indent, "set", i) - state.currentindent = indent - return true - end) - , - - st_matchindent = Cmt(V"space"^0, function(s, i, indent) - warn("sta-m", state.currentindent == indent, #indent, #state.currentindent, i) - return state.currentindent == indent - end) - , - - st_setlayout = Cmt((V"equals"^1) * (V"spaces" * V"equals"^1)^1, function(s, i, layout) - local tc = state.currentlayout - warn("sta-l", #layout, "set", "", i) - tc.raw = layout - tc.bounds = helpers.get_st_boundaries(layout) - return true - end) - , - - st_other_rows = (V"st_content"^1 * V"st_separator")^1, - - st_content = V"blank_line"^-1 - * C(V"st_matchlayout"), - - st_matchlayout = -#V"st_separator" * Cmt((1 - V"eol")^1, function (s, i, content) - -- Don't check for matching indent but if the rest is - -- fine then the line should be sane. This allows - -- cells starting with spaces. - content = stringsub (content, #state.currentindent) - local tcb = state.currentlayout.bounds - local n = 1 - local spaces_only = P" "^1 - while n < #tcb.slices do - local from = tcb.slices[n] .stop - local to = tcb.slices[n+1].start - local between = lpegmatch (spaces_only, content, from) - if not between then -- Cell spanning more than one row. - -- pass - warn("sta-c", "span", from, to, i) - elseif not (between >= to) then - warn("sta-c", "false", from, to, i) - return false - end - n = n + 1 - end - warn("sta-c", "true", #tcb.slices, "", i) - return true - end) - * V"eol" - , - - st_separator = V"st_matchindent" - * C(V"st_normal_sep" + V"st_colspan_sep") - * V"eol" - , - - st_normal_sep = Cmt((V"equals"^1) * (V"spaces" * V"equals"^1)^1, function(s, i, layout) - warn("sta-s", state.currentlayout.raw == layout, #layout, #state.currentlayout.raw, i) - return state.currentlayout.raw == layout - end) - , - - st_colspan_sep = Cmt(V"dash"^1 * (V"spaces" * V"dash"^1)^0, function(s, i, layout) - local tcb = state.currentlayout.bounds - local this = helpers.get_st_boundaries (layout) - local start_valid = false - for start, _ in next, this.starts do - if tcb.starts[start] then - start_valid = true - local stop_valid = false - for stop, _ in next, this.stops do - if tcb.stops[stop] then -- bingo - stop_valid = true - end - end - if not stop_valid then - warn("sta-x", stop_valid, #layout, #state.currentlayout.raw, i) - return false - end - end - end - warn("sta-x", start_valid, #layout, #state.currentlayout.raw, i) - return start_valid - end) - , - - --------------------------------------------------------------------------------- --- Grid tables --------------------------------------------------------------------------------- - - grid_table = Ct(V"gt_first_row" - * V"gt_other_rows") - * V"blank_line"^1 - / function(tab) - return rst.grid_table(helpers.table.create(tab)) - end - , - - gt_first_row = V"gt_setindent" - * C(V"gt_sethorizontal") - * V"eol" - , - - gt_setindent = Cmt(V"space"^0, function(s, i, indent) - warn("tab-i", true, #indent, "set", i) - state.currentindent = indent - return true - end) - , - - gt_layoutmarkers = V"table_intersection" + V"table_hline" + V"table_header_hline", - - gt_sethorizontal = Cmt(V"gt_layoutmarkers"^3, function (s, i, width) - warn("tab-h", "width", "true", #width, "set", i) - state.currentwidth = #width - return true - end) - , - - gt_other_rows = V"gt_head"^-1 - * V"gt_body" - , - - gt_matchindent = Cmt(V"space"^0, function (s, i, this) - local matchme = state.currentindent - warn("tab-m", "indent", #this == #matchme, #this, #matchme, i) - return #this == #matchme - end) - , - - - gt_cell = (V"gt_content_cell" + V"gt_line_cell") - * (V"table_intersection" + V"table_vline") - , - - gt_content_cell = ((1 - V"table_vline" - V"table_intersection" - V"eol")^1), - - gt_line_cell = V"table_hline"^1, - - gt_contentrow = V"gt_matchindent" - * C((V"table_intersection" + V"table_vline") - * V"gt_cell"^1) - * V"whitespace"^-1 * V"eol" - , - - gt_body = ((V"gt_contentrow" - V"gt_bodysep")^1 * V"gt_bodysep")^1, - - gt_bodysep = V"gt_matchindent" - * C(Cmt(V"table_intersection" - * (V"table_hline"^1 * V"table_intersection")^1, function(s, i, separator) - local matchme = state.currentwidth - warn("tab-m", "body", #separator == matchme, #separator, matchme, i) - return #separator == matchme - end)) - * V"whitespace"^-1 * V"eol" - , - - gt_head = V"gt_contentrow"^1 - * V"gt_headsep" - , - - gt_headsep = V"gt_matchindent" - * C(Cmt(V"table_intersection" - * (V"table_header_hline"^1 * V"table_intersection")^1, function(s, i, separator) - local matchme = state.currentwidth - warn("tab-s", "head", #separator == matchme, #separator, matchme, i) - return #separator == matchme - end)) - * V"whitespace"^-1 * V"eol" - , - - --------------------------------------------------------------------------------- --- Block quotes --------------------------------------------------------------------------------- - - block_quote = Ct(Cs(V"block_quote_first" - * V"block_quote_other"^0 - * (V"blank_line" * V"block_quote_other"^1)^0) - * (V"blank_line" - * Cs(V"block_quote_attri"))^-1) - * V"end_block" - / rst.block_quote - , - - block_quote_first = Cmt(V"space"^1, function (s, i, indent) - warn("bkq-i", #indent, "", indent, "", i) - state.currentindent = indent - return true - end) / "" - * -V"attrib_dash" - * (1 - V"eol")^1 - * V"eol" - , - - block_quote_other = Cmt(V"space"^1, function (s, i, indent) - warn("bkq-m", #indent, #state.currentindent, - indent, state.currentindent, i) - return state.currentindent == indent - end) / "" - * -V"attrib_dash" - * (1 - V"eol")^1 - * V"eol" - , - - block_quote_attri = V"block_quote_attri_first" - * V"block_quote_attri_other"^0, - - block_quote_attri_first = Cmt(V"space"^1 * V"attrib_dash" * V"space", function (s, i, indent) - local t = state - warn("bqa-i", utflen(indent), #t.currentindent, - indent, t.currentindent, i) - local ret = stringmatch (indent, " *") == t.currentindent - t.currentindent = ret and indent or t.currentindent - return ret - end) / "" - * (1 - V"eol")^1 - * V"eol" - , - - block_quote_attri_other = Cmt(V"space"^1, function (s, i, indent) - warn("bqa-m", #indent, utflen(state.currentindent), - indent, state.currentindent, i) - return utflen(state.currentindent) == #indent - end) / "" - * (1 - V"eol")^1 - * V"eol" - , - --------------------------------------------------------------------------------- --- Line blocks --------------------------------------------------------------------------------- - - line_block = Cs(V"line_block_first" - * (V"line_block_other" - + V"line_block_empty")^1) - --* V"blank_line" - * V"end_block" - / rst.line_block - , - - line_block_marker = V"space"^0 * V"bar" * V"space", - - line_block_empty_marker = V"space"^0 * V"bar" * V"space"^0 * V"eol", - - - line_block_first = Cmt(V"line_block_marker", function(s, i, marker) - warn("lbk-i", #marker, "", marker, "", i) - state.currentindent = marker - return true - end) / "" - * V"line_block_line" - , - - line_block_empty = Cmt(V"line_block_empty_marker", function(s, i, marker) - warn("lbk-e", #marker, #state.currentindent, marker, state.currentindent, i) - marker = stringgsub (marker, "|.*", "| ") - return state.currentindent == marker - end) / "" - / rst.line_block_empty - , - - line_block_other = Cmt(V"line_block_marker", function(s, i, marker) - warn("lbk-m", #marker, #state.currentindent, marker, state.currentindent, i) - return state.currentindent == marker - end) / "" - * V"line_block_line" - , - - line_block_line = Cs((1 - V"eol")^1 - * V"line_block_cont"^0 - * V"eol") - / rst.line_block_line - , - - line_block_cont = (V"eol" - V"line_block_marker") - * Cmt(V"space"^1, function(s, i, spaces) - warn("lbk-c", #spaces, #state.currentindent, spaces, state.currentindent, i) - return #spaces >= #state.currentindent - end) / "" - * (1 - V"eol")^1 - , - --------------------------------------------------------------------------------- --- Literal blocks --------------------------------------------------------------------------------- - - literal_block = V"literal_block_marker" - * Cs(V"literal_block_lines") - * V"end_block" - / rst.literal_block, - - literal_block_marker = V"double_colon" * V"whitespace"^0 * V"eol" * V"blank_line", - - literal_block_lines = V"unquoted_literal_block_lines" - + V"quoted_literal_block_lines" - , - - unquoted_literal_block_lines = V"literal_block_first" - * (V"blank_line"^-1 * V"literal_block_other")^0 - , - - quoted_literal_block_lines = V"quoted_literal_block_first" - * V"quoted_literal_block_other"^0 -- no blank lines allowed - , - - literal_block_first = Cmt(V"space"^1, function (s, i, indent) - warn("lbk-f", #indent, "", "", i) - if not indent or - indent == "" then - return false - end - if state.currentindent and #state.currentindent < #indent then - state.currentindent = state.currentindent .. " " - return true - else - state.currentindent = " " - return true - end - end) - * V"rest_of_line" - * V"eol", - - literal_block_other = Cmt(V"space"^1, function (s, i, indent) - warn("lbk-m", - #indent, - #state.currentindent, - #indent >= #state.currentindent, - i) - return #indent >= #state.currentindent - end) - * V"rest_of_line" - * V"eol" - , - - quoted_literal_block_first = Cmt(V"adornment_char", function (s, i, indent) - warn("qlb-f", #indent, indent, "", i) - if not indent or - indent == "" then - return false - end - state.currentindent = indent - return true - end) - * V"rest_of_line" - * V"eol" - , - - quoted_literal_block_other = Cmt(V"adornment_char", function (s, i, indent) - warn("qlb-m", - #indent, - #state.currentindent, - #indent >= #state.currentindent, - i) - return #indent >= #state.currentindent - end) - * V"rest_of_line" - * V"eol", - --------------------------------------------------------------------------------- --- Lists --------------------------------------------------------------------------------- - - list = (V"option_list" - + V"bullet_list" - + V"definition_list" - + V"field_list") - - V"explicit_markup_start" - , - --------------------------------------------------------------------------------- --- Option lists --------------------------------------------------------------------------------- - - option_list = Cs((V"option_list_item" - * V"blank_line"^-1)^1) - /rst.option_list, - - option_list_item = Ct(C(V"option_group") - * Cs(V"option_description")) - / rst.option_item, - - option_description = V"option_desc_next" - + V"option_desc_more" - + V"option_desc_single", - - option_desc_single = V"space"^2 - --* V"rest_of_line" - * (1 - V"eol")^1 - * V"eol", - - option_desc_more = V"space"^2 - * (1 - V"eol")^1 - * V"eol" - * V"indented_lines" - * (V"blank_line" * V"indented_lines")^0, - - option_desc_next = V"eol" - * V"indented_lines" - * (V"blank_line" * V"indented_lines")^0, - - option_group = V"option" - * (V"comma" * V"space" * V"option")^0, - - option = (V"option_posixlong" - + V"option_posixshort" - + V"option_dos_vms") - * V"option_arg"^-1, - - option_arg = (V"equals" + V"space") - * ((V"letter" * (V"letter" + V"digit")^1) - + (V"angle_left" * (1 - V"angle_right")^1 * V"angle_right")), - - option_posixshort = V"dash" * (V"letter" + V"digit"), - - option_posixlong = V"double_dash" - * V"letter" - * (V"letter" + V"digit" + V"dash")^1, - - option_dos_vms = V"slash" - * V"letter"^1, - --------------------------------------------------------------------------------- --- Field lists (for bibliographies etc.) --------------------------------------------------------------------------------- - - field_list = Cs(V"field" - * (V"blank_line"^-1 * V"field")^0) - * V"end_block" - / rst.field_list, - - field = Ct(V"field_marker" - * V"whitespace" - * V"field_body") - / rst.field, - - field_marker = V"colon" - * C(V"field_name") - * V"colon", - - field_name = (V"escaped_colon" + (1 - V"colon"))^1, - - field_body = V"field_single" + V"field_multi", - - field_single = C((1 -V"eol")^1) * V"eol", - - field_multi = C((1 - V"eol")^0 * V"eol" - * V"indented_lines"^-1), - --------------------------------------------------------------------------------- --- Definition lists --------------------------------------------------------------------------------- - - definition_list = Ct((V"definition_item" - V"comment") - * (V"blank_line" * V"definition_item")^0) - * V"end_block" - / rst.deflist - , - - definition_item = Ct(C(V"definition_term") - * V"definition_classifiers" - * V"eol" - * Ct(V"definition_def")) - , - - definition_term = #(1 - V"space" - V"field_marker") - * (1 - V"eol" - V"definition_classifier_separator")^1 - , - - definition_classifier_separator = V"space" * V"colon" * V"space", - - definition_classifiers = V"definition_classifier"^0, - - definition_classifier = V"definition_classifier_separator" - * C((1 - V"eol" - V"definition_classifier_separator")^1) - , - - definition_def = C(V"definition_firstpar") * C(V"definition_par")^0 - , - - definition_indent = Cmt(V"space"^1, function(s, i, indent) - warn("def-i", #indent, #state.currentindent, indent == state.currentindent, i) - state.currentindent = indent - return true - end), - - definition_firstpar = V"definition_parinit" - * (V"definition_parline" - V"blank_line")^0 - , - - definition_par = V"blank_line" - * (V"definition_parline" - V"blank_line")^1 - , - - definition_parinit = V"definition_indent" - * (1 - V"eol")^1 - * V"eol" - , - - definition_parline = V"definition_match" - * (1 - V"eol")^1 - * V"eol" - , - - definition_match = Cmt(V"space"^1, function (s, i, this) - warn("def-m", #this, #state.currentindent, this == state.currentindent, i) - return this == state.currentindent - end), - --------------------------------------------------------------------------------- --- Bullet lists and enumerations --------------------------------------------------------------------------------- - - -- the next rule handles enumerations as well - bullet_list = V"bullet_init" - * (V"blank_line"^-1 * (V"bullet_list" + V"bullet_continue"))^0 - * V"bullet_stop" - * Cmt(Cc(nil), function (s, i) - local depth = state.depth - warn("close", depth) - state.bullets[depth] = nil -- “pop” - depth = depth - 1 - state.lastbullet = state.lastbullets[depth] - state.depth = depth - return true - end) - , - - bullet_stop = V"end_block" / rst.stopitemize, - - bullet_init = Ct(C(V"bullet_first") * V"bullet_itemrest") - / rst.bullet_item - , - - bullet_first = #Cmt(V"bullet_indent", function (s, i, bullet) - local depth = state.depth - local bullets = state.bullets - local oldbullet = state.bullets[depth] - local n_spaces = lpegmatch(P" "^0, bullet) - warn("first", - depth, - (depth == 0 and n_spaces >= 1) or (depth > 0 and n_spaces > 1), - bullet, - oldbullet, - helpers.list.conversion(bullet)) - - if depth == 0 and n_spaces >= 1 then -- first level - depth = 1 -- “push” - bullets[1] = bullet - state.lastbullet = bullet - bullets.max = bullets.max < depth and depth or bullets.max - state.depth = depth - return true - elseif depth > 0 and n_spaces > 1 then -- sublist (of sublist)^0 - if n_spaces >= utflen(oldbullet) then - state.lastbullets[depth] = state.lastbullet - depth = depth + 1 - bullets[depth] = bullet - state.lastbullet = bullet - bullets.max = bullets.max < depth and depth or bullets.max - state.depth = depth - return true - end - end - return false - end) - * V"bullet_indent" - / rst.startitemize - , - - bullet_indent = V"space"^0 * V"bullet_expr" * V"space"^1, - - bullet_cont = Cmt(V"bullet_indent", function (s, i, bullet) - local conversion = helpers.list.conversion - local depth = state.depth - local bullets = state.bullets - local lastbullets = state.lastbullets - warn("conti", - depth, - bullet == bullets[depth], - bullet, - bullets[depth], - lastbullets[depth], - conversion(state.lastbullet), - conversion(bullet) - ) - - if utflen(bullets[depth]) ~= utflen(bullet) then - return false - elseif not conversion(bullet) and bullets[depth] == bullet then - return true - elseif conversion(state.lastbullet) == conversion(bullet) then -- same type - local autoconv = conversion(bullet) == "auto" - local greater = helpers.list.greater (bullet, state.lastbullet) - state.lastbullet = bullet - return autoconv or successor or greater - end - end) - , - - bullet_continue = Ct(C(V"bullet_cont") * V"bullet_itemrest") - /rst.bullet_item - , - - bullet_itemrest = C(V"bullet_rest" -- first line - * ((V"bullet_match" * V"bullet_rest")^0 -- any successive lines - * (V"blank_line" - * (V"bullet_match" * (V"bullet_rest" - V"bullet_indent"))^1)^0)) - , - -- ^^^^^^^^^^^^^ - -- otherwise matches bullet_first - - bullet_rest = (1 - V"eol")^1 * V"eol", -- rest of one line - - bullet_next = V"space"^1 - , - - bullet_match = Cmt(V"bullet_next", function (s, i, this) - local t = state - warn("match", - t.depth, - stringlen(this) == utflen(t.bullets[t.depth]), - utflen(t.bullets[t.depth]), stringlen(this) ) - return stringlen(this) == utflen(t.bullets[t.depth]) - end) - , - - bullet_expr = V"bullet_char" - + (P"(" * V"number_char" * P")") --- surrounded by parentheses - + (V"number_char" * P")") --- suffixed with right parenthesis - + (V"number_char" * V"dot") * #V"space" --- suffixed with period - --[[-- - below rule is invalid according to the spec: - http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#enumerated-lists - --]]-- - --+ (V"number_char" * #V"space") - , - - number_char = V"roman_numeral" - + V"Roman_numeral" - + P"#" - + V"digit"^1 - + R"AZ" - + R"az" - , - --------------------------------------------------------------------------------- --- Transitions --------------------------------------------------------------------------------- - - transition_line = C(V"adornment_char"^4), - - transition = V"transition_line" * V"eol" - * V"end_block" - / rst.transition - , - --------------------------------------------------------------------------------- --- Sectioning --------------------------------------------------------------------------------- - - section_adorn = V"adornment_char"^1, - - section = ((V"section_text" * V"section_once") - + (V"section_before" * V"section_text" * V"section_after")) - / rst.section - * (V"end_block" + V"blank_line") - , - - -- The whitespace handling after the overline is necessary because headings - -- without overline aren't allowed to be indented. - section_before = C(Cmt(V"section_adorn", function(s,i, adorn) - local adorn_matched = lpegmatch (valid_adornment, adorn) - state.previousadorn = adorn - warn ("sec-f", adorn_matched, - stringsub (adorn, 1,2) .. "...", "", i) - if adorn_matched then - return true - end - return false - end)) - * V"whitespace"^0 - * V"eol" - * V"whitespace"^0 - , - - section_text = C((1 - V"space" - V"eol") * (1 - V"eol")^1) * V"eol", - - section_after = C(Cmt(V"section_adorn", function(s,i, adorn) - local tests = false - if lpegmatch (valid_adornment, adorn) then - tests = true - end - if state.previousadorn then - tests = tests and adorn == state.previousadorn - end - warn ("sec-a", tests, stringsub (adorn, 1,2) .. "…", "", i) - state.previousadorn = nil - return tests - end)) - * V"whitespace"^0 - , - - section_once = C(Cmt(V"section_adorn", function(s,i, adorn) - local tests = false - if lpegmatch (valid_adornment, adorn) then - tests = true - end - warn ("sec-o", tests, stringsub (adorn, 1,2) .. "…", "", i) - state.previousadorn = nil - return tests - end)) - * V"whitespace"^0 - , - --------------------------------------------------------------------------------- --- Target Blocks --------------------------------------------------------------------------------- - - tname_normal = C((V"escaped_colon" + 1 - V"colon")^1) - * V"colon", - - tname_bareia = C(V"bareia" - * (1 - V"eol" - V"bareia")^1 - * V"bareia") - * V"colon", - - target_name = V"double_dot" - * V"space" - * V"underscore" - * (V"tname_bareia" + V"tname_normal"), - - target_firstindent = V"eol" * Cg(V"space"^1, "indent"), - - target_nextindent = V"eol" * C(V"space"^1), - - target_indentmatch = Cmt(V"target_nextindent" -- I ♡ LPEG! - * Cb("indent"), function (s, i, a, b) - return a == b - end), - - target_link = ( V"space"^0 * V"target_firstindent" - * Ct(C(1 - V"whitespace" - V"eol")^1 - * (V"target_indentmatch" - * C(1 - V"whitespace" - V"eol")^1)^0) - * V"eol" * #(1 - V"whitespace" - "eol")) / rst.joinindented - + C((1 - V"eol")^1) * V"eol" * #(V"double_dot" + V"double_underscore" + V"eol") - + (1 - V"end_block")^0 * Cc(""), - - target = Ct((V"target_name" * (V"space"^0 * V"eol" * V"target_name")^0) - * V"space"^0 - * V"target_link") - / rst.target, - - anonymous_prefix = (V"double_dot" * V"space" * V"double_underscore" * V"colon") - + (V"double_underscore") - , - - anonymous_target = V"anonymous_prefix" - * V"space"^0 - * Ct(Cc"" * V"target_link") - / rst.target - , - - target_block = (V"anonymous_target" + V"target")^1 - * V"end_block", - --------------------------------------------------------------------------------- --- Paragraphs * Inline Markup --------------------------------------------------------------------------------- - - paragraph = Ct(V"par_first" - * V"par_other"^0) / rst.paragraph - * V"end_block" - * V"reset_depth" - , - - par_first = V"par_setindent" - * C((1 - V"literal_block_shorthand" - V"eol")^1) - * (V"included_literal_block" + V"eol") - , - - par_other = V"par_matchindent" - * C((1 - V"literal_block_shorthand" - V"eol")^1) - * (V"included_literal_block" + V"eol") - , - - par_setindent = Cmt(V"space"^0, function (s, i, indent) - warn("par-i", #indent, "", "", i) - state.previousindent = state.currentindent - state.currentindent = indent - return true - end), - - par_matchindent = Cmt(V"space"^0, function (s, i, indent) - warn("par-m", state.currentindent == indent, #indent, #state.currentindent, i) - return state.currentindent == indent - end), - - included_literal_block = V"literal_block_shorthand" - * V"literal_block_markerless" - * Cmt(Cp(), function (s, i, _) - warn("par-s", "", #state.previousindent, #state.currentindent, i) - state.currentindent = state.previousindent - return true - end) - , - - literal_block_shorthand = Cs((V"colon" * V"space" * V"double_colon" - + V"double_colon") - * V"whitespace"^0 - * V"eol" - * V"blank_line") - -- The \unskip is necessary because the lines of a - -- paragraph get concatenated from a table with a - -- space as separator. And the literal block is - -- treated as one such line, hence it would be - -- preceded by a space. As the ":" character - -- always follows a non-space this should be a - -- safe, albeit unpleasant, hack. If you don't - -- agree then file a bug report and I'll look into - -- it. - / "\\\\unskip:" - , - - literal_block_markerless = Cs(V"literal_block_lines") - * V"blank_line" - / rst.included_literal_block - , - - -- This is needed because lpeg.Cmt() patterns are evaluated even - -- if they are part of a larger pattern that doesn’t match. The - -- result is that they confuse the nesting. - -- Resetting the current nesting depth at every end of block - -- should be safe because this pattern always matches last. - reset_depth = Cmt(Cc("nothing") / "", function (s,i, something) - state.depth = 0 - warn("reset", "", state.depth, #state.currentindent, i) - return true - end) - , - --------------------------------------------------------------------------------- --- Comments --------------------------------------------------------------------------------- - - comment_block = V"comment" - * V"end_block"^-1 - , - - comment = V"double_dot" / "" - * (V"block_comment" + V"line_comment") - , - - block_comment = V"whitespace"^0 - * Cs((1 - V"eol")^0 * V"eol" - * V"indented_lines") - / rst.block_comment, - - line_comment = V"whitespace"^1 - * C((1 - V"eol")^0 * V"eol") - / rst.line_comment - , - --------------------------------------------------------------------------------- --- Generic indented block --------------------------------------------------------------------------------- - - indented_lines = V"indented_first" - * (V"indented_other"^0 - * (V"blank_line" * V"indented_other"^1)^0) - , - - indented_first = Cmt(V"space"^1, function (s, i, indent) - warn("idt-f", indent, i) - state.currentindent = indent - return true - end) / "" - * (1 - V"eol")^1 - * V"eol" - , - - indented_other = Cmt(V"space"^1, function (s, i, indent) - warn("idt-m", #indent, #state.currentindent, #indent == #state.currentindent, i) - return indent == state.currentindent - end) / "" - * (1 - V"eol")^1 - * V"eol" - , - --------------------------------------------------------------------------------- --- Urls --------------------------------------------------------------------------------- - uri = V"url_protocol" * V"url_domain" * (V"slash" * V"url_path")^0, - - url_protocol = (P"http" + P"ftp" + P"shttp" + P"sftp") * P"://", - url_domain_char = 1 - V"dot" - V"spacing" - V"eol" - V"punctuation", - url_domain = V"url_domain_char"^1 * (V"dot" * V"url_domain_char"^1)^0, - url_path_char = R("az", "AZ", "09") + S"-_.!~*'()", - url_path = V"slash" * (V"url_path_char"^1 * V"slash"^-1)^1, - --------------------------------------------------------------------------------- --- Terminal Symbols and Low-Level Elements --------------------------------------------------------------------------------- - - asterisk = P"*", - backslash = P"\\", - bar = P"|", - bareia = P"`", - slash = P"/", - solidus = P"⁄", - equals = P"=", - - --- Punctuation - -- Some of the following are used for markup as well as for punctuation. - - apostrophe = P"’" + P"'", - comma = P",", - colon = P":", - dot = P".", - interpunct = P"·", - semicolon = P";", - underscore = P"_", - dash = P"-", - emdash = P"—", - hyphen = P"‐", - questionmark = P"?", - exclamationmark = P"!", - interrobang = P"‽", - lsquare = P"[", - rsquare = P"]", - ellipsis = P"…" + P"...", - guillemets = P"«" + P"»", - quotationmarks = P"‘" + P"’" + P"“" + P"”", - - period = V"dot", - double_dot = V"dot" * V"dot", - double_colon = V"colon" * V"colon", - escaped_colon = V"backslash" * V"colon", - double_underscore = V"underscore" * V"underscore", - double_dash = V"dash" * V"dash", - triple_dash = V"double_dash" * V"dash", - attrib_dash = V"triple_dash" + V"double_dash" + V"emdash", -- begins quote attribution blocks - dashes = V"dash" + P"‒" + P"–" + V"emdash" + P"―", - - - - punctuation = V"apostrophe" - + V"colon" - + V"comma" - + V"dashes" - + V"dot" - + V"ellipsis" - + V"exclamationmark" - + V"guillemets" - + V"hyphen" - + V"interpunct" - + V"interrobang" - + V"questionmark" - + V"quotationmarks" - + V"semicolon" - + V"slash" - + V"solidus" - + V"underscore" - , - - -- End punctuation - - letter = R"az" + R"AZ", - digit = R"09", - - space = P" ", - spaces = V"space"^1, - whitespace = (P" " + Cs(P"\t") / " " + Cs(S"\v") / " "), - spacing = V"whitespace"^1, - blank_line = V"whitespace"^0 * V"eol", - - rest_of_line = (1 - V"eol")^1, - - eol = S"\r\n", - eof = V"eol"^0 * -P(1), - - end_block = V"blank_line"^1 * V"eof"^-1 - + V"eof" - , - - -- diverse markup character sets - adornment_char = S[[!"#$%&'()*+,-./:;<=>?@[]^_`{|}~]] + P[[\\]], -- headings - bullet_char = S"*+-" + P"•" + P"‣" + P"⁃", -- bullet lists - - roman_numeral = S"ivxlcdm"^1, - Roman_numeral = S"IVXLCDM"^1, - - angle_left = P"<", - angle_right = P">", - gartenzaun = P"#", - - table_intersection = P"+", - table_hline = V"dash", - table_vline = V"bar", - table_header_hline = P"=", -} - ---- 225 rules at 2014-02-28 with lpeg 0.12 and Luatex 0.78.3 ---lpeg.print(rst_parser) ---lpeg.ptree(rst_parser) ---os.exit() - -local file_helpers = { } - -function file_helpers.strip_BOM (raw) - if stringmatch (raw, "^\239\187\191") then - return stringsub (raw, 4) - end - return raw -end - ---- Tab expansion: feature request by Philipp A. -do - local shiftwidth = rst.shiftwidth - local stringrep = string.rep - local position = 1 - - local reset_position = function () position = 1 return "\n" end - local increment_position = function (c) position = position + 1 return c end - local expand_tab = function () - local expand = (shiftwidth - position) % shiftwidth + 1 - position = position + expand - return stringrep(" ", expand) - end - - local tab = S"\t\v" / expand_tab - local utfchar = utfchar / increment_position - local eol = P"\n" / reset_position - local p_expand = Cs((tab + eol + utfchar)^1) - - function file_helpers.expandtab (raw) - position = 1 - return lpegmatch (p_expand, raw) - end -end - ---- Spotted by Philipp A. -function file_helpers.insert_blank (raw) - if not stringfind (raw, "\n%s$") then - return raw .. "\n\n" - end - return raw -end - -function file_helpers.crlf (raw) - if stringfind (raw, "\r\n") then - return stringgsub (raw, "\r\n", "\n") - end - return raw -end - -local function load_file (name) - f = assert(ioopen(name, "r"), "Not a file!") - if not f then return 1 end - local tmp = f:read("*all") - f:close() - - local fh = file_helpers - if thirddata.rst.strip_BOM then - tmp = fh.strip_BOM(tmp) - end - if thirddata.rst.crlf then - tmp = fh.crlf(tmp) - end - if thirddata.rst.expandtab then - tmp = fh.expandtab(tmp) - end - return fh.insert_blank(tmp) -end - -local function save_file (name, data) - f = assert(ioopen(name, "w"), "Could not open file "..name.." for writing! Check its permissions") - if not f then return 1 end - f:write(data) - f:close() - return 0 -end - -local function get_setups (inline) - local optional_setups = optional_setups - local setups = "" - if not inline then - setups = setups .. [[ -%+-------------------------------------------------------------+% -%| Setups |% -%+-------------------------------------------------------------+% -% General % -%---------------------------------------------------------------% - -]] - end - - setups = setups .. [[ -\setupcolors[state=start] -%% Interaction is supposed to be handled manually. -%%\setupinteraction[state=start,focus=standard,color=darkgreen,contrastcolor=darkgreen] -\setupbodyfontenvironment [default] [em=italic] -\sethyphenatedurlnormal{:=?&} -\sethyphenatedurlbefore{?&} -\sethyphenatedurlafter {:=/-} - -\doifundefined{startparagraph}{% -->mkii - \enableregime[utf] - \let\startparagraph\relax - \let\stopparagraph\endgraf -} - -]] - for item, _ in next, state.addme do - local f = optional_setups[item] - setups = f and setups .. f() or setups - end - if not inline then - setups = setups .. [[ - - -%+-------------------------------------------------------------+% -%| Main |% -%+-------------------------------------------------------------+% - -\starttext -]] - end - return setups -end - -function thirddata.rst.standalone (infile, outfile) - local testdata = load_file(infile) - if testdata == 1 then return 1 end - - local processeddata = lpegmatch (rst_parser, testdata) - local setups = get_setups(false) - - processeddata = setups .. processeddata .. [[ - -\stoptext - -%+-------------------------------------------------------------+% -%| End of Document |% -%+-------------------------------------------------------------+% - -% vim:ft=context:tw=65:shiftwidth=2:tabstop=2:set expandtab -]] - - if processeddata then - save_file(outfile, processeddata) - else - return 1 - end - return 0 -end - -local p_strip_comments -do - local Cs, P = lpeg.Cs, lpeg.P - local percent = P"%" - local eol = P"\n" - local comment = percent * (1 - eol)^0 * eol / "\n" - p_strip_comments = Cs((comment + 1)^0) -end - - -local tempfile_count = { } --- map category -> count - -local get_tmpfile = function (category) - local cnt = tempfile_count[category] - if not cnt then - cnt = 0 - end - cnt = cnt + 1 - tempfile_count[category] = cnt - local filename = stringformat ("%s_rst-%s-%d", - tex.jobname, category, cnt) - return luatex.registertempfile (filename, - true, - (helpers.rst_debug == true)) --- for debugging generated code -end - - -function thirddata.rst.do_rst_file(fname) - local raw_data = load_file(fname) - local processed = lpegmatch (rst_parser, raw_data) - local setups = get_setups(false) - local tmp_file = get_tmpfile "temporary" - if processed then - processed = lpegmatch (p_strip_comments, setups..processed.."\n\\stoptext\n") - save_file(tmp_file, processed) - context.input("./"..tmp_file) - end -end - -local rst_inclusions = { } -local rst_incsetups = { } -function thirddata.rst.do_rst_inclusion (iname, fname) - local raw_data = load_file(fname) - local processed = lpegmatch (rst_parser, raw_data) - local setups = get_setups(true) - local tmp_file = get_tmpfile "setup" - - if processed then - processed = lpegmatch (p_strip_comments, processed) - save_file(tmp_file, processed) - rst_inclusions[iname] = tmp_file - rst_incsetups[#rst_incsetups +1] = setups - end -end - -function thirddata.rst.do_rst_setups () - local out = tableconcat(rst_incsetups) - --context(out) --- why doesn’t this work? - local tmp_file = get_tmpfile "setup" - save_file(tmp_file, out) - context.input(tmp_file) -end - -function thirddata.rst.get_rst_inclusion (iname) - if rst_inclusions[iname] then - context.input(rst_inclusions[iname]) - else - context(stringformat([[{\bf File for inclusion “%s” not found.}\par ]], iname)) - end -end - -function thirddata.rst.do_rst_snippet(txt) - local processed = lpegmatch (rst_parser, txt) - local setups = get_setups(true) - local tmp_file = get_tmpfile "snippet" - if processed then - warn("·cs·", txt) - processed = lpegmatch (p_strip_comments, setups..processed) - save_file(tmp_file, processed) - context.input("./" .. tmp_file) - else - warn("·cs·", txt) - context.par() - context("{\\bf context-rst could not process snippet.\\par}") - context.type(txt) - context.par() - end -end - ---- vim:tw=79:et:sw=4:ts=8:sts=4 diff --git a/Master/texmf-dist/tex/context/third/rst/rst_setups.lua b/Master/texmf-dist/tex/context/third/rst/rst_setups.lua deleted file mode 100644 index 31f314e2d9a..00000000000 --- a/Master/texmf-dist/tex/context/third/rst/rst_setups.lua +++ /dev/null @@ -1,377 +0,0 @@ -#!/usr/bin/env texlua --------------------------------------------------------------------------------- --- FILE: rst_setups.lua --- USAGE: called by rst_parser.lua --- DESCRIPTION: Complement to the reStructuredText parser --- AUTHOR: Philipp Gesang (Phg), <phg42.2a@gmail.com> --- CHANGED: 2013-06-03 18:52:29+0200 --------------------------------------------------------------------------------- --- - -local optional_setups = { } -thirddata.rst_setups = optional_setups -local rst_directives = thirddata.rst_directives -local rst_context = thirddata.rst - -local stringformat = string.format -local stringstrip = string.strip -local stringgsub = string.gsub - -function optional_setups.footnote_symbol () - local setup = [[ -%---------------------------------------------------------------% -% Footnotes with symbol conversion % -%---------------------------------------------------------------% -\definenote[symbolnote][footnote] -\setupnote [symbolnote][way=bypage,numberconversion=set 2] -]] - return setup -end - -function optional_setups.footnotes () - local tf = rst_context.state.footnotes - local fn = [[ - -%---------------------------------------------------------------% -% Footnotes % -%---------------------------------------------------------------% -]] - local buffer = [[ - -%% %s -\startbuffer[%s] -%s\stopbuffer -]] - - for nf, note in next, tf.numbered do - fn = fn .. stringformat(buffer, "Autonumbered footnote", "__footnote_number_"..nf, note) - end - for nf, note in next, tf.autolabel do - fn = fn .. stringformat(buffer, "Labeled footnote", "__footnote_label_"..nf, note) - end - for nf, note in next, tf.symbol do - fn = fn .. stringformat(buffer, "Symbol footnote", "__footnote_symbol_"..nf, note) - end - return fn -end - -function optional_setups.references () - local refs = rst_context.collected_references - local crefs = rst_context.context_references - local arefs = rst_context.anonymous_set - - local function urlescape (str) - return str:gsub("#", "\\#") - end - - local function resolve_indirect (r) - if r and r:match(".*_$") then -- pointing elsewhere - local look_me_up = r:match("^`?([^`]*)`?_$") - local result = resolve_indirect (refs[look_me_up]) - if result then - return result - else - if rst_context.structure_references[look_me_up] then - -- Internal link, no useURL etc. - return false - end - end - end - return r - end - - local refsection = [[ - -%---------------------------------------------------------------% -% References % -%---------------------------------------------------------------% - -]] - local references = {} - local ref_keys = {} - for ref, target in next, refs do - ref_keys[#ref_keys+1] = [[__target_]] .. rst_context.whitespace_to_underscore(ref) - target = resolve_indirect(target) - if target ~= false then - ref_text = ref - if arefs[ref_text] then - ref_text = rst_context.anonymous_links[tonumber(arefs[ref_text])] - end - references[#references+1] = stringformat([[ -\useURL[__target_%s] [%s] [] [%s] ]], rst_context.whitespace_to_underscore(ref), urlescape(target), ref_text) - end - end - refsection = refsection .. table.concat(references, "\n") - -- this is needed in order to select the right reference command later - refsection = refsection .. "\n\n" .. [[\def \RSTexternalreferences{]] .. table.concat(ref_keys, ",") .. [[} - -% #1 target name, #2 link text -\def\RSTchoosegoto#1#2{% - \rawdoifinsetelse{#1}{\RSTexternalreferences}% - {\from[#1]}% - {\goto{#2}[#1]}% -} -]] - - return refsection -end - -function optional_setups.substitutions () - local directives = rst_directives - local substitutions = [[ - -%---------------------------------------------------------------% -% Substitutions % -%---------------------------------------------------------------% -]] - local rs = rst_context.substitutions - for name, content in next, rs do - local id, data = content.directive, content.data - local directive = directives[id] - if directive then - substitutions = substitutions .. directive(name, data) - else - err(id .. " does not exist.") - end - end - return substitutions -end - -function optional_setups.directive () - --local dirstr = [[ - ---%---------------------------------------------------------------% ---% Directives % ---%---------------------------------------------------------------% ---]] - --return dirstr - return "" -end - -function optional_setups.blockquote () - return [[ - -%---------------------------------------------------------------% -% Blockquotes % -%---------------------------------------------------------------% -\setupdelimitedtext [blockquote][style={\tfx}] % awful placeholder -\definedelimitedtext[attribution][blockquote] -\setupdelimitedtext [attribution][style={\tfx\it}] -]] -end - -function optional_setups.deflist () - return [[ - -%---------------------------------------------------------------% -% Definitionlist % -%---------------------------------------------------------------% -\def\startRSTdefinitionlist{ - \bgroup - \def \RSTdeflistterm##1{{\bf ##1}} - \def\RSTdeflistclassifier##1{\hbox to 1em{\it ##1}} - \def\RSTdeflistdefinition##1{% - \startnarrower[left] - ##1% - \stopnarrower} - \def\RSTdeflistparagraph ##1{% - \startparagraph{% - \noindentation ##1 - \stopparagraph} - } -} - -\let\stopRSTdefinitionlist\egroup -]] -end - -function optional_setups.lines () - return [[ - -%---------------------------------------------------------------% -% Lines environment (line blocks) % -%---------------------------------------------------------------% - -\setuplines[% - space=on,% - before={\startlinecorrection\blank[small]},% - after={\blank[small]\stoplinecorrection},% -] -]] -end - -function optional_setups.breaks () - return [[ - -%---------------------------------------------------------------% -% Fancy transitions % -%---------------------------------------------------------------% - -% Get Wolfgang’s module at <https://bitbucket.org/wolfs/fancybreak>. -\usemodule[fancybreak] -\setupfancybreak[symbol=star] -]] -end - -function optional_setups.fieldlist () - return [[ - -%---------------------------------------------------------------% -% Fieldlists % -%---------------------------------------------------------------% - -\def\startRSTfieldlist{% - \bgroup% - \unexpanded\def\RSTfieldname##1{\bTR\bTC ##1\eTC} - \unexpanded\def\RSTfieldbody##1{\bTC ##1\eTC\eTR} -% - \setupTABLE[c][first] [background=color, backgroundcolor=grey, style=\bf] - \setupTABLE[c][2] [align=right] - \setupTABLE[c][each] [frame=off] - \setupTABLE[r][each] [frame=off] - \bTABLE[split=yes,option=stretch] - \bTABLEhead - \bTR - \bTH Field \eTH - \bTH Body \eTH - \eTR - \eTABLEhead - \bTABLEbody -} - -\def\stopRSTfieldlist{% - %\eTABLEbody % doesn't work, temporarily moved to rst_context.field_list() - \eTABLE - \egroup% -} -]] -end - -function optional_setups.dbend () - -- There's just no reason for not providing this. - optional_setups.dbend_done = true - return [[ -%---------------------------------------------------------------% -% Dangerous bend % -%---------------------------------------------------------------% - -\loadmapfile [manfnt.map] -\definefontsynonym [bends] [manfnt] - -\def\GetSym#1{\getglyph{bends}{\char#1}} - -\startsymbolset [Dangerous Bends] - \definesymbol [dbend] [\GetSym{127}] - \definesymbol [lhdbend] [\GetSym{126}] - \definesymbol [lhdbend] [\GetSym{0}] -\stopsymbolset - -\setupsymbolset [Dangerous Bends] - -]] -end - -function optional_setups.caution () - local result = "" - --if not optional_setups.dbend_done then - --result = result .. optional_setups.dbend() - --end - return result .. [[ -%---------------------------------------------------------------% -% Caution directive % -%---------------------------------------------------------------% - -\usemodule[lettrine] - -\setbox0=\hbox{\symbol[dbend]} -\newskip\RSTbendskip -\RSTbendskip=\wd0 -\advance\RSTbendskip by 1em % These two lines should add -\advance\RSTbendskip by 1pt % 13.4pt in mkiv and 13.14983pt in mkii - % to make the indent equal to the indent - % of the “danger” directive. - % (2*(width)dbend + (kern)1pt + 1em - -\def\startRSTcaution{% -\startparagraph -\dontleavehmode\lettrine[Lines=2,Raise=.6,Findent=\RSTbendskip,Nindent=0pt]{\symbol[dbend]}{}% -} - -\let\stopRSTcaution\stopparagraph - -]] - -end - -function optional_setups.danger () - local result = "" - --if not optional_setups.dbend_done then - --result = result .. optional_setups.dbend() - --end - return result .. [[ -%---------------------------------------------------------------% -% Danger directive % -%---------------------------------------------------------------% - -\usemodule[lettrine] - -\def\startRSTdanger{% -\startparagraph -\lettrine[Lines=2,Raise=.6,Findent=1em,Nindent=0pt]{\symbol[dbend]\kern 1pt\symbol[dbend]}{}% -} - -\let\stopRSTdanger\stopparagraph - -]] - -end - -function optional_setups.citations () - local cit = [[ -%---------------------------------------------------------------% -% Citations % -%---------------------------------------------------------------% -\setupbibtex[database=\jobname] -]] - - - return cit -end - -function optional_setups.citator () - local cit = [[ -%---------------------------------------------------------------% -% Citator Options % -%---------------------------------------------------------------% -\usemodule[citator] -\loadbibdb{\jobname.bib} -\setupcitator[sortmode=authoryear] -\setupcite[mainmode=authoryear] - -\startbuffer[bibliography] -\chapter{References} -\setupbodyfont[small] -\bibbykey{shorthand}{all}{author} -\stopbuffer - -\prependtoks \getbuffer[bibliography] \to \everystoptext -]] - - return cit -end - -function optional_setups.image () - local image = [[ - -%---------------------------------------------------------------% -% images % -%---------------------------------------------------------------% -\setupexternalfigure[location={local,global,default}] - -]] - return image -end - -return optional_setups - --- vim:ft=lua:sw=4:ts=4:expandtab:tw=80 diff --git a/Master/texmf-dist/tex/context/third/rst/t-rst.mkiv b/Master/texmf-dist/tex/context/third/rst/t-rst.mkiv deleted file mode 100644 index a69e238ce59..00000000000 --- a/Master/texmf-dist/tex/context/third/rst/t-rst.mkiv +++ /dev/null @@ -1,241 +0,0 @@ -%D \module [ -%D file=t-rst, -%D version=0.6c ‘It’s the Arts’, -%D title=\CONTEXT\ User Module, -%D subtitle=reStructuredText, -%D author=Philipp Gesang, -%D date=\currentdate, -%D copyright=Philipp Gesang, -%D license=2-clause BSD, -%D ] - -%M \usemodule [rst] -%M \usemodule [int-load] -%M \loadsetups [t-letterspace.xml] - -%C Read the license conditions in the file \type{COPYING}. - -%M \definecolor [gutenred] [x=bf221f] % rubrication from digitized Göttingen Gutenberg bible -%M \setupinteraction [contrastcolor=gutenred,color=gutenred] -%M -%M \define\beautifyshowsetups{% -%M \unexpanded \def \setupnumfont {\rm}% -%M \unexpanded \def \setuptxtfont {\rm}% -%M \unexpanded \def \setupintfont {\rm\sc\Word}% -%M \unexpanded \def \setupvarfont {\rm\it}% -%M \unexpanded \def \setupoptfont {\rm\it}% -%M \unexpanded \def \setupalwcolor {gutenred}% -%M \unexpanded \def \setupoptcolor {gutenred}% -%M \defineframedtext [setuptext] [ -%M frame=off, -%M background=color, -%M backgroundcolor=gray:2, -%M width=\hsize, -%M height=fit, -%M align=right, -%M offset=0.75em, -%M ]% -%M } -%M -%M \let \Oldshowsetup \showsetup -%M -%M \define [1] \showsetup {% -%M \bgroup \beautifyshowsetups% -%M \Oldshowsetup{#1}% -%M \egroup% -%M } - -\writestatus{loading}{ConTeXt User Module / reStructuredText} - -\unprotect - -\startinterface all - \setinterfacevariable {RST} {RST} -\stopinterface - -\definenamespace [\v!RST] [ - type=module, - comment=reStructuredText module, - version=0.6c, - name=\v!RST, - style=\v!no, - command=\v!yes, - setup=\v!list, - parent=\v!RST, -] - -%D Loading the reStructuredText parser. -\ctxloadluafile{rst_parser} - -%D Easy way to define a global test setting. Activated -%D by \type{\usemodule[rst][test=yes]}. - -\startmoduletestsection - \ctxlua{thirddata.rst_helpers.rst_debug = true} -\stopmoduletestsection - -%D To process inline reST markup we’ll have to reset all catcodes -%D except for grouping, escaping and cs arguments. - -\newcatcodetable \RST_catcodes -\startcatcodetable \RST_catcodes - \catcode`\^^I = 12 - \catcode`\^^M = 12 - \catcode`\^^L = 12 - \catcode`\ = 12 - \catcode`\^^Z = 12 - \catcode`\\ = 0 - \catcode`\% = 12 - \catcode`\# = 6 - \catcode`\_ = 12 - \catcode`\^ = 12 - \catcode`\& = 12 - \catcode`\| = 12 - \catcode`\{ = 1 - \catcode`\} = 2 - \catcode`\~ = 12 - \catcode`\$ = 12 -\stopcatcodetable - -%D \section {User-level Commands} -%D -%D \subsection{Typesetting reST-Files} -%D -%D \macros -%D {typesetRSTfile} -%D -%D This command loads and processes an \type{*.rst} file. -%D All necessary setups for the elements to be used (e.g. tables) -%D have to be specified {\em before} this macro is called. -%D As \type{\typesetRSTfile} is intended to process a single file -%D only, it will handle \type{\start|stoptext} automatically. -%D Thus, the user should never supply any of these manually, -%D neither before nor after \type{\typesetRSTfile}. -%D -%D We now handle rogue utf-8 byte order marks on demand, just set -%D the optional parameter \type{stripBOM} to {\em true}. -%D -%D There also is an option \type{expandtab} to convert tabs -%D (ascii 0x09) to indents prior to converting reST input. The -%D expansion width defaults to {\em 4} and can be configured -%D through the parameter \type{shiftwidth} (takes an integer). -%D -%D \showsetup{typesetRSTfile} - -\def\do_typeset_RST_file[#1]#2{% - \iffirstargument - \getparameters[RST][#1]% - \doifdefined{RSTstripBOM} {\ctxlua{thirddata.rst.strip_BOM = \RSTstripBOM}}% - \doifdefined{RSTexpandtab} {\ctxlua{thirddata.rst.expandtab = \RSTexpandtab}}% - \doifdefined{RSTshiftwidth}{\ctxlua{thirddata.rst.shiftwidth = \RSTshiftwidth}}% - \fi - \ctxlua{thirddata.rst.do_rst_file("#2")}% -} - -\def\typesetRSTfile{% - \dosingleempty\do_typeset_RST_file% -} - -%D \subsection{Typesetting Inline Snippets} -%D -%D reST markup can be handy in situations where \CONTEXT\ markup -%D would result in unappropriately verbose source code, e.g. when -%D typesetting tables with simple layout. -%D -%D \macros -%D {RST,startRST} -%D -%D The environment \type{\[start|stop]RST} and the macro -%D \type{\RST} allow access to reST-parser from inside a -%D \CONTEXT\ document when the module is loaded. -%D -%D \showsetup{RST} -%D \showsetup{startRST} - -% Wolfgang’s code below. - -\unexpanded \def \startRST{% - \begingroup - \setcatcodetable \RST_catcodes - \do_start_RST% -} - -\let \stopRST \relax - -\def \do_start_RST#1\stopRST{% - \endgroup% - \ctxlua{thirddata.rst.do_rst_snippet(\!!bs#1\!!es)}% -} - -\def \RST{% - \begingroup - \setcatcodetable \RST_catcodes - \do_RST% -} - -\def \do_RST#1{% - \endgroup% - \ctxlua{thirddata.rst.do_rst_snippet(\!!bs#1\!!es)}% -} - -%D \subsection{Including multiple reST files} -%D -%D \macros -%D {defineRSTinclusion,startRSTproject,RSTinclusion} -%D -%D When content is split among multiple files, these macros allow -%D for including them in arbitrary order. Note that setups from -%D previous includes, unless overwritten, will remain defined. -%D \type{\defineRSTinclusion} takes three arguments: the first one -%D will be the identifier that can be used to refer to the actual -%D inclusion, which is specified via the second argument as a -%D filename. The third optional argument receives the usual -%D setups \type{stripBOM}, \type{expandtab} and -%D \type{shiftwidth}. -%D -%D Defined inclusions can be typeset only within an the -%D \type{\startRSTproject} environment using the macro -%D \type{RSTinclusion}. Between those inclusion all kinds of -%D \TEX\ code except for \type{\starttext} and \type{\stoptext} -%D are permitted. - -\def\do_define_RST_inclusion[#1][#2][#3]{% - \ifthirdargument - \getparameters[RST][#3]% - \doifdefined{RSTstripBOM} {\ctxlua{thirddata.rst.strip_BOM = \RSTstripBOM}}% - \doifdefined{RSTexpandtab} {\ctxlua{thirddata.rst.expandtab = \RSTexpandtab}}% - \doifdefined{RSTshiftwidth}{\ctxlua{thirddata.rst.shiftwidth = \RSTshiftwidth}}% - \fi - \ifsecondargument - \ctxlua{thirddata.rst.do_rst_inclusion("#1", "#2")}% - \fi% -} - -\def\defineRSTinclusion{% - \dotripleempty\do_define_RST_inclusion% -} - -\def\do_RST_inclusion[#1]{% - \iffirstargument - \ctxlua{thirddata.rst.get_rst_inclusion("#1")}% - \fi% -} - -\def\do_RST_setups{% - \ctxlua{thirddata.rst.do_rst_setups()}% -} - -\def\startRSTproject{ - \begingroup - \def\RSTinclusion{\dosingleempty\do_RST_inclusion} - \do_RST_setups - \starttext% -} - -\def\stopRSTproject{ - \stoptext \endgroup \endinput -} - -\protect \endinput - -% vim:ft=context:sw=2:ts=2 diff --git a/Master/texmf-dist/tex/context/third/ruby/t-ruby.mkii b/Master/texmf-dist/tex/context/third/ruby/t-ruby.mkii deleted file mode 100644 index 7f2a6e26800..00000000000 --- a/Master/texmf-dist/tex/context/third/ruby/t-ruby.mkii +++ /dev/null @@ -1,286 +0,0 @@ -%D \module -%D [ file=t-ruby, -%D version=2010.10.10, -%D title=\CONTEXT\ User Module, -%D subtitle=Ruby Markup, -%D author=Wolfgang Schuster, -%D date=\currentdate, -%D copyright=Wolfgang Schuster, -%D email=schuster.wolfgang@googlemail.com, -%D license=Public Domain] - -\writestatus{loading}{ConTeXt User Module / Ruby Markup} - -\unprotect - -%D simple ruby: -%D -%D \starttyping -%D <ruby> -%D <rb>WWW</rb> -%D <rt>World Wide Web</rt> -%D </ruby> -%D \stoptyping -%D -%D complex ruby: -%D -%D \starttyping -%D <ruby> -%D <rbc> -%D <rb>10</rb> -%D <rb>31</rb> -%D <rb>2002</rb> -%D </rbc> -%D <rtc> -%D <rt>Month</rt> -%D <rt>Day</rt> -%D <rt>Year</rt> -%D </rtc> -%D <rtc> -%D <rt rbspan="3">Expiration Date</rt> -%D </rtc> -%D </ruby> -%D \stoptyping - -%D Constants/variables - -\startinterface all - \setinterfaceconstant {basestyle} {basestyle} - \setinterfaceconstant {basecolor} {basecolor} - \setinterfaceconstant {overhang} {overhang} -\stopinterface - -\startinterface all - \setinterfacevariable {letter} {letter} - \setinterfacevariable {end} {end} - \setinterfacevariable {inline} {inline} -\stopinterface - -%D Namespace - -\def\????rb{@@@@rb} - -%D Additional registers - -\newdimen \!!rubywidth -\newdimen \!!rubyleftmargin -\newdimen \!!rubyrightmargin -\newsignal\!!rubysignal -\newcount \!!rubycount -\newtoks \!!rubybase -\newtoks \!!rubytext - -%D \macros -%D {setupruby} - -\def\setupruby - {\dodoubleargument\getparameters[\????rb]} - -\def\rubyparameter#1{\csname\????rb#1\endcsname} - -%D \macros -%D {pdfactualtext} - -\ifx\pdfactualtext\undefined \let\pdfactualtext\secondoftwoarguments \fi - -%D \macros -%D {bRUBY,eRUBY,bRB,eRB,bRT,eRT} - -\def\bRUBY - {\dosingleempty\dobRUBY} - -\def\dobRUBY[#1]% - {\begingroup - \iffirstargument - \setupruby[#1]% - \fi - \scratchdimen\lastskip - \ifdim\scratchdimen=\!!rubysignal\else\global\!!rubywidth\!!zeropoint\fi - \global\advance\!!rubycount\plusone - \xypos{rubyposition:\number\!!rubycount}% - \doifmodeelse\v!first - {\edef\rubyposition{\the\onepoint}}% - {\edef\rubyposition{\the\dimexpr\MPx{rubyposition:\number\!!rubycount}-\MPx{text:\the\realpageno}\relax}}} - -\def\eRUBY - {\setbox\scratchboxone\hbox{\redoconvertfont\doattributes\????rb\c!basestyle\c!basecolor{\the\!!rubybase}}% - \setbox\scratchboxtwo\hbox{\redoconvertfont\doattributes\????rb\c!textstyle\c!textcolor{\the\!!rubytext}}% - \scratchdimenone\wd\scratchboxone - \scratchdimentwo\wd\scratchboxtwo - %\scratchdimenthree\ifdim\scratchdimenone<\scratchdimentwo\space\scratchdimenone\else\scratchdimentwo\fi - \scratchdimenthree\scratchdimenone - \executeifdefined{\????rb:\c!align :\rubyparameter\c!align }{\getvalue{\????rb:\c!align :\v!auto }}% - \executeifdefined{\????rb:\c!position:\rubyparameter\c!position}{\getvalue{\????rb:\c!position:\v!before}}% - \executeifdefined{\????rb:\c!overhang:\rubyparameter\c!overhang}{\getvalue{\????rb:\c!overhang:\v!auto }}% - \hskip\!!rubysignal\relax - \endgroup} - -\def\bRB{\dodoubleempty\dobRB} -\def\bRT{\dodoubleempty\dobRT} - -\def\dobRB[#1][#2]#3\eRB{\!!rubybase{#3}} -\def\dobRT[#1][#2]#3\eRT{\!!rubytext{#3}} - -\def\placerubystrut{\doif{\rubyparameter\c!strut}\v!yes{\setstrut\strut}} - -%D Alignment - -\def\RUBYdistributespace #1{\processtokens{\hss }{\hss\hss}{\hss }{\hss\hss}{#1}} -\def\RUBYdistributeletter#1{\processtokens{\relax}{\hss }{\relax}{\hss\hss}{#1}} - -\setvalue{\????rb:\c!align:\v!space}% - {\!!rubyleftmargin \zeropoint - \!!rubyrightmargin\zeropoint - \ifdim\scratchdimenone>\scratchdimentwo - \setbox\scratchboxone\hbox to \scratchdimenone{\hss\box\scratchboxone\hss}% - \setbox\scratchboxtwo\hbox to \scratchdimenone{\redoconvertfont\doattributes\????rb\c!textstyle\c!textcolor{\@EA\RUBYdistributespace\@EA{\the\!!rubytext}}}% - \else - \setbox\scratchboxone\hbox to \scratchdimentwo{\redoconvertfont\doattributes\????rb\c!basestyle\c!basecolor{\@EA\RUBYdistributespace\@EA{\the\!!rubybase}}}% - \setbox\scratchboxtwo\hbox to \scratchdimentwo{\hss\box\scratchboxtwo\hss}% - \fi} - -\setvalue{\????rb:\c!align:\v!letter}% - {\!!rubyleftmargin \zeropoint - \!!rubyrightmargin\zeropoint - \ifdim\scratchdimenone>\scratchdimentwo - \setbox\scratchboxone\hbox to \scratchdimenone{\hss\box\scratchboxone\hss}% - \setbox\scratchboxtwo\hbox to \scratchdimenone{\redoconvertfont\doattributes\????rb\c!textstyle\c!textcolor{\@EA\RUBYdistributeletter\@EA{\the\!!rubytext}}}% - \else - \setbox\scratchboxone\hbox to \scratchdimentwo{\redoconvertfont\doattributes\????rb\c!basestyle\c!basecolor{\@EA\RUBYdistributeletter\@EA{\the\!!rubybase}}}% - \setbox\scratchboxtwo\hbox to \scratchdimentwo{\hss\box\scratchboxtwo\hss}% - \fi} - -\setvalue{\????rb:\c!align:\v!auto}% I need special alignments for the begin/end of the line!!! - {\ifdim\scratchdimenone>\scratchdimentwo - \getvalue{\????rb:\c!align:\v!space}% - \else - \ifdim\rubyposition=\!!zeropoint % begin of the line - \getvalue{\????rb:\c!align:\v!left}% - \else\ifdim\rubyposition=\the\dimexpr\textwidth-\scratchdimenthree\relax % end of the line - \getvalue{\????rb:\c!align:\v!right}% - \else - \getvalue{\????rb:\c!align:\v!space}% - \fi\fi - \fi} - -\setvalue{\????rb:\c!align:\v!left}% - {\ifdim\scratchdimenone>\scratchdimentwo - \!!rubyleftmargin \zeropoint - \!!rubyrightmargin\zeropoint - \else - \!!rubyleftmargin \zeropoint - \!!rubyrightmargin\dimexpr\scratchdimentwo-\scratchdimenone\relax - \fi - \setbox\scratchboxone\hbox to \scratchdimenthree{\box\scratchboxone\hss}% - \setbox\scratchboxtwo\hbox to \scratchdimenthree{\box\scratchboxtwo\hss}} - -\setvalue{\????rb:\c!align:\v!start}% - {\getvalue{\????rb:\c!align:\v!left}} - -\setvalue{\????rb:\c!align:\v!center}% - {\ifdim\scratchdimenone>\scratchdimentwo - \!!rubyleftmargin \zeropoint - \!!rubyrightmargin\zeropoint - \else - \!!rubyleftmargin \dimexpr(\scratchdimentwo-\scratchdimenone)/2\relax - \!!rubyrightmargin\dimexpr(\scratchdimentwo-\scratchdimenone)/2\relax - \fi - \setbox\scratchboxone\hbox to \scratchdimenthree{\hss\box\scratchboxone\hss}% - \setbox\scratchboxtwo\hbox to \scratchdimenthree{\hss\box\scratchboxtwo\hss}} - -\setvalue{\????rb:\c!align:\v!right}% - {\ifdim\scratchdimenone>\scratchdimentwo - \!!rubyleftmargin \zeropoint - \!!rubyrightmargin\zeropoint - \else - \!!rubyleftmargin \dimexpr\scratchdimentwo-\scratchdimenone\relax - \!!rubyrightmargin\zeropoint - \fi - \setbox\scratchboxone\hbox to \scratchdimenthree{\hss\box\scratchboxone}% - \setbox\scratchboxtwo\hbox to \scratchdimenthree{\hss\box\scratchboxtwo}} - -\setvalue{\????rb:\c!align:\v!end}% - {\getvalue{\v!ruby:\c!align:\v!right}} - -\setvalue{\????rb:\c!align:\v!edge}% modify to take care of overlap etc. - {\ifdim\rubyposition=\zeropoint - \getvalue{\????rb:\c!align:\v!left}% - \else\ifdim\rubyposition=\the\dimexpr\textwidth-\scratchdimenthree\relax - \getvalue{\????rb:\c!align:\v!right}% - \else - \getvalue{\????rb:\c!align:\v!center}% - \fi\fi} - -%D Positioning - -\setvalue{\????rb:\c!position:\v!before}% - {\setbox\scratchboxthree\vbox - {\offinterlineskip - \hbox{\undepthed{\placerubystrut\box\scratchboxtwo}} - \rubyparameter\c!inbetween - \hbox{\placerubystrut\box\scratchboxone}}} - -\setvalue{\????rb:\c!position:\v!after}% - {\setbox\scratchboxthree\vtop - {\offinterlineskip - \hbox{\undepthed{\placerubystrut\box\scratchboxone}} - \rubyparameter\c!inbetween - \hbox{\placerubystrut\box\scratchboxtwo}}} - -\setvalue{\????rb:\c!position:\v!inline}% pure text to allow line breaks in the text - {\setbox\scratchboxthree\box\voidbox - \!!rubyleftmargin \zeropoint - \!!rubyrightmargin\zeropoint - \the\!!rubybase - \rubyparameter\c!separator - \rubyparameter\c!lefttext\the\!!rubytext\rubyparameter\c!righttext} - -%D Overhang - -\setvalue{\????rb:\c!overhang:\v!auto}% - {\ifdim\!!rubywidth>\!!zeropoint - \kern\dimexpr\!!rubyleftmargin+\!!rubywidth\relax - \fi - \box\scratchboxthree - \global\!!rubywidth\!!rubyrightmargin} - -\setvalue{\????rb:\c!overhang:\v!start}% - {\box\scratchboxthree\kern\!!rubyrightmargin - \global\!!rubywidth\!!rubyrightmargin} - -\setvalue{\????rb:\c!overhang:\v!end}% - {\ifdim\!!rubywidth>\!!zeropoint - \kern\dimexpr\!!rubyleftmargin+\!!rubywidth\relax - \else - \kern\!!rubyleftmargin - \fi - \box\scratchboxthree - \global\!!rubywidth\!!zeropoint} - -\setvalue{\????rb:\c!overhang:\v!none}% - {\kern\!!rubyleftmargin\box\scratchboxthree\kern\!!rubyrightmargin - \global\!!rubywidth\!!zeropoint} - -%D \macros -%D {ruby} - -\def\ruby - {\dontleavehmode\dosingleempty\doruby} - -\def\doruby[#1]#2#3% - {\dobRUBY[#1]\bRB#2\eRB\bRT#3\eRT\eRUBY} - -%D Default values - -\setupruby - [\c!position=\v!before, % before|after|inline - \c!align=\v!auto, % auto|start|left|center|end|right|distribute-letter|distribute-space|line-edge - \c!overhang=\v!auto, % auto|start|end|none - \c!separator={ }, - \c!lefttext=(, - \c!righttext=), - \c!strut=\v!no, - \c!inbetween={\blank[\v!small]}, - \c!textstyle=\txx] - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/third/ruby/t-ruby.mkiv b/Master/texmf-dist/tex/context/third/ruby/t-ruby.mkiv deleted file mode 100644 index d90330a41b1..00000000000 --- a/Master/texmf-dist/tex/context/third/ruby/t-ruby.mkiv +++ /dev/null @@ -1,283 +0,0 @@ -%D \module -%D [ file=t-ruby, -%D version=2010.11.23, -%D title=\CONTEXT\ User Module, -%D subtitle=Ruby Markup, -%D author=Wolfgang Schuster, -%D date=\currentdate, -%D copyright=Wolfgang Schuster, -%D email=schuster.wolfgang@googlemail.com, -%D license=Public Domain] - -\writestatus{loading}{ConTeXt User Module / Ruby Markup} - -\unprotect - -%D simple ruby: -%D -%D \starttyping -%D <ruby> -%D <rb>WWW</rb> -%D <rt>World Wide Web</rt> -%D </ruby> -%D \stoptyping -%D -%D complex ruby: -%D -%D \starttyping -%D <ruby> -%D <rbc> -%D <rb>10</rb> -%D <rb>31</rb> -%D <rb>2002</rb> -%D </rbc> -%D <rtc> -%D <rt>Month</rt> -%D <rt>Day</rt> -%D <rt>Year</rt> -%D </rtc> -%D <rtc> -%D <rt rbspan="3">Expiration Date</rt> -%D </rtc> -%D </ruby> -%D \stoptyping - -%D Constants/variables - -\startinterface all - \setinterfaceconstant {basestyle} {basestyle} - \setinterfaceconstant {basecolor} {basecolor} - \setinterfaceconstant {overhang} {overhang} -\stopinterface - -\startinterface all - \setinterfacevariable {letter} {letter} - \setinterfacevariable {end} {end} - \setinterfacevariable {inline} {inline} -\stopinterface - -%D Namespace - -\def\????rb{@@@@rb} - -%D Additional registers - -\newdimen \!!rubywidth -\newdimen \!!rubyleftmargin -\newdimen \!!rubyrightmargin -\newsignal\!!rubysignal -\newcount \!!rubycount -\newtoks \!!rubybase -\newtoks \!!rubytext - -%D \macros -%D {setupruby} - -\def\setupruby - {\dodoubleargument\getparameters[\????rb]} - -\def\rubyparameter#1{\csname\????rb#1\endcsname} - -%D \macros -%D {bRUBY,eRUBY,bRB,eRB,bRT,eRT} - -\def\bRUBY - {\dosingleempty\dobRUBY} - -\def\dobRUBY[#1]% - {\begingroup - \iffirstargument - \setupruby[#1]% - \fi - \scratchdimen\lastskip - \ifdim\scratchdimen=\!!rubysignal\else\global\!!rubywidth\!!zeropoint\fi - \global\advance\!!rubycount\plusone - \xypos{rubyposition:\number\!!rubycount}% - \doifmodeelse\v!first - {\edef\rubyposition{\the\onepoint}}% - {\edef\rubyposition{\the\dimexpr\MPx{rubyposition:\number\!!rubycount}-\MPx{text:\the\realpageno}\relax}}} - -\def\eRUBY - {\setbox\scratchboxone\hbox{\redoconvertfont\doattributes\????rb\c!basestyle\c!basecolor{\the\!!rubybase}}% - \setbox\scratchboxtwo\hbox{\redoconvertfont\doattributes\????rb\c!textstyle\c!textcolor{\the\!!rubytext}}% - \scratchdimenone\wd\scratchboxone - \scratchdimentwo\wd\scratchboxtwo - %\scratchdimenthree\ifdim\scratchdimenone<\scratchdimentwo\space\scratchdimenone\else\scratchdimentwo\fi - \scratchdimenthree\scratchdimenone - \executeifdefined{\????rb:\c!align :\rubyparameter\c!align }{\getvalue{\????rb:\c!align :\v!auto }}% - \executeifdefined{\????rb:\c!position:\rubyparameter\c!position}{\getvalue{\????rb:\c!position:\v!before}}% - \executeifdefined{\????rb:\c!overhang:\rubyparameter\c!overhang}{\getvalue{\????rb:\c!overhang:\v!auto }}% - \hskip\!!rubysignal\relax - \endgroup} - -\def\bRB{\dodoubleempty\dobRB} -\def\bRT{\dodoubleempty\dobRT} - -\def\dobRB[#1][#2]#3\eRB{\!!rubybase{#3}} -\def\dobRT[#1][#2]#3\eRT{\!!rubytext{#3}} - -\def\placerubystrut{\doif{\rubyparameter\c!strut}\v!yes{\setstrut\strut}} - -%D Alignment - -\def\RUBYdistributespace #1{\processtokens{\hss }{\hss\hss}{\hss }{\hss\hss}{#1}} -\def\RUBYdistributeletter#1{\processtokens{\relax}{\hss }{\relax}{\hss\hss}{#1}} - -\setvalue{\????rb:\c!align:\v!space}% - {\!!rubyleftmargin \zeropoint - \!!rubyrightmargin\zeropoint - \ifdim\scratchdimenone>\scratchdimentwo - \setbox\scratchboxone\hbox to \scratchdimenone{\hss\box\scratchboxone\hss}% - \setbox\scratchboxtwo\hbox to \scratchdimenone{\redoconvertfont\doattributes\????rb\c!textstyle\c!textcolor{\@EA\RUBYdistributespace\@EA{\the\!!rubytext}}}% - \else - \setbox\scratchboxone\hbox to \scratchdimentwo{\redoconvertfont\doattributes\????rb\c!basestyle\c!basecolor{\@EA\RUBYdistributespace\@EA{\the\!!rubybase}}}% - \setbox\scratchboxtwo\hbox to \scratchdimentwo{\hss\box\scratchboxtwo\hss}% - \fi} - -\setvalue{\????rb:\c!align:\v!letter}% - {\!!rubyleftmargin \zeropoint - \!!rubyrightmargin\zeropoint - \ifdim\scratchdimenone>\scratchdimentwo - \setbox\scratchboxone\hbox to \scratchdimenone{\hss\box\scratchboxone\hss}% - \setbox\scratchboxtwo\hbox to \scratchdimenone{\redoconvertfont\doattributes\????rb\c!textstyle\c!textcolor{\@EA\RUBYdistributeletter\@EA{\the\!!rubytext}}}% - \else - \setbox\scratchboxone\hbox to \scratchdimentwo{\redoconvertfont\doattributes\????rb\c!basestyle\c!basecolor{\@EA\RUBYdistributeletter\@EA{\the\!!rubybase}}}% - \setbox\scratchboxtwo\hbox to \scratchdimentwo{\hss\box\scratchboxtwo\hss}% - \fi} - -\setvalue{\????rb:\c!align:\v!auto}% I need special alignments for the begin/end of the line!!! - {\ifdim\scratchdimenone>\scratchdimentwo - \getvalue{\????rb:\c!align:\v!space}% - \else - \ifdim\rubyposition=\!!zeropoint % begin of the line - \getvalue{\????rb:\c!align:\v!left}% - \else\ifdim\rubyposition=\the\dimexpr\textwidth-\scratchdimenthree\relax % end of the line - \getvalue{\????rb:\c!align:\v!right}% - \else - \getvalue{\????rb:\c!align:\v!space}% - \fi\fi - \fi} - -\setvalue{\????rb:\c!align:\v!left}% - {\ifdim\scratchdimenone>\scratchdimentwo - \!!rubyleftmargin \zeropoint - \!!rubyrightmargin\zeropoint - \else - \!!rubyleftmargin \zeropoint - \!!rubyrightmargin\dimexpr\scratchdimentwo-\scratchdimenone\relax - \fi - \setbox\scratchboxone\hbox to \scratchdimenthree{\box\scratchboxone\hss}% - \setbox\scratchboxtwo\hbox to \scratchdimenthree{\box\scratchboxtwo\hss}} - -\setvalue{\????rb:\c!align:\v!start}% - {\getvalue{\????rb:\c!align:\v!left}} - -\setvalue{\????rb:\c!align:\v!center}% - {\ifdim\scratchdimenone>\scratchdimentwo - \!!rubyleftmargin \zeropoint - \!!rubyrightmargin\zeropoint - \else - \!!rubyleftmargin \dimexpr(\scratchdimentwo-\scratchdimenone)/2\relax - \!!rubyrightmargin\dimexpr(\scratchdimentwo-\scratchdimenone)/2\relax - \fi - \setbox\scratchboxone\hbox to \scratchdimenthree{\hss\box\scratchboxone\hss}% - \setbox\scratchboxtwo\hbox to \scratchdimenthree{\hss\box\scratchboxtwo\hss}} - -\setvalue{\????rb:\c!align:\v!right}% - {\ifdim\scratchdimenone>\scratchdimentwo - \!!rubyleftmargin \zeropoint - \!!rubyrightmargin\zeropoint - \else - \!!rubyleftmargin \dimexpr\scratchdimentwo-\scratchdimenone\relax - \!!rubyrightmargin\zeropoint - \fi - \setbox\scratchboxone\hbox to \scratchdimenthree{\hss\box\scratchboxone}% - \setbox\scratchboxtwo\hbox to \scratchdimenthree{\hss\box\scratchboxtwo}} - -\setvalue{\????rb:\c!align:\v!end}% - {\getvalue{\v!ruby:\c!align:\v!right}} - -\setvalue{\????rb:\c!align:\v!edge}% modify to take care of overlap etc. - {\ifdim\rubyposition=\zeropoint - \getvalue{\????rb:\c!align:\v!left}% - \else\ifdim\rubyposition=\the\dimexpr\textwidth-\scratchdimenthree\relax - \getvalue{\????rb:\c!align:\v!right}% - \else - \getvalue{\????rb:\c!align:\v!center}% - \fi\fi} - -%D Positioning - -\setvalue{\????rb:\c!position:\v!before}% - {\setbox\scratchboxthree\vbox - {\offinterlineskip - \hbox{\undepthed{\placerubystrut\box\scratchboxtwo}} - \rubyparameter\c!inbetween - \hbox{\placerubystrut\box\scratchboxone}}} - -\setvalue{\????rb:\c!position:\v!after}% - {\setbox\scratchboxthree\vtop - {\offinterlineskip - \hbox{\undepthed{\placerubystrut\box\scratchboxone}} - \rubyparameter\c!inbetween - \hbox{\placerubystrut\box\scratchboxtwo}}} - -\setvalue{\????rb:\c!position:\v!inline}% pure text to allow line breaks in the text - {\setbox\scratchboxthree\box\voidbox - \!!rubyleftmargin \zeropoint - \!!rubyrightmargin\zeropoint - \the\!!rubybase - \rubyparameter\c!separator - \rubyparameter\c!lefttext\the\!!rubytext\rubyparameter\c!righttext} - -%D Overhang - -\setvalue{\????rb:\c!overhang:\v!auto}% - {\ifdim\!!rubywidth>\!!zeropoint - \kern\dimexpr\!!rubyleftmargin+\!!rubywidth\relax - \fi - \box\scratchboxthree - \global\!!rubywidth\!!rubyrightmargin} - -\setvalue{\????rb:\c!overhang:\v!start}% - {\box\scratchboxthree\kern\!!rubyrightmargin - \global\!!rubywidth\!!rubyrightmargin} - -\setvalue{\????rb:\c!overhang:\v!end}% - {\ifdim\!!rubywidth>\!!zeropoint - \kern\dimexpr\!!rubyleftmargin+\!!rubywidth\relax - \else - \kern\!!rubyleftmargin - \fi - \box\scratchboxthree - \global\!!rubywidth\!!zeropoint} - -\setvalue{\????rb:\c!overhang:\v!none}% - {\kern\!!rubyleftmargin\box\scratchboxthree\kern\!!rubyrightmargin - \global\!!rubywidth\!!zeropoint} - -%D \macros -%D {ruby} - -\def\ruby - {\dontleavehmode\dosingleempty\doruby} - -\def\doruby[#1]#2#3% - {\pdfactualtext - {\dobRUBY[#1]\bRB#2\eRB\bRT#3\eRT\eRUBY} - {#2\rubyparameter\c!separator\rubyparameter\c!lefttext#3\rubyparameter\c!righttext}} - -%D Default values - -\setupruby - [\c!position=\v!before, % before|after|inline - \c!align=\v!auto, % auto|start|left|center|end|right|distribute-letter|distribute-space|line-edge - \c!overhang=\v!auto, % auto|start|end|none - \c!separator={ }, - \c!lefttext=(, - \c!righttext=), - \c!strut=\v!no, - \c!inbetween={\blank[\v!small]}, - \c!textstyle=\txx] - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/third/ruby/t-ruby.mkvi b/Master/texmf-dist/tex/context/third/ruby/t-ruby.mkvi deleted file mode 100644 index 21f6ae9a221..00000000000 --- a/Master/texmf-dist/tex/context/third/ruby/t-ruby.mkvi +++ /dev/null @@ -1,393 +0,0 @@ -%D \module -%D [ file=t-ruby, -%D version=2012.12.01, -%D title=\CONTEXT\ User Module, -%D subtitle=Ruby Markup, -%D author=Wolfgang Schuster, -%D date=\currentdate, -%D copyright=Wolfgang Schuster, -%D email=schuster.wolfgang@googlemail.com, -%D license=Public Domain] - -\writestatus{loading}{ConTeXt User Module / Ruby Markup} - -\unprotect - -%D simple ruby: -%D -%D \starttyping -%D <ruby> -%D <rb>WWW</rb> -%D <rt>World Wide Web</rt> -%D </ruby> -%D \stoptyping -%D -%D complex ruby: -%D -%D \starttyping -%D <ruby> -%D <rbc> -%D <rb>10</rb> -%D <rb>31</rb> -%D <rb>2002</rb> -%D </rbc> -%D <rtc> -%D <rt>Month</rt> -%D <rt>Day</rt> -%D <rt>Year</rt> -%D </rtc> -%D <rtc> -%D <rt rbspan="3">Expiration Date</rt> -%D </rtc> -%D </ruby> -%D \stoptyping - -%D Constants/variables - -\startinterface all - \setinterfaceconstant {basestyle} {basestyle} - \setinterfaceconstant {basecolor} {basecolor} - \setinterfaceconstant {rubybase} {rubybase} - \setinterfaceconstant {rubytext} {rubytext} -\stopinterface - -\startinterface all - \setinterfacevariable {letter} {letter} -\stopinterface - -%D Lua - -\startluacode - -thirddata = thirddata or { } -thirddata.ruby = thirddata.ruby or { } - -function thirddata.ruby.doifelsecjk(string) - local state = true - for c in unicode.utf8.gmatch(string,".") do - local n = scripts.hash[utf.byte(c)] - if not ( n == "chinese" or n == "korean" ) then - state = false - break - end - end - commands.doifelse(state) -end - -\stopluacode - -%D Namespace - -\installnamespace {ruby} -\installnamespace {rubyalign} -\installnamespace {rubyalternative} -\installnamespace {rubyhang} - -%D Additional registers - -\newdimen \d_ruby_width -\newdimen \d_ruby_left -\newdimen \d_ruby_right -\newdimen \d_ruby_position - -\newsignal \s_ruby_signal - -\newcount \c_ruby_n - -\newtoks \t_ruby_base -\newtoks \t_ruby_text - -\newbox \b_ruby_base -\newbox \b_ruby_text -\newbox \b_ruby_box - -%D \macros -%D {defineruby,setupruby} - -\installcommandhandler \????ruby {ruby} \????ruby - -%D \macros -%D {ruby} - -\unexpanded\def\ruby - {\dontleavehmode - \begingroup - \let\currentruby\empty - \dosingleempty\ruby_direct_indeed} - -\unexpanded\def\ruby_direct#name% - {\dontleavehmode - \begingroup - \edef\currentruby{#name}% - \dosingleempty\ruby_direct_indeed} - -\def\ruby_direct_indeed[#parameters]#rubybase#rubytext% - {\setupcurrentruby[#parameters,\c!rubybase={#rubybase},\c!rubytext={#rubytext}]% - % - \scratchdimen\lastskip - \ifdim\scratchdimen=\s_ruby_signal\else\global\d_ruby_width\zeropoint\fi - % - \global\advance\c_ruby_n\plusone - % - \xypos{rubyposition:\number\c_ruby_n}% - \doifmodeelse\v!first - {\d_ruby_position\onepoint} - {\d_ruby_position\dimexpr\MPx{rubyposition:\number\c_ruby_n}-\MPx{text:\number\realpageno}\relax}% - % - \setbox\b_ruby_base\hbox{\userubystyleandcolor\c!basestyle\c!basecolor\directrubyparameter\c!rubybase}% - \setbox\b_ruby_text\hbox{\userubystyleandcolor\c!textstyle\c!textcolor\directrubyparameter\c!rubytext}% - % - \edef\p_ruby_align {\rubyparameter\c!align }% - \edef\p_ruby_alternative{\rubyparameter\c!alternative}% - \edef\p_ruby_hang {\rubyparameter\c!hang }% - % - \ruby_align - \ruby_alternative - \ruby_hang - % - \hskip\s_ruby_signal\relax - \endgroup} - -\appendtoks - \setuevalue\currentruby{\ruby_direct{\currentruby}}% -\to \everydefineruby - -%D Alignment -%D -%D \startitemize[packed] -%D \item left -%D \item middle -%D \item right -%D \item auto -%D \item letter -%D \item space -%D \stopitemize - -\unexpanded\def\ruby_distribute_space #1{\processtokens{\hss }{\hss\hss}{\hss }{\hss\hss}{#1}} -\unexpanded\def\ruby_distribute_letter#1{\processtokens{\relax}{\hss }{\relax}{\hss\hss}{#1}} - -\def\ruby_align_stretch - {\d_ruby_left \zeropoint - \d_ruby_right\zeropoint - \ifdim\wd\b_ruby_base>\wd\b_ruby_text - \setbox\b_ruby_base\hbox to \wd\b_ruby_base{\hss\box\b_ruby_base\hss}% - \setbox\b_ruby_text\hbox to \wd\b_ruby_base{\userubystyleandcolor\c!textstyle\c!textcolor\normalexpanded{\ruby_distribute_space{\directrubyparameter\c!rubytext}}}% - \else - \setbox\b_ruby_base\hbox to \wd\b_ruby_text{\userubystyleandcolor\c!basestyle\c!basecolor\normalexpanded{\ruby_distribute_space{\directrubyparameter\c!rubybase}}}% - \setbox\b_ruby_text\hbox to \wd\b_ruby_text{\hss\box\b_ruby_text\hss}% - \fi} - -\def\ruby_align_letter - {\d_ruby_left \zeropoint - \d_ruby_right\zeropoint - \ifdim\wd\b_ruby_base>\wd\b_ruby_test - \setbox\b_ruby_base\hbox to \wd\b_ruby_base{\hss\box\b_ruby_base\hss}% - \setbox\b_ruby_text\hbox to \wd\b_ruby_base{\userubystyleandcolor\c!textstyle\c!textcolor\normalexpanded{\ruby_distribute_letter{\directrubyparameter\c!rubytext}}}% - \else - \setbox\b_ruby_base\hbox to \wd\b_ruby_text{\userubystyleandcolor\c!basestyle\c!basecolor\normalexpanded{\ruby_distribute_letter{\directrubyparameter\c!rubybase}}}% - \setbox\b_ruby_text\hbox to \wd\b_ruby_text{\hss\box\b_ruby_text\hss}% - \fi} - -\def\ruby_align_auto - {\ifdim\wd\b_ruby_base>\wd\b_ruby_text - \ctxlua{thirddata.ruby.doifelsecjk("\directrubyparameter\c!rubybase")}\donetrue\donefalse - \ifdone - \ruby_align_stretch - \else - \ruby_align_middle - \fi - \else - \ifdim\d_ruby_position=\zeropoint % begin of the line - \ruby_align_left - \else\ifdim\d_ruby_position=\dimexpr\textwidth-\wd\b_ruby_base\relax % end of the line - \ruby_align_right - \else - \ctxlua{thirddata.ruby.doifelsecjk("\directrubyparameter\c!rubytext")}\donetrue\donefalse - \ifdone - \ruby_align_stretch - \else - \ruby_align_middle - \fi - \fi\fi - \fi} - -\def\ruby_align_left - {\ifdim\wd\b_ruby_base>\wd\b_ruby_text - \d_ruby_left \zeropoint - \d_ruby_right\zeropoint - \else - \d_ruby_left \zeropoint - \d_ruby_right\dimexpr\wd\b_ruby_text-\wd\b_ruby_base\relax - \fi - \setbox\b_ruby_base\hbox to \wd\b_ruby_base{\box\b_ruby_base\hss}% - \setbox\b_ruby_text\hbox to \wd\b_ruby_base{\box\b_ruby_text\hss}} - -\def\ruby_align_middle - {\ifdim\wd\b_ruby_base>\wd\b_ruby_text - \d_ruby_left \zeropoint - \d_ruby_right\zeropoint - \else - \d_ruby_left \dimexpr(\wd\b_ruby_text-\wd\b_ruby_base)/2\relax - \d_ruby_right\dimexpr(\wd\b_ruby_text-\wd\b_ruby_base)/2\relax - \fi - \setbox\b_ruby_base\hbox to \wd\b_ruby_base{\hss\box\b_ruby_base\hss}% - \setbox\b_ruby_text\hbox to \wd\b_ruby_base{\hss\box\b_ruby_text\hss}} - -\def\ruby_align_right - {\ifdim\wd\b_ruby_base>\wd\b_ruby_base - \d_ruby_left \zeropoint - \d_ruby_right\zeropoint - \else - \d_ruby_left \dimexpr\wd\b_ruby_text-\wd\b_ruby_base\relax - \d_ruby_right\zeropoint - \fi - \setbox\b_ruby_base\hbox to \wd\b_ruby_base{\hss\box\b_ruby_base}% - \setbox\b_ruby_text\hbox to \wd\b_ruby_base{\hss\box\b_ruby_text}} - -\def\ruby_align_margin - {\ifdim\d_ruby_position=\zeropoint - \ruby_align_left - \else\ifdim\d_ruby_position=\dimexpr\textwidth-\wd\b_ruby_base\relax - \ruby_align_right - \else - \ruby_align_middle - \fi\fi} - -\def\ruby_align - {\csname\????rubyalign - \ifcsname\????rubyalign\p_ruby_align\endcsname\p_ruby_align\else\v!auto\fi - \endcsname} - -\setvalue{\????rubyalign\v!auto }{\ruby_align_auto } -\setvalue{\????rubyalign\v!left }{\ruby_align_left } -\setvalue{\????rubyalign\v!right }{\ruby_align_right } -\setvalue{\????rubyalign\v!middle }{\ruby_align_middle } -\setvalue{\????rubyalign\v!letter }{\ruby_align_letter } -\setvalue{\????rubyalign\v!stretch}{\ruby_align_stretch} -\setvalue{\????rubyalign\v!margin }{\ruby_align_margin } - -%D Alternative -%D -%D \startitemize[packed] -%D \item top -%D \item bottom -%D \item text -%D \stopitemize - -% \setvalue{\????rubyalternative\v!none}% needed for \pdfactualtext -% {\directrubyparameter\c!rubybase -% \rubyparameter\c!separator -% \rubyparameter\c!lefttext -% \directrubyparameter\c!rubytext -% \rubyparameter\c!righttext} - -\def\ruby_alternative_top - {\setbox\b_ruby_box\vbox - {\doifsomething{\rubyparameter\c!strut}{\setupstrut[\rubyparameter\c!strut]}% - \offinterlineskip - \hbox{\undepthed{\begstrut\box\b_ruby_text\endstrut}} - \rubyparameter\c!inbetween - \hbox{\begstrut\box\b_ruby_base\endstrut}}} - -\def\ruby_alternative_bottom - {\setbox\b_ruby_box\vtop - {\doifsomething{\rubyparameter\c!strut}{\setupstrut[\rubyparameter\c!strut]}% - \offinterlineskip - \hbox{\undepthed{\begstrut\box\b_ruby_base\endstrut}} - \rubyparameter\c!inbetween - \hbox{\begstrut\box\b_ruby_text\endstrut}}} - -\def\ruby_alternative_text - {\setbox\b_ruby_box\box\voidbox - \d_ruby_left \zeropoint - \d_ruby_right\zeropoint - \directrubyparameter\c!rubybase - \rubyparameter\c!separator - \rubyparameter\c!lefttext\directrubyparameter\c!rubytext\rubyparameter\c!righttext} - -\unexpanded\def\ruby_alternative_vertical_process#text% - {\setbox\scratchbox\vbox - {\userubystyleandcolor\c!textstyle\c!textcolor - \setupinterlinespace[\rubyparameter\c!interlinespace]% - \handletokens#text\with\hbox - \par}% - \lower\dimexpr(\ht\scratchbox+\strutdp-\strutht)/2-\rubyparameter\c!dy\relax\box\scratchbox} - -\def\ruby_alternative_vertical - {\d_ruby_left \zeropoint - \d_ruby_right\zeropoint - \setbox\b_ruby_box\hbox\bgroup - \begingroup - \userubystyleandcolor\c!basestyle\c!basecolor - \directrubyparameter\c!rubybase - \endgroup - \normalexpanded{\ruby_alternative_vertical_process{\directrubyparameter\c!rubytext}}% - \egroup} - -\def\ruby_alternative - {\csname\????rubyalternative - \ifcsname\????rubyalternative\p_ruby_alternative\endcsname\p_ruby_alternative\else\v!text\fi - \endcsname} - -\setvalue{\????rubyalternative\v!top }{\ruby_alternative_top } -\setvalue{\????rubyalternative\v!bottom}{\ruby_alternative_bottom} -\setvalue{\????rubyalternative\v!text }{\ruby_alternative_text } - -%D Overhang -%D -%D \startitemize[packed] -%D \item left -%D \item right -%D \item auto -%D \item none -%D \stopitemize - -\def\ruby_hang_auto - {\ifdim\d_ruby_width>\zeropoint - \kern\dimexpr\d_ruby_left+\d_ruby_width\relax - \fi - \box\b_ruby_box - \global\d_ruby_width\d_ruby_right} - -\def\ruby_hang_left - {\box\b_ruby_box\kern\d_ruby_right - \global\d_ruby_width\d_ruby_right} - -\def\ruby_hang_right - {\ifdim\d_ruby_width>\zeropoint - \kern\dimexpr\d_ruby_left+\d_ruby_width\relax - \else - \kern\d_ruby_left - \fi - \box\b_ruby_box - \global\d_ruby_width\zeropoint} - -\def\ruby_hang_none - {\kern\d_ruby_left\box\b_ruby_box\kern\d_ruby_right - \global\d_ruby_width\zeropoint} - -\def\ruby_hang - {\csname\????rubyhang - \ifcsname\????rubyhang\p_ruby_hang\endcsname\p_ruby_hang\else\v!auto\fi - \endcsname} - -\setvalue{\????rubyhang\v!auto }{\ruby_hang_auto } -\setvalue{\????rubyhang\v!left }{\ruby_hang_left } -\setvalue{\????rubyhang\v!right}{\ruby_hang_right} -\setvalue{\????rubyhang\v!none }{\ruby_hang_none } - -%D Default values - -\setupruby - [\c!alternative=\v!top, - \c!align=\v!auto, - \c!hang=\v!auto, - \c!dy=\zeropoint, - \c!separator={ }, - \c!lefttext={(}, - \c!righttext={)}, - \c!strut=\v!no, - \c!inbetween={\blank[\v!small]}, - \c!textstyle=\txx] - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.lua b/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.lua deleted file mode 100644 index 5c53164fcc4..00000000000 --- a/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.lua +++ /dev/null @@ -1,228 +0,0 @@ -if not modules then modules = { } end modules ['t-simplefonts'] = { - version = 1.000, - comment = "Simplefonts", - author = "Wolfgang Schuster", - copyright = "Wolfgang Schuster", - email = "schuster.wolfgang@googlemail.com", - license = "GNU General Public License" -} - -local texsprint, ctxcatcodes, prtcatcodes, format, lower, gsub, find = tex.sprint, tex.ctxcatcodes, tex.prtcatcodes, string.format, string.lower, string.gsub, string.find - -thirddata = thirddata or { } -thirddata.simplefonts = thirddata.simplefonts or { } - -local simplefonts = thirddata.simplefonts - -simplefonts.fontlist = simplefonts.fontlist or { } -simplefonts.extlist = simplefonts.extlist or { } -simplefonts.features = simplefonts.features or { } -simplefonts.scripts = simplefonts.scripts or { } -simplefonts.languages = simplefonts.languages or { } - -simplefonts.fontlist = { - ["hiraginokakugothicpro"] = -- Hiragino Kaku Gothic Pro - { - ["normal"] = - { - regular = "hirakakuprow3" , - italic = "hirakakuprow3" , - bold = "hirakakuprow6" , - bolditalic = "hirakakuprow6" , - } , - } , - ["hiraginokakugothicpron"] = -- Hiragino Kaku Gothic ProN - { - ["normal"] = - { - regular = "hirakakupronw3" , - italic = "hirakakupronw3" , - bold = "hirakakupronw6" , - bolditalic = "hirakakupronw6" , - } , - } , - ["hiraginokakugothicstd"] = -- Hiragino Kaku Gothic Std - { - ["normal"] = - { - regular = "hirakakustdw8" , - italic = "hirakakustdw8" , - bold = "hirakakustdw8" , - bolditalic = "hirakakustdw8" , - } , - } , - ["hiraginokakugothicstdn"] = -- Hiragino Kaku Gothic StdN - { - ["normal"] = - { - regular = "hirakakustdnw8" , - italic = "hirakakustdnw8" , - bold = "hirakakustdnw8" , - bolditalic = "hirakakustdnw8" , - } , - } , - ["hiraginomarugothicpro"] = -- Hiragino Maru Gothic Pro - { - ["normal"] = - { - regular = "hiramaruprow4" , - italic = "hiramaruprow4" , - bold = "hiramaruprow4" , - bolditalic = "hiramaruprow4" , - } , - } , - ["hiraginomarugothicpron"] = -- Hiragino Maru Gothic ProN - { - ["normal"] = - { - regular = "hiramarupronw4" , - italic = "hiramarupronw4" , - bold = "hiramarupronw4" , - bolditalic = "hiramarupronw4" , - } , - } , - ["hiraginominchopro"] = -- Hiragino Mincho Pro - { - ["normal"] = - { - regular = "hiraminprow3" , - italic = "hiraminprow3" , - bold = "hiraminprow6" , - bolditalic = "hiraminprow6" , - } , - } , - ["hiraginominchopron"] = -- Hiragino Mincho ProN - { - ["normal"] = - { - regular = "hiraminpronw3" , - italic = "hiraminpronw3" , - bold = "hiraminpronw6" , - bolditalic = "hiraminpronw6" , - } , - } , - ["latinmodernmono"] = -- Latin Modern Mono - { - ["normal"] = - { - regular = "lmmono10regular" , - bold = "lmmonolt10bold" , - italic = "lmmono10italic" , - slanted = "lmmono10italic" , - bolditalic = "lmmonolt10boldoblique" , - boldslanted = "lmmonolt10boldoblique" , - caps = "lmmonocaps10regular" , - slantedcaps = "lmmonocaps10oblique" , - } , - } , - ["latinmodernroman"] = -- Latin Modern Roman - { - ["normal"] = - { - regular = "lmroman10regular" , - bold = "lmroman10bold" , - italic = "lmroman10italic" , - slanted = "lmromanslant10regular" , - bolditalic = "lmroman10bolditalic" , - boldslanted = "lmromanslant10bold" , - caps = "lmromancaps10regular" , - slantedcaps = "lmromancaps10oblique" , - } , - } , - ["latinmodernsans"] = -- Latin Modern Sans - { - ["normal"] = - { - regular = "lmsans10regular" , - bold = "lmsans10bold" , - italic = "lmsans10oblique" , - slanted = "lmsans10oblique" , - bolditalic = "lmsans10boldoblique" , - boldslanted = "lmsans10boldoblique" , - } , - } , -} - -function simplefonts.selectfont(font,name,extension,style,weight) - local fontname = {} - local truename = name - local name = lower(gsub(name,"[^a-zA-Z0-9]","")) - if extension ~= "" then - ext = find(extension,"*") - if ext ~= nil then - fontname = gsub(extension,"*",name) - else - fontname = extension - end - fontname = "name:" .. lower(gsub(fontname,"[^a-zA-Z0-9]","")) - else - if string.match(truename,"file:") then -- can't i check for 'file:' and 'name:' with one string.match? - fontname = truename - elseif string.match(truename,"name:") then - fontname = truename - elseif simplefonts.fontlist[name] then - if simplefonts.fontlist[name][weight] then - if simplefonts.fontlist[name][weight][style] then - fontname = simplefonts.fontlist[name][weight][style] - else - fontname = simplefonts.fontlist[name][weight]["regular"] - end - elseif simplefonts.fontlist[name]["normal"] then - if simplefonts.fontlist[name]["normal"][style] then - fontname = simplefonts.fontlist[name]["normal"][style] - else - fontname = simplefonts.fontlist[name]["normal"]["regular"] - end - end - fontname = "name:" .. fontname - else - -- use comma list - for _, v in ipairs(simplefonts.extlist[weight][style]) do - fontname = name .. v - if global.fonts.names.exists(fontname) then - fontname = "name:" .. fontname - break - else - --~ interfaces.showmessage("simplefonts","1",fontname) -- wrong place - fontname = "DefaultFont" -- no font is found - end - end - end - end - --~ print(fontname) - if fontname == "DefaultFont" then - interfaces.showmessage("simplefonts","1",name) - end - texsprint(prtcatcodes,format("\\setvalue{\\????sf %s%s}{%s}",font,style,fontname)) -end - -function simplefonts.normalizefontname(name) - local fontname = lower(gsub(name,"[^a-zA-Z0-9]","")) -- remove spaces and hyphens etc. from the user specified name - texsprint(ctxcatcodes,fontname) -end - -function simplefonts.parameter(key,value,list) - local feature = simplefonts.features [key] - local script = simplefonts.scripts [value] - local language = simplefonts.languages [value] - if feature then - texsprint(format("\\addvalue{%s}{%s=%s}",list,feature,value)) - --~ print("feature: " .. feature .. " = " .. value) - else - if key == "script" then - if script then - texsprint(format("\\addvalue{%s}{%s=%s}",list,key,script)) - --~ print("script: " script) - else - interfaces.showmessage("simplefonts","4",value) - end - elseif key == "language" then - if language then - texsprint(format("\\addvalue{%s}{%s=%s}",list,key,language)) - --~ print("language: " language) - else - interfaces.showmessage("simplefonts","5",value) - end - end - end -end diff --git a/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.mkii b/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.mkii deleted file mode 100644 index 67e7774d6b7..00000000000 --- a/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.mkii +++ /dev/null @@ -1,400 +0,0 @@ -%D \module -%D [ file=t-simplefonts, -%D version=2009.11.08, -%D title=\CONTEXT\ User Module, -%D subtitle=Simplefonts, -%D author=Wolfgang Schuster, -%D date=\currentdate, -%D copyright=Wolfgang Schuster, -%D email=schuster.wolfgang@googlemail.com, -%D license=Public Domain] - -\writestatus{loading}{ConTeXt User Module / Simplefonts} - -\unprotect - -\startmodule[simplefonts] - -%D Constants and variables - -\startinterface all - \setinterfaceconstant {regular} {regular} - \setinterfaceconstant {italic} {italic} - \setinterfaceconstant {slanted} {slanted} - \setinterfaceconstant {bold} {bold} - \setinterfaceconstant {bolditalic} {bolditalic} - \setinterfaceconstant {boldslanted} {boldslanted} - \setinterfaceconstant {caps} {caps} - \setinterfaceconstant {scale} {scale} - \setinterfaceconstant {features} {features} - \setinterfaceconstant {regularfont} {regularfont} - \setinterfaceconstant {italicfont} {italicfont} - \setinterfaceconstant {slantedfont} {slantedfont} - \setinterfaceconstant {boldfont} {boldfont} - \setinterfaceconstant {bolditalicfont} {bolditalicfont} - \setinterfaceconstant {boldslantedfont} {boldslantedfont} - \setinterfaceconstant {capsfont} {capsfont} - \setinterfaceconstant {regularfeatures} {regularfeatures} - \setinterfaceconstant {italicfeatures} {italicfeatures} - \setinterfaceconstant {slantedfeatures} {slantedfeatures} - \setinterfaceconstant {boldfeatures} {boldfeatures} - \setinterfaceconstant {bolditalicfeatures} {bolditalicfeatures} - \setinterfaceconstant {boldslantedfeatures} {boldslantedfeatures} - \setinterfaceconstant {smallcapsfeatures} {smallcapsfeatures} - \setinterfaceconstant {capsfeatures} {capsfeatures} - \setinterfaceconstant {typeface} {typeface} -\stopinterface - -\startinterface all - \setinterfacevariable {simplefonts} {simplefonts} - \setinterfacevariable {simplefont} {simplefont} - \setinterfacevariable {style} {style} - \setinterfacevariable {suffix} {suffix} - \setinterfacevariable {serif} {serif} - \setinterfacevariable {sans} {sans} - \setinterfacevariable {mono} {mono} - \setinterfacevariable {math} {math} - \setinterfacevariable {mainfont} {mainfont} - \setinterfacevariable {sansfont} {sansfont} - \setinterfacevariable {monofont} {monofont} - \setinterfacevariable {mathfont} {mathfont} - \setinterfacevariable {handwritingfont} {handwritingfont} - \setinterfacevariable {calligraphicfont} {calligraphicfont} - \setinterfacevariable {handwriting} {handwriting} - \setinterfacevariable {calligraphy} {calligraphy} - \setinterfacevariable {fontfamily} {fontfamily} - \setinterfacevariable {alternative} {alternative} -\stopinterface - -\startinterface all - \setinterfaceelement {set} {set} -\stopinterface - -%D System constants - -\definesystemconstant {Handwriting} -\definesystemconstant {Calligraphy} - -%D Module setup - -\setupmodule - [\c!size=\!!twelvepoint, - \c!style=\c!rm] - -%D Namespace - -\def\????sf{@@@@sf} - -%D Counter - -\newcounter\simplefonts!typeface -\newcounter\simplefonts!fontfamily - -%D Boolean - -\newif\if!!donesimplefonts - -%D Comma value lists - -\def\simplefonts!commands - {\v!mainfont,\v!sansfont,\v!monofont,\v!mathfont,\v!handwritingfont,\v!calligraphicfont} - -\def\simplefonts!alternative - {\c!regular,\c!italic,\c!slanted,\c!bold,\c!bolditalic,\c!boldslanted,\c!caps} - -%D \macros -%D {simplefontparameter,namedsimplefontparameter, -%D setupsimplefonts,presetsimplefonts} -%D -%D Internal helper macros - -\def\simplefontparameter #1{\csname\????sf\currentsimplefont#1\endcsname} -\def\namedsimplefontparameter#1#2{\csname\????sf #1#2\endcsname} - -\def\setupsimplefonts - {\dosingleempty\dosetupsimplefonts} - -\def\dosetupsimplefonts[#1]% first argument is optional - {\iffirstargument\getparameters[\????sf][#1]\fi - \if!!donesimplefonts\simplefonts@bodyfont\fi} - -\def\presetsimplefonts[#1]% - {\getparameters - [#1] - [\c!regularfont=, - \c!italicfont=, - \c!slantedfont=, - \c!boldfont=, - \c!bolditalicfont=, - \c!boldslantedfont=, - \c!capsfont=, - \c!features=\@@@@sffeatures, - \c!regularfeatures=\simplefontparameter\c!features, - \c!italicfeatures=\simplefontparameter\c!features, - \c!slantedfeatures=\simplefontparameter\c!features, - \c!boldfeatures=\simplefontparameter\c!features, - \c!bolditalicfeatures=\simplefontparameter\c!features, - \c!boldslantedfeatures=\simplefontparameter\c!features, - \c!smallcapsfeatures=\@@@@sfsmallcapsfeatures, - \c!capsfeatures=\simplefontparameter\c!smallcapsfeatures, - \c!scale=1.0]} - -\letvalue{\????sf:\v!style :\v!serif }\c!rm -\letvalue{\????sf:\v!style :\v!sans }\c!ss -\letvalue{\????sf:\v!style :\v!mono }\c!tt -\letvalue{\????sf:\v!style :\v!math }\c!mm -\letvalue{\????sf:\v!style :\v!handwriting}\c!hw -\letvalue{\????sf:\v!style :\v!calligraphy}\c!cg - -\letvalue{\????sf:\v!suffix:\v!serif }\s!Serif -\letvalue{\????sf:\v!suffix:\v!sans }\s!Sans -\letvalue{\????sf:\v!suffix:\v!mono }\s!Mono -\letvalue{\????sf:\v!suffix:\v!handwriting}\s!Handwriting -\letvalue{\????sf:\v!suffix:\v!calligraphy}\s!Calligraphy - -\setvalue{\????sf:\v!alternative:\c!regular }{} -\setvalue{\????sf:\v!alternative:\c!italic }{/I} -\setvalue{\????sf:\v!alternative:\c!slanted }{/I} -\setvalue{\????sf:\v!alternative:\c!bold }{/B} -\setvalue{\????sf:\v!alternative:\c!bolditalic }{/BI} -\setvalue{\????sf:\v!alternative:\c!boldslanted}{/BI} -\setvalue{\????sf:\v!alternative:\c!caps }{} - -\definetypescriptsynonym[latinmodernmath][latin-modern] % do I need more of them - -\def\sf@style #1{\csname\????sf:\v!style :#1\endcsname} -\def\sf@suffix #1{\csname\????sf:\v!suffix :#1\endcsname} -\def\sf@alternative#1{\csname\????sf:\v!alternative:#1\endcsname} - -\starttexdefinition simplefonts@typeface #1#2#3 - - \definetypeface - [#1] - [\sf@style{\namedsimplefontparameter{#3}\c!style}] - [\namedsimplefontparameter{#3}\c!style] - [#2] - [\s!default] - [rscale=\namedsimplefontparameter{#3}\c!scale] - -\stoptexdefinition - -\starttexdefinition simplefonts@family #1 - - \simplefonts@typeface{#1}{\v!mainfont }{\v!mainfont } - \simplefonts@typeface{#1}{\v!sansfont }{\v!sansfont } - \simplefonts@typeface{#1}{\v!monofont }{\v!monofont } - \simplefonts@typeface{#1}{\namedsimplefontparameter\v!mathfont\c!typeface}{\v!mathfont } - \simplefonts@typeface{#1}{\v!handwritingfont }{\v!handwritingfont } - \simplefonts@typeface{#1}{\v!calligraphicfont }{\v!calligraphicfont} - -\stoptexdefinition - -\starttexdefinition simplefonts@typescript #1#2 - - \startexpanded - - \@NX\starttypescript[#1][#2] - - \simplefonts@fontsynonym{\sf@suffix{#1}\empty }{\c!regular } - \simplefonts@fontsynonym{\sf@suffix{#1}\s!Italic }{\c!italic } - \simplefonts@fontsynonym{\sf@suffix{#1}\s!Slanted }{\c!slanted } - \simplefonts@fontsynonym{\sf@suffix{#1}\s!Bold }{\c!bold } - \simplefonts@fontsynonym{\sf@suffix{#1}\s!BoldItalic }{\c!bolditalic } - \simplefonts@fontsynonym{\sf@suffix{#1}\s!BoldSlanted}{\c!boldslanted} - \simplefonts@fontsynonym{\sf@suffix{#1}\s!Caps }{\c!caps } - - \@NX\stoptypescript - - \stopexpanded - -\stoptexdefinition - -\starttexdefinition simplefonts@scripttypescript #1#2 - - \startexpanded - - \@NX\starttypescript[#1][#2] - - \simplefonts@fontsynonym{\sf@suffix{#1}}{\c!regular} - - \@NX\stoptypescript - - \stopexpanded - -\stoptexdefinition - -\starttexdefinition simplefonts@fontsynonym #1#2 - - \@NX\definefontsynonym - [#1] - [\simplefontparameter{#2}] - [\s!features=\simplefontparameter{#2\s!features}] - -\stoptexdefinition - -\starttexdefinition simplefonts@bodyfont - - \doglobal\increment\simplefonts!typeface - - \simplefonts@family{\v!simplefonts:\simplefonts!typeface} - - \setupbodyfont[\v!simplefonts:\simplefonts!typeface,\@@@@sfstyle,\@@@@sfsize] - -\stoptexdefinition - -\starttexdefinition simplefonts@definetextfont [#1][#2][#3][#4] - - \edef\currentsimplefont{#1}\edef\currenttypeface{#2} - - \presetsimplefonts[\????sf\currentsimplefont] - - \getparameters[\????sf\currentsimplefont][#4] - - \startprocesscommacommand[\simplefonts!alternative] - - \doifsomethingelse{\simplefontparameter{##1\s!font}} - {\doifinstringelse{*}{\simplefontparameter{##1\s!font}} - {\setevalue{\????sf#1##1}{name:#3\@EAEAEA\gobbleoneargument\csname\????sf\currentsimplefont##1\s!font\endcsname}} - {\setevalue{\????sf#1##1}{name:\simplefontparameter{##1\s!font}}}} - {\setevalue{\????sf#1##1}{name:#3\sf@alternative{##1}}} - - \stopprocesscommacommand - - \simplefonts@typescript{\simplefontparameter\c!style}{#1} - - \ifx\currenttypeface\v!simplefonts - - % don't create a typeface and set bodyfont when the module is loaded - - \if!!donesimplefonts\simplefonts@bodyfont\fi - - \else - - \simplefonts@typeface{#2}{#1}{#1} - - \fi - -\stoptexdefinition - -\starttexdefinition simplefonts@definescriptfont [#1][#2][#3][#4] - - \edef\currentsimplefont{#1}\edef\currenttypeface{#2} - - \presetsimplefonts[\????sf\currentsimplefont] - - \getparameters[\????sf\currentsimplefont][#4] - - \startprocesscommacommand[\c!regular] - - \setvalue{\????sf#1##1}{name:#3} - - \stopprocesscommacommand - - \simplefonts@scripttypescript{\simplefontparameter\c!style}{#1} - - \ifx\currenttypeface\v!simplefonts - - % don't create a typeface and set bodyfont when the module is loaded - - \if!!donesimplefonts\simplefonts@bodyfont\fi - - \else - - \simplefonts@typeface{#2}{#1}{#1} - - \fi - -\stoptexdefinition - -\starttexdefinition simplefonts@definemathfont [#1][#2][#3][#4] - - \edef\currentsimplefont{#1}\edef\currenttypeface{#2} - - \presetsimplefonts[\????sf\currentsimplefont] - - \getparameters[\????sf\currentsimplefont][#4] - - \lowercase{\unspacestring#3\to\!!simplefont} - - \letvalue{\????sf\currentsimplefont\c!typeface}\!!simplefont - - \ifx\currenttypeface\v!simplefonts - - % don't create a typeface and set bodyfont when the module is loaded - - \if!!donesimplefonts\simplefonts@bodyfont\fi - - \else - - \simplefonts@typeface{#2}{#1}{#1} - - \fi - -\stoptexdefinition - -%D \macros -%D {definefontcommand} - -\def\definefontcommand - {\dotripleempty\dodefinefontcommand} - -\def\dodefinefontcommand[#1][#2][#3]% - {\getparameters[\????sf#1][\c!style=\v!serif,#3]% - \processaction - [\namedsimplefontparameter{#1}\c!style] - [ \v!serif=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definetextfont [#1][#2]}, - \v!sans=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definetextfont [#1][#2]}, - \v!mono=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definetextfont [#1][#2]}, - \v!math=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definemathfont [#1][#2]}, - \v!handwriting=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definescriptfont[#1][#2]}, - \v!calligraphy=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definescriptfont[#1][#2]}, - \s!unknown=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definetextfont [#1][#2]}]} - -\definefontcommand[\v!mainfont ][\v!simplefonts][\c!style=\v!serif ] -\definefontcommand[\v!sansfont ][\v!simplefonts][\c!style=\v!sans ] -\definefontcommand[\v!monofont ][\v!simplefonts][\c!style=\v!mono ] -\definefontcommand[\v!mathfont ][\v!simplefonts][\c!style=\v!math ] -\definefontcommand[\v!handwritingfont ][\v!simplefonts][\c!style=\v!handwriting] -\definefontcommand[\v!calligraphicfont][\v!simplefonts][\c!style=\v!calligraphy] - -%D \macros -%D {definesimplefonttypeface} - -\def\definesimplefonttypeface - {\dotripleempty\dodefinesimplefonttypeface} - -\def\dodefinesimplefonttypeface[#1][#2][#3]% - {\getparameters[\????sf#1][\c!style=\v!serif,#3]% - \processaction - [\namedsimplefontparameter{#1}\c!style] - [ \v!serif=>{\simplefonts@definetextfont [#1][#1][#2][#3]}, - \v!sans=>{\simplefonts@definetextfont [#1][#1][#2][#3]}, - \v!mono=>{\simplefonts@definetextfont [#1][#1][#2][#3]}, - \v!math=>{\simplefonts@definemathfont [#1][#1][#2][#3]}, - \v!math=>{\simplefonts@definemathfont [#1][#1][#2][#3]}, - \v!handwriting=>{\simplefonts@definescriptfont[#1][#1][#2][#3]}, - \v!calligraphy=>{\simplefonts@definescriptfont[#1][#1][#2][#3]}, - \s!unknown=>{\simplefonts@definetextfont [#1][#1][#2][#3]}]} - -%D Default setup - -\setupsimplefonts - [\c!size=\moduleparameter\v!simplefonts\c!size, - \c!style=\moduleparameter\v!simplefonts\c!style, - \c!features=\v!default, - \c!smallcapsfeatures=\v!smallcaps] - -%D Default fonts - -\setmainfont [Latin Modern Roman] -\setsansfont [Latin Modern Sans] -\setmonofont [Latin Modern Mono] -\setmathfont [Latin Modern Math] -\sethandwritingfont [Latin Modern Roman] % neither handwritten nor calligraphic are available -\setcalligraphicfont[Latin Modern Roman] % for Latin Modern but I need a default font for them - -\!!donesimplefontstrue - -\stopmodule - -\protect \endinput diff --git a/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.mkiv b/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.mkiv deleted file mode 100644 index e2e9a339b6c..00000000000 --- a/Master/texmf-dist/tex/context/third/simplefonts/t-simplefonts.mkiv +++ /dev/null @@ -1,812 +0,0 @@ -%D \module -%D [ file=t-simplefonts, -%D version=2012.01.09, -%D title=\CONTEXT\ User Module, -%D subtitle=Simplefonts, -%D author=Wolfgang Schuster, -%D date=\currentdate, -%D copyright=Wolfgang Schuster, -%D email=schuster.wolfgang@googlemail.com, -%D license=GNU General Public License] - -%C Copyright (C) 2010 Wolfgang Schuster -%C -%C This program is free software: you can redistribute it and/or modify -%C it under the terms of the GNU General Public License as published by -%C the Free Software Foundation, either version 3 of the License, or -%C (at your option) any later version. -%C -%C This program is distributed in the hope that it will be useful, -%C but WITHOUT ANY WARRANTY; without even the implied warranty of -%C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -%C GNU General Public License for more details. -%C -%C You should have received a copy of the GNU General Public License -%C along with this program. If not, see <http://www.gnu.org/licenses/>. - -\writestatus{loading}{ConTeXt User Module / Simplefonts} - -\unprotect - -\startmodule[simplefonts] - -%D Constants and variables - -\startinterface all - \setinterfaceconstant {regular} {regular} - \setinterfaceconstant {italic} {italic} - \setinterfaceconstant {slanted} {slanted} - \setinterfaceconstant {bold} {bold} - \setinterfaceconstant {bolditalic} {bolditalic} - \setinterfaceconstant {boldslanted} {boldslanted} - \setinterfaceconstant {caps} {caps} - \setinterfaceconstant {italiccaps} {italiccaps} - \setinterfaceconstant {slantedcaps} {slantedcaps} - \setinterfaceconstant {boldcaps} {boldcaps} - \setinterfaceconstant {bolditaliccaps} {bolditaliccaps} - \setinterfaceconstant {boldslantedcaps} {boldslantedcaps} - \setinterfaceconstant {scale} {scale} - \setinterfaceconstant {range} {range} - \setinterfaceconstant {weight} {weight} - \setinterfaceconstant {features} {features} - \setinterfaceconstant {regularfont} {regularfont} - \setinterfaceconstant {italicfont} {italicfont} - \setinterfaceconstant {slantedfont} {slantedfont} - \setinterfaceconstant {boldfont} {boldfont} - \setinterfaceconstant {bolditalicfont} {bolditalicfont} - \setinterfaceconstant {boldslantedfont} {boldslantedfont} - \setinterfaceconstant {capsfont} {capsfont} - \setinterfaceconstant {italiccapsfont} {italiccapsfont} - \setinterfaceconstant {slantedcapsfont} {slantedcapsfont} - \setinterfaceconstant {boldcapsfont} {boldcapsfont} - \setinterfaceconstant {bolditaliccapsfont} {bolditaliccapsfont} - \setinterfaceconstant {boldslantedcapsfont} {boldslantedcapsfont} - \setinterfaceconstant {regularfeatures} {regularfeatures} - \setinterfaceconstant {italicfeatures} {italicfeatures} - \setinterfaceconstant {slantedfeatures} {slantedfeatures} - \setinterfaceconstant {boldfeatures} {boldfeatures} - \setinterfaceconstant {bolditalicfeatures} {bolditalicfeatures} - \setinterfaceconstant {boldslantedfeatures} {boldslantedfeatures} - \setinterfaceconstant {smallcapsfeatures} {smallcapsfeatures} - \setinterfaceconstant {capsfeatures} {capsfeatures} - \setinterfaceconstant {italiccapsfeatures} {italiccapsfeatures} - \setinterfaceconstant {slantedcapsfeatures} {slantedcapsfeatures} - \setinterfaceconstant {boldcapsfeatures} {boldcapsfeatures} - \setinterfaceconstant {bolditaliccapsfeatures} {bolditaliccapsfeatures} - \setinterfaceconstant {boldslantedcapsfeatures} {boldslantedcapsfeatures} - \setinterfaceconstant {typeface} {typeface} - \setinterfaceconstant {protrusion} {protrusion} - \setinterfaceconstant {contextversion} {contextversion} - \setinterfaceconstant {sf} {sf} - \setinterfaceconstant {bc} {bc} - \setinterfaceconstant {mode} {mode} - \setinterfaceconstant {check} {check} -\stopinterface - -\startinterface all - \setinterfacevariable {simplefonts} {simplefonts} - \setinterfacevariable {simplefont} {simplefont} - \setinterfacevariable {style} {style} - \setinterfacevariable {suffix} {suffix} - \setinterfacevariable {serif} {serif} - \setinterfacevariable {sans} {sans} - \setinterfacevariable {mono} {mono} - \setinterfacevariable {math} {math} - \setinterfacevariable {mainfont} {mainfont} - \setinterfacevariable {sansfont} {sansfont} - \setinterfacevariable {monofont} {monofont} - \setinterfacevariable {mathfont} {mathfont} - \setinterfacevariable {handwritingfont} {handwritingfont} - \setinterfacevariable {calligraphicfont} {calligraphicfont} - \setinterfacevariable {cjk} {cjk} - \setinterfacevariable {fallback} {fallback} - \setinterfacevariable {condensed} {condensed} - \setinterfacevariable {light} {light} - \setinterfacevariable {heavy} {heavy} - \setinterfacevariable {feature} {feature} - \setinterfacevariable {handwriting} {handwriting} - \setinterfacevariable {calligraphy} {calligraphy} - \setinterfacevariable {fontfamily} {fontfamily} - \setinterfacevariable {node} {node} -\stopinterface - -\startinterface all - \setinterfaceelement {set} {set} -\stopinterface - -%D System constants - -\definesystemconstant {Handwriting} -\definesystemconstant {Calligraphy} -\definesystemconstant {Simplefont} - -%D Messages - -\definemessageconstant {simplefonts} - -\startinterface all - \setinterfacemessage{simplefonts}{title}{simplefonts} - \setinterfacemessage{simplefonts}{1} {font '--' not found} - \setinterfacemessage{simplefonts}{2} {feature '--' is not defined} - \setinterfacemessage{simplefonts}{3} {your context is too old, you need at last version '--'} - \setinterfacemessage{simplefonts}{4} {script '--' is not defined} - \setinterfacemessage{simplefonts}{5} {language '--' is not defined} -\stopinterface - -%D Module setup - -\setupmodule - [ \c!size=12pt, - \c!style=rm] - -%D Lua code - -\ctxloadluafile{t-simplefonts}{} - -%D Namespace - -\def\????sf{@@@@sf} - -%D Counter - -\newcounter\simplefonts!typeface -\newcounter\simplefonts!fontfamily - -\newcounter\simplefonts!mainfont -\newcounter\simplefonts!sansfont -\newcounter\simplefonts!monofont -\newcounter\simplefonts!handwritingfont -\newcounter\simplefonts!calligraphicfont - -%D Boolean - -\newif\if!!donesimplefonts - -%D Tracing - -\let\enablesimplefonts \!!donesimplefontstrue -\let\disablesimplefonts\!!donesimplefontsfalse - -%D Comma value lists - -\letempty\simplefont!features -\letempty\simplefont!localfeatures -\letempty\simplefont!globalfeatures - -\def\simplefonts!commands - {\v!mainfont,\v!sansfont,\v!monofont,\v!mathfont,\v!handwritingfont,\v!calligraphicfont} - -\def\simplefonts!weight - {\v!condensed,\v!light,\v!normal,\v!medium,\v!heavy} - -\def\simplefonts!alternative - {\c!regular,\c!italic,\c!slanted,\c!bold,\c!bolditalic,\c!boldslanted,\c!caps, - \c!italiccaps,\c!slantedcaps,\c!boldcaps,\c!bolditaliccaps,\c!boldslantedcaps} - -%D Simplefont style - -\definefontstyle [\c!sf,\v!simplefont] [\c!sf] - -\starttypescript [simplefont] [default] [size] - \definebodyfont - [4pt,5pt,6pt,7pt,8pt,9pt,10pt,11pt,12pt,14.4pt,17.3pt] - [sf] [default] -\stoptypescript - -\definebodyfont [default] [sf] - [tf=Simplefont sa 1, - bf=SimplefontBold sa 1, - it=SimplefontItalic sa 1, - sl=SimplefontSlanted sa 1, - bi=SimplefontBoldItalic sa 1, - bs=SimplefontBoldSlanted sa 1, - sc=SimplefontCaps sa 1] - -%D \macros -%D {simplefontparameter,namedsimplefontparameter, -%D setupsimplefonts,presetsimplefonts} -%D -%D Internal helper macros - -\def\simplefontparameter #1{\csname\????sf\currentsimplefont#1\endcsname} -\def\namedsimplefontparameter#1#2{\csname\????sf #1#2\endcsname} - -\def\setupsimplefonts - {\dosingleempty\dosetupsimplefonts} - -\def\dosetupsimplefonts[#1]% first argument is optional - {\iffirstargument - \getparameters[\????sf][#1]% - \simplefonts@features{#1}\v!global - \fi - \if!!donesimplefonts\simplefonts@bodyfont\fi} - -\def\presetsimplefonts[#1]% - {\getparameters - [#1] - [\c!regularfont=, - \c!italicfont=, - \c!slantedfont=, - \c!boldfont=, - \c!bolditalicfont=, - \c!boldslantedfont=, - \c!capsfont=, - \c!italiccapsfont=, - \c!slantedcapsfont=, - \c!boldcapsfont=, - \c!bolditaliccapsfont=, - \c!boldslantedcapsfont=, - \c!features=\@@@@sffeatures, - \c!regularfeatures=\simplefontparameter\c!features, - \c!italicfeatures=\simplefontparameter\c!features, - \c!slantedfeatures=\simplefontparameter\c!features, - \c!boldfeatures=\simplefontparameter\c!features, - \c!bolditalicfeatures=\simplefontparameter\c!features, - \c!boldslantedfeatures=\simplefontparameter\c!features, - \c!smallcapsfeatures=\@@@@sfsmallcapsfeatures, - \c!capsfeatures=\simplefontparameter\c!smallcapsfeatures, - \c!italiccapsfeatures=\simplefontparameter\c!smallcapsfeatures, - \c!slantedcapsfeatures=\simplefontparameter\c!smallcapsfeatures, - \c!boldcapsfeatures=\simplefontparameter\c!smallcapsfeatures, - \c!bolditaliccapsfeatures=\simplefontparameter\c!smallcapsfeatures, - \c!boldslantedcapsfeatures=\simplefontparameter\c!smallcapsfeatures, - \c!weight=\v!normal, - \c!mode=, % the three keys mode, expansion and protrusion - \c!expansion=, % are reset for font command when you select - \c!protrusion=, % a new font to avoid conflicts or unwanted effects - \c!scale=1.0]} - -\setvalue{\????sf:\v!style :\v!serif }{rm} -\setvalue{\????sf:\v!style :\v!sans }{ss} -\setvalue{\????sf:\v!style :\v!mono }{tt} -\setvalue{\????sf:\v!style :\v!math }{mm} -\setvalue{\????sf:\v!style :\v!handwriting}{hw} -\setvalue{\????sf:\v!style :\v!calligraphy}{cg} -\setvalue{\????sf:\v!style :\v!simplefont }{sf} - -\letvalue{\????sf:\v!suffix:\v!serif }\s!Serif -\letvalue{\????sf:\v!suffix:\v!sans }\s!Sans -\letvalue{\????sf:\v!suffix:\v!mono }\s!Mono -\letvalue{\????sf:\v!suffix:\v!handwriting}\s!Handwriting -\letvalue{\????sf:\v!suffix:\v!calligraphy}\s!Calligraphy -\letvalue{\????sf:\v!suffix:\v!simplefont }\s!Simplefont - -\definetypescriptsynonym[latinmodernmath][latin-modern] -\definetypescriptsynonym[asanamath] [asana] - -\def\sf@style #1{\csname\????sf:\v!style :#1\endcsname} -\def\sf@suffix#1{\csname\????sf:\v!suffix:#1\endcsname} - -\starttexdefinition simplefonts@typeface #1#2#3 - - \definetypeface - [#1] - [\sf@style{\namedsimplefontparameter{#3}\c!style}] - [\namedsimplefontparameter{#3}\c!style] - [#2] - [\s!default] - [rscale=\namedsimplefontparameter{#3}\c!scale] - -\stoptexdefinition - -\starttexdefinition simplefonts@family #1 - - \simplefonts@typeface{#1}{\v!mainfont :\simplefonts!mainfont }{\v!mainfont } - \simplefonts@typeface{#1}{\v!sansfont :\simplefonts!sansfont }{\v!sansfont } - \simplefonts@typeface{#1}{\v!monofont :\simplefonts!monofont }{\v!monofont } - \simplefonts@typeface{#1}{\namedsimplefontparameter\v!mathfont\c!typeface }{\v!mathfont } - \simplefonts@typeface{#1}{\v!handwritingfont :\simplefonts!handwritingfont }{\v!handwritingfont } - \simplefonts@typeface{#1}{\v!calligraphicfont :\simplefonts!calligraphicfont}{\v!calligraphicfont} - -\stoptexdefinition - -\starttexdefinition simplefonts@typescript #1#2 - - \startexpanded - - \@NX\starttypescript[#1][#2] - - \simplefonts@fontsynonym{\sf@suffix{#1}\empty }{\c!regular } - \simplefonts@fontsynonym{\sf@suffix{#1}\s!Italic }{\c!italic } - \simplefonts@fontsynonym{\sf@suffix{#1}\s!Slanted }{\c!slanted } - \simplefonts@fontsynonym{\sf@suffix{#1}\s!Bold }{\c!bold } - \simplefonts@fontsynonym{\sf@suffix{#1}\s!BoldItalic }{\c!bolditalic } - \simplefonts@fontsynonym{\sf@suffix{#1}\s!BoldSlanted }{\c!boldslanted } - - \simplefonts@fontsynonym{\sf@suffix{#1}\s!Caps }{\c!caps } - \simplefonts@fontsynonym{\sf@suffix{#1}\s!Italic\s!Caps }{\c!italiccaps } - \simplefonts@fontsynonym{\sf@suffix{#1}\s!Slanted\s!Caps }{\c!slantedcaps } - \simplefonts@fontsynonym{\sf@suffix{#1}\s!Bold\s!Caps }{\c!boldcaps } - \simplefonts@fontsynonym{\sf@suffix{#1}\s!BoldItalic\s!Caps }{\c!bolditaliccaps } - \simplefonts@fontsynonym{\sf@suffix{#1}\s!BoldSlanted\s!Caps}{\c!boldslantedcaps} - - \@NX\stoptypescript - - \stopexpanded - -\stoptexdefinition - -\starttexdefinition simplefonts@scripttypescript #1#2 - - \startexpanded - - \@NX\starttypescript[#1][#2] - - \simplefonts@fontsynonym{\sf@suffix{#1}}{\c!regular} - - \@NX\stoptypescript - - \stopexpanded - -\stoptexdefinition - -\starttexdefinition simplefonts@fontsynonym #1#2 - - \@NX\definefontsynonym - [#1] - [\simplefontparameter{#2}] - [\s!fallbacks=\currentsimplefont#2\s!fallbacks, - \s!features=\currentsimplefont#2\s!features ] - -\stoptexdefinition - -\starttexdefinition simplefonts@fontfallback #1#2#3 - - \definefontfallback - [#1#3\s!fallbacks] - [\namedsimplefontparameter{#2}{#3}*#2#3\s!features] - [\namedsimplefontparameter{#2}\c!range] - [\s!rscale=\namedsimplefontparameter{#2}\c!scale, - \c!force=\namedsimplefontparameter{#2}\c!force, - \c!check=\namedsimplefontparameter{#2}\c!check] - -\stoptexdefinition - -\starttexdefinition simplefonts@bodyfont - - \doglobal\increment\simplefonts!typeface - - \simplefonts@family{\v!simplefonts:\simplefonts!typeface} - - \edef\@@@@sfstyle{\@@@@sfstyle} - \edef\@@@@sfsize {\@@@@sfsize } - - \setupbodyfont - [\v!simplefonts:\simplefonts!typeface - \ifx\@@@@sfstyle\empty\else,\@@@@sfstyle\fi - \ifx\@@@@sfsize \empty\else,\@@@@sfsize \fi] - -\stoptexdefinition - -\starttexdefinition simplefonts@fontfeature #1#2 - - \letempty\simplefont!features - - % expansion and protrusion could bet se either global for all styles or local for only one style - - \doifvaluesomething{\????sf\c!mode }{\appendtocommalist{\c!mode =\csname\????sf\c!mode \endcsname }\simplefont!features} - \doifvaluesomething{\????sf\c!expansion }{\appendtocommalist{\c!expansion =\csname\????sf\c!expansion \endcsname }\simplefont!features} - \doifvaluesomething{\????sf\c!protrusion }{\appendtocommalist{\c!protrusion=\csname\????sf\c!protrusion\endcsname }\simplefont!features} - - \doifvaluesomething{\????sf#1\c!mode }{\appendtocommalist{\c!mode =\csname\????sf#1\c!mode \endcsname }\simplefont!features} - \doifvaluesomething{\????sf#1\c!expansion }{\appendtocommalist{\c!expansion =\csname\????sf#1\c!expansion \endcsname }\simplefont!features} - \doifvaluesomething{\????sf#1\c!protrusion}{\appendtocommalist{\c!protrusion=\csname\????sf#1\c!protrusion\endcsname }\simplefont!features} - - \appendtocommalist\simplefont!globalfeatures\simplefont!features - \appendtocommalist\simplefont!localfeatures \simplefont!features - - \normalexpanded{\@NX\definefontfeature[#1#2\s!features][\namedsimplefontparameter{#1}{#2\s!features}][\simplefont!features]} - -\stoptexdefinition - -\starttexdefinition simplefonts@features #1#2 - - \letvalueempty{simplefont!#2features} - - \startprocessassignmentcommand[#1] - - \ctxlua{thirddata.simplefonts.parameter("##1","##2","simplefont!#2features")} - - \stopprocessassignmentcommand - -\stoptexdefinition - -\starttexdefinition simplefonts@definetextfont [#1][#2][#3][#4] - - \edef\currentsimplefont{#1}\edef\currenttypeface{#2} - - \presetsimplefonts[\????sf\currentsimplefont] - - \getparameters[\????sf\currentsimplefont][#4] - - \simplefonts@features{#4}\v!local % parse assignment list for font features - - \startprocesscommacommand[\simplefonts!alternative] - - \simplefonts@fontfeature{#1}{##1} - - \ctxlua{thirddata.simplefonts.selectfont("#1","#3","\simplefontparameter{##1\s!font}","##1","\simplefontparameter\c!weight")} - - \stopprocesscommacommand - - \ifx\currenttypeface\v!simplefonts - - \ifx\currentsimplefont\v!mainfont - \doglobal\increment\simplefonts!mainfont - \simplefonts@typescript{\simplefontparameter\c!style}{\v!mainfont:\simplefonts!mainfont} - \else\ifx\currentsimplefont\v!sansfont - \doglobal\increment\simplefonts!sansfont - \simplefonts@typescript{\simplefontparameter\c!style}{\v!sansfont:\simplefonts!sansfont} - \else\ifx\currentsimplefont\v!monofont - \doglobal\increment\simplefonts!monofont - \simplefonts@typescript{\simplefontparameter\c!style}{\v!monofont :\simplefonts!monofont} - \fi\fi\fi - - % don't create a typeface and set bodyfont when the module is loaded - - \if!!donesimplefonts\simplefonts@bodyfont\fi - - \else - - \simplefonts@typescript{\simplefontparameter\c!style}{#1} - - \simplefonts@typeface{#2}{#1}{#1} - - \fi - -\stoptexdefinition - -\starttexdefinition simplefonts@definescriptfont [#1][#2][#3][#4] - - \edef\currentsimplefont{#1}\edef\currenttypeface{#2} - - \presetsimplefonts[\????sf\currentsimplefont] - - \getparameters[\????sf\currentsimplefont][#4] - - \simplefonts@features{#4}\v!local % parse assignment list for font features - - \startprocesscommacommand[\c!regular] - - \simplefonts@fontfeature{#1}{##1} - - \ctxlua{thirddata.simplefonts.selectfont("#1","#3","\simplefontparameter{##1\s!font}","##1","\simplefontparameter\c!weight")} - - \stopprocesscommacommand - - \ifx\currenttypeface\v!simplefonts - - \ifx\currentsimplefont\v!handwritingfont - \doglobal\increment\simplefonts!handwritingfont - \simplefonts@scripttypescript{\simplefontparameter\c!style}{\v!handwritingfont :\simplefonts!handwritingfont} - \else\ifx\currentsimplefont\v!calligraphicfont - \doglobal\increment\simplefonts!calligraphicfont - \simplefonts@scripttypescript{\simplefontparameter\c!style}{\v!calligraphicfont:\simplefonts!calligraphicfont} - \fi\fi - - % don't create a typeface and set bodyfont when the module is loaded - - \if!!donesimplefonts\simplefonts@bodyfont\fi - - \else - - \simplefonts@scripttypescript{\simplefontparameter\c!style}{#1} - - \simplefonts@typeface{#2}{#1}{#1} - - \fi - -\stoptexdefinition - -\starttexdefinition simplefonts@definemathfont [#1][#2][#3][#4] - - \edef\currentsimplefont{#1}\edef\currenttypeface{#2} - - \presetsimplefonts[\????sf\currentsimplefont] - - \getparameters[\????sf\currentsimplefont][#4] - - % no fonts are searched for the math fonts, all what happens is to normalize - % the given name and save it in a macro is is later used to load a predefined - % typescript - - \setvalue{\????sf\currentsimplefont\c!typeface}{\ctxlua{thirddata.simplefonts.normalizefontname("#3")}} - - \ifx\currenttypeface\v!simplefonts - - % don't create a typeface and set bodyfont when the module is loaded - - \if!!donesimplefonts\simplefonts@bodyfont\fi - - \else - - \simplefonts@typeface{#2}{\namedsimplefontparameter\currentsimplefont\c!typeface}{#1} - - \fi - -\stoptexdefinition - -\starttexdefinition simplefonts@setfallbackfont [#1][#2][#3][#4] - - \edef\currentsimplefont{#1}\edef\currentmainfont{#2} - - \presetsimplefonts[\????sf\currentsimplefont] - - \getparameters[\????sf\currentsimplefont][#4] - - \simplefonts@features{#4}\v!local % parse assignment list for font features - - \startprocesscommacommand[\simplefonts!alternative] - - \simplefonts@fontfeature{#1}{##1} - - \ctxlua{thirddata.simplefonts.selectfont("#1","#3","\simplefontparameter{##1\s!font}","##1","\simplefontparameter\c!weight")} - - \simplefonts@fontfallback{#2}{#1}{##1} - - \stopprocesscommacommand - -\stoptexdefinition - -\starttexdefinition simplefonts@definefallbackfont [#1][#2][#3][#4] - - \edef\currentsimplefont{#1}\edef\currentmainfont{#2} - - % to allow more than one fallback font I save the settings - % in a token register and set then all fallbacks in one turn - - % i should wrap this in a macro which checks if a register - % is already defined, append the setting and flush all - - \unless\ifcsname\currentmainfont\s!fallbacks\endcsname\@EA\newtoks\csname\currentmainfont\s!fallbacks\endcsname\fi - - \csname\currentmainfont\s!fallbacks\endcsname\@EA{\the\@EA\csname\currentmainfont\s!fallbacks\endcsname\simplefonts@setfallbackfont[#1][#2][#3][#4]} - - \the\@EA\csname\currentmainfont\s!fallbacks\endcsname - - % the only way to make fallback fonts working with the module - % is to create a new typeface and enable it as bodyfont - - % don't create a typeface or set the bodyfont when the module code is loaded - - \if!!donesimplefonts - - \startprocesscommacommand[\simplefonts!commands] % why not \doifinset? - - \ifx\currentcommalistitem\currentmainfont\simplefonts@bodyfont\quitcommalist\fi - - \stopprocesscommacommand - - \fi - -\stoptexdefinition - -%D \macros -%D {definefontcommand,definesubfontcommand} - -\def\definefontcommand - {\dotripleempty\dodefinefontcommand} - -\def\dodefinefontcommand[#1][#2][#3]% - {\getparameters[\????sf#1][\c!style=\v!serif,#3]% - \processaction - [\namedsimplefontparameter{#1}\c!style] - [ \v!serif=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definetextfont [#1][#2]}, - \v!sans=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definetextfont [#1][#2]}, - \v!mono=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definetextfont [#1][#2]}, - \v!math=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definemathfont [#1][#2]}, - \v!handwriting=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definescriptfont[#1][#2]}, - \v!calligraphy=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definescriptfont[#1][#2]}, - \s!unknown=>\setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definetextfont [#1][#2]}]} - -\definefontcommand[\v!mainfont ][\v!simplefonts][\c!style=\v!serif ] -\definefontcommand[\v!sansfont ][\v!simplefonts][\c!style=\v!sans ] -\definefontcommand[\v!monofont ][\v!simplefonts][\c!style=\v!mono ] -\definefontcommand[\v!mathfont ][\v!simplefonts][\c!style=\v!math ] -\definefontcommand[\v!handwritingfont ][\v!simplefonts][\c!style=\v!handwriting] -\definefontcommand[\v!calligraphicfont][\v!simplefonts][\c!style=\v!calligraphy] - -\def\definesubfontcommand - {\dotripleempty\dodefinesubfontcommand} - -\def\dodefinesubfontcommand[#1][#2][#3]% - {\getparameters[\????sf#1][\c!range=,#3]% - \setvalue{\e!set#1}{\doquadrupleempty\simplefonts@definefallbackfont[#1][#2]}} - -\definesubfontcommand[\v!cjk\v!mainfont][\v!mainfont][\c!range={0x00400-0x2FA1F}] -\definesubfontcommand[\v!cjk\v!sansfont][\v!sansfont][\c!range={0x00400-0x2FA1F}] -\definesubfontcommand[\v!cjk\v!monofont][\v!monofont][\c!range={0x00400-0x2FA1F}] - -\definesubfontcommand[\v!mainfont\v!fallback][\v!mainfont][\c!range=] -\definesubfontcommand[\v!sansfont\v!fallback][\v!sansfont][\c!range=] -\definesubfontcommand[\v!monofont\v!fallback][\v!monofont][\c!range=] - -%D \macros -%D {simplefont,definesimplefont} - -\def\simplefont - {\dodoubleempty\dosimplefont} - -\def\dosimplefont[#1][#2]% - {\getparameters[\????sf\v!default][\c!features=\v!default,\c!alternative=\v!regular,\c!weight=\v!normal,\c!size=,#2]% - \edef\simplefontsize{\namedsimplefontparameter\v!default\c!size}% - \ifx\simplefontsize\empty\else - \doifdimenstringelse\simplefontsize - {\edef\simplefontsize{ at \simplefontsize}} - {\edef\simplefontsize{ \simplefontsize}}% - \fi - \ctxlua{thirddata.simplefonts.selectfont("\v!default","#1","","\@@@@sfdefaultalternative","\@@@@sfdefaultweight")}% - \expanded{\definedfont[\csname\????sf\v!default\@@@@sfdefaultalternative\endcsname*\@@@@sfdefaultfeatures\simplefontsize]}} - -\def\definesimplefont - {\dotripleempty\dodefinesimplefont} - -\def\dodefinesimplefont[#1][#2][#3]% - {\getparameters[\????sf\v!default][\c!features=\v!default,\c!alternative=\v!regular,\c!weight=\v!normal,\c!size=,#3]% - \edef\simplefontsize{\namedsimplefontparameter\v!default\c!size}% - \ifx\simplefontsize\empty\else - \doifdimenstringelse\simplefontsize - {\edef\simplefontsize{ at \simplefontsize}} - {\edef\simplefontsize{ \simplefontsize}}% - \fi - \ctxlua{thirddata.simplefonts.selectfont("\v!default","#2","","\@@@@sfdefaultalternative","\@@@@sfdefaultweight")}% - \expanded{\definefont[#1][\csname\????sf\v!default\@@@@sfdefaultalternative\endcsname*\@@@@sfdefaultfeatures\simplefontsize][#3]}} - -%D \macros -%D {simplefonttypeface,definesimplefonttypeface} - -\def\simplefonttypeface - {\dodoubleempty\dosimplefonttypeface} - -\def\dosimplefonttypeface[#1][#2]% - {\doglobal\increment\simplefonts!fontfamily - \simplefonts@definetextfont[\v!fontfamily][\v!fontfamily:\simplefonts!fontfamily][#1][\c!style=\v!simplefont,#2]% - \switchtobodyfont[\v!fontfamily:\simplefonts!fontfamily]} - -\def\definesimplefonttypeface - {\dotripleempty\dodefinesimplefonttypeface} - -\def\dodefinesimplefonttypeface[#1][#2][#3]% - {\getparameters[\????sf#1][\c!style=\v!serif,#3]% - \processaction - [\namedsimplefontparameter{#1}\c!style] - [ \v!serif=>{\simplefonts@definetextfont [#1][#1][#2][#3]}, - \v!sans=>{\simplefonts@definetextfont [#1][#1][#2][#3]}, - \v!mono=>{\simplefonts@definetextfont [#1][#1][#2][#3]}, - \v!math=>{\simplefonts@definemathfont [#1][#1][#2][#3]}, - \v!handwriting=>{\simplefonts@definescriptfont[#1][#1][#2][#3]}, - \v!calligraphy=>{\simplefonts@definescriptfont[#1][#1][#2][#3]}, - \s!unknown=>{\simplefonts@definetextfont [#1][#1][#2][#3]}]} - -%D Font extensions - -\getparameters - [\????sf\v!condensed] - [ \c!regular={condensedregular,condregular,condensed}, - \c!italic={condenseditalic,condensedoblique,conditalic,\namedsimplefontparameter\v!condensed\c!regular}, - \c!slanted={\namedsimplefontparameter\v!condensed\c!italic}, - \c!bold={condensedbold,condbold,\namedsimplefontparameter\v!condensed\c!regular}, - \c!bolditalic={condensedbolditalic,condensedboldoblique,condbolditalic,\namedsimplefontparameter\v!condensed\c!bold}, - \c!boldslanted={\namedsimplefontparameter\v!condensed\c!bolditalic}, - \c!caps={\namedsimplefontparameter\v!condensed\c!regular}, - \c!italiccaps={\namedsimplefontparameter\v!condensed\c!caps}, - \c!slantedcaps={\namedsimplefontparameter\v!condensed\c!italiccaps}, - \c!boldcaps={\namedsimplefontparameter\v!condensed\c!caps}, - \c!bolditaliccaps={\namedsimplefontparameter\v!condensed\c!boldcaps}, - \c!boldslantedcaps={\namedsimplefontparameter\v!condensed\c!bolditaliccaps}] - -\getparameters - [\????sf\v!light] - [ \c!regular={lightregular,light}, - \c!italic={lightitalic,lightit,lightoblique,\namedsimplefontparameter\v!light\c!regular}, - \c!slanted={\namedsimplefontparameter\v!light\c!italic}, - \c!bold={bookregular,regular,book,\namedsimplefontparameter\v!light\c!regular}, - \c!bolditalic={bookitalic,bookit,italic,oblique,\namedsimplefontparameter\v!light\c!bold}, - \c!boldslanted={\namedsimplefontparameter\v!light\c!bolditalic}, - \c!caps={smallcapslight,\namedsimplefontparameter\v!light\c!regular}, - \c!italiccaps={\namedsimplefontparameter\v!light\c!caps}, - \c!slantedcaps={\namedsimplefontparameter\v!light\c!italiccaps}, - \c!boldcaps={\namedsimplefontparameter\v!light\c!caps}, - \c!bolditaliccaps={\namedsimplefontparameter\v!light\c!boldcaps}, - \c!boldslantedcaps={\namedsimplefontparameter\v!light\c!bolditaliccaps}] - -\getparameters - [\????sf\v!normal] - [ \c!regular={roman,regular,book,\empty}, - \c!italic={italic,it,oblique,kursiv,bookitalic,bookit,\namedsimplefontparameter\v!normal\c!regular}, - \c!slanted={\namedsimplefontparameter\v!normal\c!italic}, - \c!bold={bold,bd,kraeftig,mediumregular,semibold,demi,\namedsimplefontparameter\v!normal\c!regular}, - \c!bolditalic={bolditalic,boldit,bdit,boldoblique,mediumitalic,semibolditalic,demiitalic,\namedsimplefontparameter\v!normal\c!bold}, - \c!boldslanted={\namedsimplefontparameter\v!normal\c!bolditalic}, - \c!caps={smallcaps,capitals,sc,\namedsimplefontparameter\v!normal\c!regular}, - \c!italiccaps={\namedsimplefontparameter\v!normal\c!caps}, - \c!slantedcaps={\namedsimplefontparameter\v!normal\c!italiccaps}, - \c!boldcaps={scbold,\namedsimplefontparameter\v!normal\c!caps}, - \c!bolditaliccaps={\namedsimplefontparameter\v!normal\c!boldcaps}, - \c!boldslantedcaps={\namedsimplefontparameter\v!normal\c!bolditaliccaps}] - -\getparameters - [\????sf\v!medium] - [ \c!regular={mediumregular,medregular,medium}, - \c!italic={mediumitalic,meditalic,\namedsimplefontparameter\v!medium\c!regular}, - \c!slanted={\namedsimplefontparameter\v!medium\c!italic}, - \c!bold={heavyregular,heavy,\namedsimplefontparameter\v!medium\c!regular}, - \c!bolditalic={heavyitalic,\namedsimplefontparameter\v!medium\c!bold}, - \c!boldslanted={\namedsimplefontparameter\v!medium\c!bolditalic}, - \c!caps={mediumcaps,\namedsimplefontparameter\v!medium\c!regular}, - \c!italiccaps={\namedsimplefontparameter\v!medium\c!caps}, - \c!slantedcaps={\namedsimplefontparameter\v!medium\c!italiccaps}, - \c!boldcaps={\namedsimplefontparameter\v!medium\c!caps}, - \c!bolditaliccaps={\namedsimplefontparameter\v!medium\c!boldcaps}, - \c!boldslantedcaps={\namedsimplefontparameter\v!medium\c!bolditaliccaps}] - -\getparameters - [\????sf\v!heavy] - [ \c!regular={heavyregular,heavy}, - \c!italic={heavyitalic,\namedsimplefontparameter\v!heavy\c!regular}, - \c!slanted={\namedsimplefontparameter\v!heavy\c!italic}, - \c!bold={\namedsimplefontparameter\v!heavy\c!regular}, - \c!bolditalic={\namedsimplefontparameter\v!heavy\c!bold}, - \c!boldslanted={\namedsimplefontparameter\v!heavy\c!bolditalic}, - \c!caps={\namedsimplefontparameter\v!heavy\c!regular}, - \c!italiccaps={\namedsimplefontparameter\v!heavy\c!caps}, - \c!slantedcaps={\namedsimplefontparameter\v!heavy\c!italiccaps}, - \c!boldcaps={\namedsimplefontparameter\v!heavy\c!caps}, - \c!bolditaliccaps={\namedsimplefontparameter\v!heavy\c!boldcaps}, - \c!boldslantedcaps={\namedsimplefontparameter\v!heavy\c!bolditaliccaps}] - -\startprocesscommacommand[\simplefonts!weight] - - \ctxlua{thirddata.simplefonts.extlist["#1"] = { }} - - { - - \startprocesscommacommand[\simplefonts!alternative] - - \ctxlua{thirddata.simplefonts.extlist["#1"]["##1"] = { }} - - { - - \startprocesscommacommand[\namedsimplefontparameter{#1}{##1}] - - \ctxlua{table.insert(thirddata.simplefonts.extlist["#1"]["##1"],"####1")} - - \stopprocesscommacommand - - } - - \stopprocesscommacommand - - } - -\stopprocesscommacommand - -%D Default setup - -\enabledirectives[fonts.autoreload] - -\setupsimplefonts - [\c!size=\moduleparameter\v!simplefonts\c!size, - \c!style=\moduleparameter\v!simplefonts\c!style, - \c!features=\v!default, - \c!smallcapsfeatures=\v!smallcaps, - \c!mode=\v!node, - \c!force=\v!yes, - \c!check=\v!no, - \c!expansion=\v!no, - \c!protrusion=\v!no] - -%D Default fonts - -\setmainfont [Latin Modern Roman] -\setsansfont [Latin Modern Sans] -\setmonofont [Latin Modern Mono][\s!features=\s!none] -\setmathfont [Latin Modern Math] -\sethandwritingfont [Latin Modern Roman] % neither handwritten nor calligraphic are available -\setcalligraphicfont[Latin Modern Roman] % for Latin Modern but I need a default font for them - -\!!donesimplefontstrue - -\stopmodule - -\protect \endinput |