diff options
| -rw-r--r-- | tex/context/base/back-exp.lua | 98 | ||||
| -rw-r--r-- | tex/context/base/cont-new.mkii | 2 | ||||
| -rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
| -rw-r--r-- | tex/context/base/context.mkii | 2 | ||||
| -rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
| -rw-r--r-- | tex/context/base/export-example.css | 663 | ||||
| -rw-r--r-- | tex/context/base/export-example.tex | 71 | ||||
| -rw-r--r-- | tex/context/base/font-ini.mkiv | 2 | ||||
| -rw-r--r-- | tex/context/base/grph-inc.lua | 58 | ||||
| -rw-r--r-- | tex/context/base/math-tag.lua | 2 | ||||
| -rw-r--r-- | tex/context/base/phys-dim.mkiv | 32 | ||||
| -rw-r--r-- | tex/context/base/spac-ali.mkiv | 8 | ||||
| -rw-r--r-- | tex/context/base/spac-ver.mkiv | 61 | ||||
| -rw-r--r-- | tex/context/base/status-files.pdf | bin | 23613 -> 23629 bytes | |||
| -rw-r--r-- | tex/context/base/status-lua.pdf | bin | 155954 -> 155951 bytes | |||
| -rw-r--r-- | tex/context/base/strc-tag.lua | 1 | ||||
| -rw-r--r-- | tex/context/base/strc-tag.mkiv | 4 | ||||
| -rw-r--r-- | tex/generic/context/luatex-fonts-merged.lua | 2 | 
18 files changed, 907 insertions, 103 deletions
| diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index 47d6c0037..2aaa0cf39 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -453,6 +453,8 @@ function extras.sorting(result,element,detail,n,fulltag,di)      end  end +local usedimages = { } +  function extras.image(result,element,detail,n,fulltag,di)      local hash = attributehash[fulltag]      if hash then @@ -464,15 +466,37 @@ function extras.image(result,element,detail,n,fulltag,di)                  local name = file.basename(fullname)                  local path = file.dirname(fullname)                  local page = figure.page or 1 +                local width = figure.width or 0 +                local height = figure.height or 0 +                local currentimage = { }                  if name ~= "" then                      result[#result+1] = format(" name='%s'",name) +                    currentimage.name = name +                    if file.extname(name) == "pdf" then +                        -- temp hack .. we will have a remapper +                        name = file.replacesuffix(name,"svg") +                    end +                    currentimage.filename = name                  end                  if path ~= "" then                      result[#result+1] = format(" path='%s'",path) +                    currentimage.path = path                  end                  if page > 1 then                      result[#result+1] = format(" page='%s'",page) +                    currentimage.page = page +                end +                if width > 0 then +                    width = number.todimen(width,"cm","%0.3fcm") +                    result[#result+1] = format(" width='%s'",width) +                    currentimage.width = width +                end +                if height > 0 then +                    height = number.todimen(height,"cm","%0.3fcm") +                    result[#result+1] = format(" ysize='%s'",height) +                    currentimage.height = height                  end +                usedimages[#usedimages+1] = currentimage              end          end      end @@ -730,7 +754,7 @@ local function checkmath(root) -- we can provide utf.toentities as an option                  local tg = d.tg                  if automathrows and roottg == "mrow" then                      -- maybe just always ! check spec first -                    if tg == "mrow" or tg == "mfenced" or tg == "mfrac" or tg == "mroot" then +                    if tg == "mrow" or tg == "mfenced" or tg == "mfrac" or tg == "mroot" or tg == "msqrt"then                          root.skip = "comment"                      elseif tg == "mo" then                          root.skip = "comment" @@ -760,6 +784,13 @@ local function checkmath(root) -- we can provide utf.toentities as an option                      end                      checkmath(di)                      i = i + 1 +                elseif tg == "mroot" then +                    if #di.data == 1 then +                        -- else firefox complains +                        di.element = "msqrt" +                    end +                    checkmath(di) +                    i = i + 1                  elseif tg == "break" then                      di.skip = "comment"                      i = i + 1 @@ -1169,14 +1200,23 @@ local function begintag(result,element,nature,depth,di,skip)      used[element][detail or ""] = nature -- for template css      local metadata = tagmetadata[fulltag]      if metadata then -     -- used[element] = "mixed" -        metadata = table.toxml(metadata,"metadata",true,depth*2,2) -- nobanner +     -- metadata = table.toxml(metadata,"metadata",true,depth*2,2) -- nobanner +     -- if not linedone then +     --     result[#result+1] = format("\n%s\n",metadata) +     --     linedone = true +     -- else +     --     result[#result+1] = format("%s\n",metadata) +     -- end          if not linedone then -            result[#result+1] = format("\n%s\n",metadata) -        else -            result[#result+1] = format("%s\n",metadata) +            result[#result+1] = "\n" +            linedone = true          end -        linedone = true +        result[#result+1] = format("%s<metadata>\n",spaces[depth]) +        for k, v in table.sortedpairs(metadata) do +            v = utfgsub(v,".",entities) +            result[#result+1] = format("%s<metavariable name=%q>%s</metavariable>\n",spaces[depth+1],k,v) +        end +        result[#result+1] = format("%s</metadata>\n",spaces[depth])      end  end @@ -2019,6 +2059,15 @@ local csspreamble = [[  --     >  -- ]] +local imagetemplate = [[ +image[name="%s"] { +    display          : block ; +    background-image : url(%s) ; +    background-size  : 100%% auto ; +    width            : %s ; +    height           : %s ; +}]] +  local cssfile, xhtmlfile = nil, nil  directives.register("backend.export.css",  function(v) cssfile   = v end) @@ -2047,7 +2096,16 @@ local function stopexport(v)          files = files,      }      report_export("saving xml data in '%s",xmlfile) +    --      local results = { } +    -- collect tree +    local result  = { } +    flushtree(result,tree.data,"display",0) -- we need to collect images +    result = concat(result) +    result = gsub(result,"\n *\n","\n") +    result = gsub(result,"\n +([^< ])","\n%1") +    -- +    local imgfile = file.addsuffix(file.removesuffix(xmlfile) .. "-images","css")      results[#results+1] = format(xmlpreamble,tex.jobname,os.date(),environment.version,exportversion)      if cssfile then          local cssfiles = settings_to_array(cssfile) @@ -2062,20 +2120,32 @@ local function stopexport(v)              report_export("adding css reference '%s",cssfile)              results[#results+1] = format(csspreamble,cssfile)          end +        if #usedimages > 0 then +            results[#results+1] = format(csspreamble,imgfile) +        end      end -    -- collect tree -    local result  = { } -    flushtree(result,tree.data,"display",0) -    result = concat(result) -result = gsub(result,"\n *\n","\n") -result = gsub(result,"\n +([^< ])","\n%1") +    --      results[#results+1] = result +    --      results = concat(results)      -- if needed we can do a cleanup of the tree (no need to load for xhtml then)      -- write to file      io.savedata(xmlfile,results)      -- css template file      if cssfile then +        if #usedimages > 0 then +            report_export("saving css image definitions in '%s",imgfile) +            local result = { format("/* images for file %s */",xmlfile) } +            for i=1,#usedimages do +                local im = usedimages[i] +                -- todo: path +                result[#result+1] = format(imagetemplate,im.name,im.filename,im.width,im.height) +            end +            io.savedata(imgfile,concat(result,"\n\n")) +        else +            os.remove(imgfile) +        end +        --          local cssfile = file.replacesuffix(xmlfile,"template")          report_export("saving css template in '%s",cssfile)          local templates = { format("/* template for file %s */",xmlfile) } @@ -2091,6 +2161,8 @@ result = gsub(result,"\n +([^< ])","\n%1")              end          end          io.savedata(cssfile,concat(templates,"\n\n")) +    else +        os.remove(imgfile)      end      -- xhtml references      if xhtmlfile then diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 690d597db..dc6ae455a 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@  %C therefore copyrighted by \PRAGMA. See mreadme.pdf for  %C details. -\newcontextversion{2011.06.15 11:49} +\newcontextversion{2011.06.16 00:34}  %D This file is loaded at runtime, thereby providing an  %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 5a21fec55..8a183de5c 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@  %C therefore copyrighted by \PRAGMA. See mreadme.pdf for  %C details. -\newcontextversion{2011.06.15 11:49} +\newcontextversion{2011.06.16 00:34}  %D This file is loaded at runtime, thereby providing an  %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index cf8fd7b67..124d3e62c 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@  %D your styles an modules.  \edef\contextformat {\jobname} -\edef\contextversion{2011.06.15 11:49} +\edef\contextversion{2011.06.16 00:34}  %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 9f86a94fd..2980629a6 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@  %D your styles an modules.  \edef\contextformat {\jobname} -\edef\contextversion{2011.06.15 11:49} +\edef\contextversion{2011.06.16 00:34}  %D For those who want to use this: diff --git a/tex/context/base/export-example.css b/tex/context/base/export-example.css new file mode 100644 index 000000000..75a74994a --- /dev/null +++ b/tex/context/base/export-example.css @@ -0,0 +1,663 @@ +/* + +	author    : Hans Hagen, PRAGMA-ADE, Hasselt NL +	copyright : PRAGMA ADE / ConTeXt Development Team +	license   : see context related readme files +	comment   : companion to context.mkiv + +*/ + +/* ignore  : mixed   */ +/* metadata: display */ + +ignore { +	display : none ; +} + +xmetadata { +	display : none ; +} + +xmetavariable { +	display : none ; +} + +/* document : display */ + +document:before { +	content       : attr(title) ; +	font-size     : 44pt ; +	font-weight   : bold ; +	margin-bottom : 1em ; +} + +document { +	font-family : "Lucida Bright", "DejaVu Serif", serif ; +	font-size   : 12pt ; +	width       : 50em ; +	padding     : 1em ; +} + +document>metadata { +	font-family   : "Lucida Console", "DejaVu Sans Mono", monospace ; +	margin-bottom : 2em ; +} + +document>metadata>metavariable[name="title"]:before { +	content : "title\00A0\00A0\00A0:\00A0" ; +} + +document>metadata>metavariable[name="author"]:before { +		content : "author\00A0\00A0:\00A0" ; +} + +document>metadata>metavariable[name="version"]:before { +	content : "version\00A0:\00A0" ; +} + +document>metadata>metavariable[name="title"], document>metadata>metavariable[name="author"], document>metadata>metavariable[name="version"] { +	display : block ; +} + +/* paragraph : mixed */ +/* p         : mixed */ + +paragraph, p { +	display       : block ; +	margin-top    : 0.5em ; +	margin-bottom : 0.5em ; +} + +/* break : display */ + +break { +	display       : block ; +	margin-bottom : 0.5em ; +} + +/* construct : inline */ + +construct { +} + +construct[detail="important"] { +	font-weight : bold ; +} + +/* section        : display */ +/* sectiontitle   : mixed   */ +/* sectionnumber  : mixed   */ +/* sectioncontent : display */ + +section { +	display : block ; +} + +sectioncontent { +	display       : block ; +	margin-top    : 1em ; +	margin-bottom : 1em ; +} + +section[detail="chapter"], section[detail="title"] { +	margin-top    : 3em ; +	margin-bottom : 2em ; +} + +section[detail="section"], section[detail="subject"] { +	margin-top    : 2.5em ; +	margin-bottom : 2.5em ; +} + +section[detail="subsection"], section[detail="subsubject"] { +	margin-top    : 2em ; +	margin-bottom : 2em ; +} + +section[detail="subsubsection"], section[detail="subsubsubject"] { +	margin-top    : 1em ; +	margin-bottom : 0em ; +} + +section[detail="summary"], section[detail="subsummary"] { +	margin-top    : 1em ; +	margin-bottom : 1em ; +} + +section[detail="chapter"]>sectionnumber { +	display      : inline-block ; +	margin-right : 1em ; +	font-size    : 3em ; +	font-weight  : bold ; +} + +section[detail="chapter"]>sectiontitle, section[detail="title"]>sectiontitle { +	font-size   : 3em ; +	font-weight : bold ; +} + +section[detail="section"]>sectiontitle, section[detail="subject"]>sectiontitle { +	font-size   : 2.5em ; +	font-weight : bold ; +} + +section[detail="subsection"]>sectiontitle, section[detail="subsubject"]>sectiontitle{ +	font-size   : 2em ; +	font-weight : bold ; +} + +section[detail="subsubsection"]>sectiontitle, section[detail="subsubsubject"]>sectiontitle{ +	font-size   : 1em ; +	font-weight : bold ; +} + +section[detail="section"]>sectionnumber { +	display      : inline-block ; +	margin-right : 1em ; +	font-size    : 2.5em ; +	font-weight  : bold ; +} + +section[detail="summary"]>sectiontitle { +	display             : block ; +	margin-top          : 1em ; +	margin-bottom       : 1em ; +	font-weight         : bold ; +	border-bottom-style : solid ; +	border-color        : rgb(50%,50%,100%) ; +	border-width        : .15em; +} + +section[detail="subsection"]>sectionnumber { +	display      : inline-block ; +	margin-right : 1em ; +	font-size    : 2em ; +	font-weight  : bold ; +} + +section[detail="subsection"]>sectionnumber { +	display      : inline-block ; +	margin-right : 1em ; +	font-size    : 1em ; +	font-weight  : bold ; +} + +section[detail="subsummary"]>sectiontitle { +	display             : block ; +	margin-top          : 1em ; +	margin-bottom       : 1em ; +	font-weight         : bold ; +	border-color        : rgb(50%,50%,100%) ; +	border-bottom-style : dotted ; +	border-width        : .15em ; +} + +/* itemgroup   : display */ +/* item        : display */ +/* itemtag     : mixed   */ +/* itemcontent : mixed   */ + +itemgroup { +	display       : block ; +	margin-bottom : 0.5em ; +	margin-top    : 0.5em ; +} + +itemgroup[symbol="1"] { list-style-type : disc ; } +itemgroup[symbol="2"] { list-style-type : square ; } +itemgroup[symbol="3"] { list-style-type : square ; } +itemgroup[symbol="4"] { list-style-type : square ; } +itemgroup[symbol="5"] { list-style-type : circ ; } +itemgroup[symbol="a"] { list-style-type : lower-alpha ; } +itemgroup[symbol="A"] { list-style-type : alpha ; } +itemgroup[symbol="r"] { list-style-type : lower-roman ; } +itemgroup[symbol="R"] { list-style-type : upper-roman ; } +itemgroup[symbol="n"] { list-style-type : decimal ; } +itemgroup[symbol="g"] { list-style-type : lower-greek ; } +itemgroup[symbol="G"] { list-style-type : upper-greek ; } + +item { +	display       : list-item ; +	margin-left   : 1em ; +	margin-bottom : 0.5em ; +	margin-top    : 0.5em ; +} + +itemtag { +	display: none ; +} + +itemcontent { +} + +/* description        : display */ +/* descriptiontag     : mixed   */ +/* descriptioncontent : mixed   */ +/* descriptionsymbol  : inline  */ + +description { +	display       : block ; +	margin-bottom : 1em ; +	margin-top    : 1em ; +} + +descriptiontag { +    float        : left ; +    clear        : left ; +	margin-right : 1em ; +    text-align   : left ; +    font-weight  : bold ; +} + +descriptioncontent { +} + +descriptionsymbol { +} + +/* verbatimblock      : display */ +/* verbatimlines      : display */ +/* verbatimline       : mixed   */ +/* verbatim           : inline  */ + +verbatimblock { +	background-color : rgb(50%,50%,100%) ; +	display          : block ; +	padding          : 1em ; +	margin-bottom    : 1em ; +	margin-top       : 1em ; +	font-family      : "Lucida Console", "DejaVu Sans Mono", monospace ; +} + +verbatimlines+verbatimlines { +	display    : block ; +	margin-top : 1em ; +} + +verbatimline { +	display     : block ; +	white-space : pre-wrap ; +} + +verbatim { +	white-space : pre-wrap ; +	color       : rgb(60%,60%,0%) ; +	font-family : "Lucida Console", "DejaVu Sans Mono", monospace ; +} + +/* lines : display */ +/* line  : mixed   */ + +lines { +	display       : block ; +	margin-bottom : 1em ; +	margin-top    : 1em ; +} + +lines+lines { +	display    : block ; +	margin-top : 1em ; +} + +line { +	display     : block ; +	white-space : pre-wrap ; +} + +/* synonym : inline  */ +/* sorting : inline  */ + +sorting, synonym { +	display      : inline ; +	font-variant : small-caps ; +} + +/* register          : display */ +/* registersection   : display */ +/* registertag       : mixed   */ +/* registerentries   : display */ +/* registerentry     : mixed   */ +/* registersee       : mixed   */ +/* registerpages     : mixed   */ +/* registerpage      : inline  */ +/* registerpagerange : mixed   */ + +register { +	display: none ; +} + +/* table     : display */ +/* tablerow  : display */ +/* tablecell : mixed   */ + +table { +	display : table ; +} + +tablerow { +	display : table-row ; +} + +tablecell[align="middle"] { +	display    : table-cell ; +	text-align : center ; +	padding    : .1em ; +} + +tablecell[align="flushleft"] { +	display    : table-cell ; +	text-align : left ; +	padding    : .1em ; +} + +tablecell[align="flushright"] { +	display    : table-cell ; +	text-align : right ; +	padding    : .1em ; +} + +tablecell { +	display    : table-cell ; +	text-align : left ; +	padding    : .1em ; +} + +/* tabulate     : display */ +/* tabulaterow  : display */ +/* tabulatecell : mixed   */ + +tabulate { +	display       : table ; +	margin-top    : 1em ; +	margin-bottom : 1em ; +	margin-left   : 2.5em ; +} + +tabulaterow { +	display : table-row ; +} + +tabulatecell[align="middle"] { +	display       : table-cell ; +	text-align    : center ; +	padding-right : 1em ; +} + +tabulatecell[align="flushleft"] { +	display       : table-cell ; +	text-align    : left ; +	padding-right : 1em ; +} + +tabulatecell[align="flushright"] { +	display       : table-cell ; +	text-align    : right ; +	padding-right : 1em ; +} + +tabulatecell { +	display       : table-cell ; +	text-align    : left ; +	padding-right : 1em ; +} + +/* list        : display */ +/* listitem    : display */ +/* listtag     : mixed   */ +/* listcontent : mixed   */ +/* listdata    : mixed   */ +/* listpage    : mixed   */ + +list { +	display : block ; +} + +listitem[detail="chapter"] { +	display     : block ; +	margin-top  : 1em ; +	font-weight : bold ; +} + +listitem[detail="section"] { +	display : block ; +} + +listitem[detail="subsection"] { +	display : block ; +} + +listtag { +	display : inline-block ; +	width   : 5em ; +} + +listcontent { +} + +listdata { +} + +listpage { +	display : none ; +} + +/* delimitedblock : display */ +/* delimited      : inline  */ +/* subsentence    : inline  */ + +/* :lang(en) */ + +delimited[detail="quotation"]:before, delimitedblock[detail="quotation"]:before { +	content : "\201C" ; +} + +delimited[detail="quotation"]:after, delimitedblock[detail="quotation"]:after { +	content : "\201D" ; +} + +delimited[detail="quote"]:before, delimitedblock[detail="quote"]:before { +	content : "\2018" ; +} + +delimited[detail="quote"]:after, delimitedblock[detail="quote"]:after { +	content : "\2019" ; +} + +delimited { +    display : inline +} + +delimitedblock { +    display : block +} + +subsentence:before, subsentence:after { +	content : "\2014" ; +} + +subsentence { +    display : inline +} + +/* label  : mixed   */ +/* number : mixed   */ + +/* float        : display */ +/* floatcaption : mixed   */ +/* floatlabel   : inline  */ +/* floatnumber  : inline  */ +/* floattext    : mixed   */ +/* floatcontent : mixed   */ + +float { +	display       : block ; +	margin-top    : 1em ; +	margin-bottom : 1em ; +	margin-left   : 2.5em ; +} + +floatcaption { +	display    : block ; +	margin-top : 0.5em ; +	color      : rgb(60%,60%,0%) ; +} + +floatlabel { +	font-weight  : bold ; +	margin-right : 1em ; +} + +floatnumber { +	font-weight : bold ; +} + +floattext { +} + +floatcontent { +} + +/* image     : mixed */ +/* mpgraphic : mixed */ + +/* image { +    display         : block ; +    background      : url(hacker.jpg) ; +    background-size : 100% auto ; +    width           : 8.992cm ; +    height          : 5.994cm ; +} */ + +mpgraphic:before { /* does not work with empty element */ +	content : "[runtime metapost graphic]" ; +} + +mpgraphic { +	display : inline ; +} + +/* formula        : display */ +/* subformula     : display */ +/* formulaset     : display */ +/* formulacaption : mixed   */ +/* formulalabel   : mixed   */ +/* formulanumber  : mixed   */ +/* formulacontent : display */ + +formula { +	display       : block ; +	margin-top    : 1em ; +	margin-bottom : 1em ; +	margin-left   : 2.5em ; +} + +subformula { /* todo */ +	display       : block ; +	margin-top    : 1em ; +	margin-bottom : 1em ; +	margin-left   : 2.5em ; +} + +formulaset { /* todo */ +	display       : block ; +	margin-top    : 1em ; +	margin-bottom : 1em ; +	margin-left   : 2.5em ; +} + +formulacaption { /* todo */ +	display    : block ; +	margin-top : 0.5em ; +	color      : rgb(60%,60%,0%) ; +} + +formulalabel { +	font-weight  : bold ; +	margin-right : 1em ; +} + +formulanumber { +	font-weight : bold ; +} + +formulacontent { +	display : block ; +} + +/* link : inline  */ + +/* margintextblock : inline  */ +/* margintext      : inline  */ + +/* math       : inline  */ +/* mn         : mixed   */ +/* mi         : mixed   */ +/* mo         : mixed   */ +/* ms         : mixed   */ +/* mrow       : display */ +/* msubsup    : display */ +/* msub       : display */ +/* msup       : display */ +/* merror     : mixed   */ +/* munderover : display */ +/* munder     : display */ +/* mover      : display */ +/* mtext      : mixed   */ +/* mfrac      : display */ +/* mroot      : display */ +/* msqrt      : display */ +/* mfenced    : display */ +/* maction    : display */ +/* mtable     : display */ +/* mtr        : display */ +/* mtd        : display */ + +/* quantity : inline */ +/* unit     : inline */ +/* number   : inline */ + +quantity { +} + +quantity>unit { +} + +quantity>number { +} + +/* sub    : inline */ +/* sup    : inline */ +/* subsup : inline */ + +sup { +	font-size      : xx-small ; +    line-height    : 0 ; +	vertical-align : top ; +} + +sub { +	font-size      : xx-small ; +    line-height    : 0 ; +	vertical-align : bottom ; +} + + +subsup>sup { +	vertical-align : top ; +} + +subsup>sub { +	vertical-align : bottom ; +} + +/* xhtml */ + +a[href] { +	text-decoration : none ; +	color           : inherit ; +} + +a[href]:hover { +	color           : rgb(50%,0%,0%) ; +	text-decoration : underline ; +} diff --git a/tex/context/base/export-example.tex b/tex/context/base/export-example.tex new file mode 100644 index 000000000..8584d74a5 --- /dev/null +++ b/tex/context/base/export-example.tex @@ -0,0 +1,71 @@ +\setupbackend +  [export=export-example.xml, +   css=export-example.css] + +\definedescription +  [description] + +\settaggedmetadata +  [title=Export Example, +   author=Hans Hagen, +   version=0.1] + +\setupbodyfont +  [dejavu] + +\starttext + +\startchapter[title=Example] + +\typefile{export.tex} + +\startparagraph \input zapf (Zapf) \stopparagraph + +\placefigure +  {} +  {\externalfigure[hacker.jpg]} + +\startparagraph \input zapf (Zapf) \stopparagraph + +\placefigure +  {} +  {\externalfigure[mill.png]} + +\startparagraph \input tufte (Tufte) \stopparagraph + +\placefigure +  {} +  {\externalfigure[cow.pdf]} + +\startparagraph \input tufte (Tufte) \stopparagraph + +\startitemize[1] +    \startitem \input ward (Ward) \stopitem +    \startitem \input knuth (Knuth) \stopitem +\stopitemize + +\startitemize[2] +    \startitem \input zapf (Zapf) \stopitem +    \startitem \input tufte (Tufte) \stopitem +\stopitemize + +\startparagraph \input zapf (Zapf) \stopparagraph + +\startdescription {Ward} \input ward \stopdescription + +\startdescription {Tufte} \input tufte \stopdescription + +\startparagraph \input knuth (Knuth) \stopparagraph + +\startformula +e = mc^2 +\stopformula + +\startparagraph +Okay, it's somewhat boring to always use the same formula, so how about +$\sqrt{4} = 2$ or traveling at \unit{120 km/h} instead of $\unit{110 km/h}$. +\stopparagraph + +\stopchapter + +\stoptext diff --git a/tex/context/base/font-ini.mkiv b/tex/context/base/font-ini.mkiv index 29a84cd66..62ac058d7 100644 --- a/tex/context/base/font-ini.mkiv +++ b/tex/context/base/font-ini.mkiv @@ -4331,7 +4331,7 @@    {\iffirstargument       \setuvalue{#1}{\styleinstance[#1]}%       \def\docommand##1% -       {\def\dodocommand####1{\letbeundefined{\??sx##1:####1:\commalistelement}}% +       {\def\dodocommand####1{\letbeundefined{\??sx#1:##1:####1}}%          \processcommacommand[\fontalternativelist,\s!default]\dodocommand}%       \processcommacommand[\fontstylelist,\s!default]\docommand     \fi} diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua index e41453513..5c2207749 100644 --- a/tex/context/base/grph-inc.lua +++ b/tex/context/base/grph-inc.lua @@ -301,7 +301,7 @@ local function new() -- we could use metatables status -> used -> request but it      }  end - -- use table.insert|remove +-- use table.insert|remove  local lastfiguredata = nil -- will be topofstack or last so no { } (else problems with getfiguredimensions)  local callstack      = { } @@ -402,8 +402,8 @@ local function register(askedname,specification)                      newformat = defaultformat                  end                  if trace_conversion then -                    report_inclusion("checking conversion of '%s': old format '%s', new format '%s', conversion '%s', resolution '%s'", -                        askedname,format,newformat,conversion or "default",resolution or "default") +                    report_inclusion("checking conversion of '%s' (%s): old format '%s', new format '%s', conversion '%s', resolution '%s'", +                        askedname,specification.fullname,format,newformat,conversion or "default",resolution or "default")                  end                  local converter = (newformat ~= format) and converters[format]                  if converter then @@ -422,8 +422,7 @@ local function register(askedname,specification)                      report_inclusion("no converter for '%s' -> '%s'",format,newformat)                  end                  if converter then -                 -- local oldname = specification.fullname -                    local oldname = specification.foundname +                    local oldname = specification.fullname                      local newpath = file.dirname(oldname)                      local oldbase = file.basename(oldname)                      local newbase = file.removesuffix(oldbase) @@ -435,7 +434,7 @@ local function register(askedname,specification)                      end                      if not file.is_writable(newpath) then                          if trace_conversion then -                            report_inclusion("[ath '%s'is not writable, forcing conversion path '.' ",newpath) +                            report_inclusion("path '%s'is not writable, forcing conversion path '.' ",newpath)                          end                          newpath = "."                      end @@ -459,12 +458,12 @@ local function register(askedname,specification)                      local newtime = lfs.attributes(newname,'modification') or 0                      if newtime == 0 or oldtime > newtime then                          if trace_conversion then -                            report_inclusion("converting '%s' from '%s' to '%s'",askedname,format,newformat) +                            report_inclusion("converting '%s' (%s) from '%s' to '%s'",askedname,oldname,format,newformat)                          end                          converter(oldname,newname,resolution or "")                      else                          if trace_conversion then -                            report_inclusion("no need to convert '%s' from '%s' to '%s'",askedname,format,newformat) +                            report_inclusion("no need to convert '%s' (%s) from '%s' to '%s'",askedname,oldname,format,newformat)                          end                      end                      if io.exists(newname) then @@ -556,10 +555,10 @@ local function locate(request) -- name, format, cache              if foundname then                  return register(askedname, {                      askedname  = askedname, -                    fullname   = askedname, +                    fullname   = foundname, -- askedname,                      format     = format,                      cache      = askedcache, -                    foundname  = foundname, +--~                     foundname  = foundname,                      conversion = askedconversion,                      resolution = askedresolution,                  }) @@ -571,10 +570,11 @@ local function locate(request) -- name, format, cache          end          if askedpath then              -- path and type given, todo: strip pieces of path -            if figures.exists(askedname,askedformat,resolve_too) then +            local foundname = figures.exists(askedname,askedformat,resolve_too) +            if foundname then                  return register(askedname, {                      askedname  = askedname, -                    fullname   = askedname, +                    fullname   = foundname, -- askedname,                      format     = askedformat,                      cache      = askedcache,                      conversion = askedconversion, @@ -625,10 +625,11 @@ local function locate(request) -- name, format, cache              for j=1,#list do                  local suffix = list[j]                  local check = file.addsuffix(askedname,suffix) -                if figures.exists(check,format,resolve_too) then +                local foundname = figures.exists(check,format,resolve_too) +                if foundname then                      return register(askedname, {                          askedname  = askedname, -                        fullname   = check, +                        fullname   = foundname, -- check,                          format     = format,                          cache      = askedcache,                          conversion = askedconversion, @@ -659,15 +660,18 @@ local function locate(request) -- name, format, cache                              if trace_figures then                                  report_inclusion("warning: skipping path %s",path)                              end -                        elseif figures.exists(check,format,true) then -                            return register(askedname, { -                                askedname  = askedname, -                                fullname   = check, -                                format     = format, -                                cache      = askedcache, -                                conversion = askedconversion, -                                resolution = askedresolution, -                            }) +                        else +                            local foundname = figures.exists(check,format,true) +                            if foundname then +                                return register(askedname, { +                                    askedname  = askedname, +                                    fullname   = foundname, -- check +                                    format     = format, +                                    cache      = askedcache, +                                    conversion = askedconversion, +                                    resolution = askedresolution, +                                }) +                            end                          end                      end                  end @@ -686,10 +690,11 @@ local function locate(request) -- name, format, cache                      for k=1,#list do                          local suffix = list[k]                          local check = path .. "/" .. file.replacesuffix(askedbase,suffix) -                        if figures.exists(check,format,resolve_too) then +                        local foundname = figures.exists(check,format,resolve_too) +                        if foundname then                              return register(askedname, {                                  askedname  = askedname, -                                fullname   = check, +                                fullname   = foudname, -- check,                                  format     = format,                                  cache      = askedcache,                                  conversion = askedconversion, @@ -839,8 +844,7 @@ function checkers.generic(data)      if not resolution or resolution == "" then          resolution = "unknown"      end -    local hash = name .. "->" .. page .. "->" .. size .. "->" .. color .. "->" .. conversion .. "->" .. resolution -        .. "->" .. mask +    local hash = name .. "->" .. page .. "->" .. size .. "->" .. color .. "->" .. conversion .. "->" .. resolution .. "->" .. mask      local figure = figures.loaded[hash]      if figure == nil then          figure = img.new { diff --git a/tex/context/base/math-tag.lua b/tex/context/base/math-tag.lua index a5dfc933a..ce7c9c864 100644 --- a/tex/context/base/math-tag.lua +++ b/tex/context/base/math-tag.lua @@ -285,7 +285,7 @@ process = function(start) -- we cannot use the processor as we have no finalizer                  process(left) -- root symbol, ignored                  stop_tagged()              end -            if degree then +            if degree then -- not good enough, can be empty mlist                  set_attribute(start,a_tagged,start_tagged("mroot"))                  processsubsup(start)                  process(degree) diff --git a/tex/context/base/phys-dim.mkiv b/tex/context/base/phys-dim.mkiv index 5a44be53d..0c56ed1b3 100644 --- a/tex/context/base/phys-dim.mkiv +++ b/tex/context/base/phys-dim.mkiv @@ -129,6 +129,7 @@  \newconstant   \c_units_mode   % 0=text  1=math  \newconstant   \c_units_state  % 0=start 1=suffix 2=operator 3=unit 4=prefix 5=number +\newconditional\c_units_quantity  \newconditional\c_units_number  % tags and export @@ -183,18 +184,18 @@  \let\units_finish\relax  \unexpanded\def\unitsNstart -  {\ifmmode -   \else -     \dostarttagged{quantity}\empty -     \dostarttagged{number}\empty +  {\ifmmode \else +     \settrue\c_units_quantity +     \dostarttagged\t!quantity\empty +     \settrue\c_units_number +     \dostarttagged\t!number\empty     \fi}  \unexpanded\def\unitsNstop -  {\ifmmode -   \else +  {\ifconditional\c_units_number +     \setfalse\c_units_number       \dostoptagged     \fi -   %\units_start     \c_units_state\plusfive}  \unexpanded\def\unitsN#1% @@ -202,22 +203,27 @@  \def\units_start    {\ifmmode -     \dostarttagged\t!mathaction{unit}% +     \dostarttagged\t!mathaction\t!unit       \bgroup % make an mrow     \else -     \dostarttagged{unit}\empty +     \dostarttagged\t!unit\empty     \fi     \let\units_finish\units_stop     \let\units_start\relax}  \def\units_stop -  {\ifmmode -     \egroup +  {\ifconditional\c_units_number +     \setfalse\c_units_number +     \dostoptagged     \fi -   \ifconditional\c_units_number +   \ifconditional\c_units_quantity +     \setfalse\c_units_quantity       \dostoptagged     \fi -   \dostoptagged} +   \dostoptagged +   \ifmmode +     \egroup +   \fi}  \def\unitsraise    {\ifnum\c_units_mode=\plusone diff --git a/tex/context/base/spac-ali.mkiv b/tex/context/base/spac-ali.mkiv index 2901ad127..7285d9eea 100644 --- a/tex/context/base/spac-ali.mkiv +++ b/tex/context/base/spac-ali.mkiv @@ -105,19 +105,19 @@  \def\dosetraggedvbox#1% can be more keys    {\let\raggedbox\vbox -   \processcommacommand[#1]\dosetraggedvbox} +   \processcommacommand[#1]\dodosetraggedvbox}  \def\dosetraggedhbox#1% can be more keys    {\let\raggedbox\hbox -   \processcommacommand[#1]\dosetraggedhbox} +   \processcommacommand[#1]\dodosetraggedhbox} -\def\dosetraggedvbox#1% +\def\dodosetraggedvbox#1%    {\ifcsname\@@ragged@@vbox#1\endcsname       \csname\@@ragged@@vbox#1\endcsname       \quitcommalist     \fi} -\def\dosetraggedhbox#1% +\def\dodosetraggedhbox#1%    {\ifcsname\@@ragged@@hbox#1\endcsname       \csname\@@ragged@@hbox#1\endcsname       \quitcommalist diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv index 4602b2d7f..09f5e5836 100644 --- a/tex/context/base/spac-ver.mkiv +++ b/tex/context/base/spac-ver.mkiv @@ -145,7 +145,7 @@  \def\interlinespaceparameter          #1{\csname\dointerlinespaceparameter{\??it\currentinterlinespace}#1\endcsname}  \def\dointerlinespaceparameter      #1#2{\ifcsname#1#2\endcsname#1#2\else\expandafter\dointerlinespaceparentparameter\csname#1\s!parent\endcsname#2\fi} -\def\dointerlinespaceparentparameter#1#2{\ifx#1\relax\s!empty\else\dointerlinespaceparameter#1#2\fi} +\def\dointerlinespaceparentparameter#1#2{\ifx#1\relax\s!empty\else\dointerlinespaceparameter#1#2\fi} % \s!empty ?  \newconditional\interlinespaceisset @@ -878,7 +878,7 @@  \setvalue{@strut@\v!fit    }{\setfontstrut}  \setvalue{@strut@\v!line   }{\setstrut}  \setvalue{@strut@\s!default}{\setstrut} -\setvalue{@strut@\s!empty  }{\setstrut} +\setvalue{@strut@\empty    }{\setstrut}  \unexpanded\def\setupstrut    {\dosingleempty\dosetupstrut} @@ -1771,25 +1771,9 @@  %D Contrary to \MKII\ we can now define classes of lines (generalized by  %D Wolfgang). I will probably rewrite bits in \LUA. -\let\currentlines\empty +\installcommandhandler \??rg {lines} \??rg -\def\linesparameter    #1{\csname\dolinesparameter{\??rg\currentlines}#1\endcsname} -\def\linesparameterhash#1{\dolinesparameterhash   {\??rg\currentlines}#1} - -\def\dolinesparameter    #1#2{\ifcsname#1#2\endcsname#1#2\else\expandafter\dolinesparentparameter    \csname#1\s!parent\endcsname#2\fi} -\def\dolinesparameterhash#1#2{\ifcsname#1#2\endcsname  #1\else\expandafter\dolinesparentparameterhash\csname#1\s!parent\endcsname#2\fi} - -\def\dolinesparentparameter    #1#2{\ifx#1\relax\s!empty\else\dolinesparameter    #1#2\fi} -\def\dolinesparentparameterhash#1#2{\ifx#1\relax        \else\dolinesparameterhash#1#2\fi} - -\def\dosetlinesattributes#1#2% style color -  {\edef\fontattributehash {\linesparameterhash#1}% -   \edef\colorattributehash{\linesparameterhash#2}% -   \ifx\fontattributehash \empty\else\dosetfontattribute \fontattributehash #1\fi -   \ifx\colorattributehash\empty\else\dosetcolorattribute\colorattributehash#2\fi} - -\getparameters -  [\??rg] +\setuplines    [\c!option=,     \c!command=,     \c!before=\blank, @@ -1798,24 +1782,12 @@     \c!indenting=\v!no,     \c!space=\v!default] -\unexpanded\def\definelines -  {\dodoubleempty\dodefinelines} - -\def\dodefinelines[#1][#2]% -  {\getparameters[\??rg#1][\s!parent=\??rg,#2]% -   \setvalue{\e!start#1}{\dostartlines[#1]}% -   \setvalue{\e!stop #1}{\dostoplines}} - -\unexpanded\def\setuplines -  {\dodoubleempty\dosetuplines} - -\def\dosetuplines[#1][#2]% -  {\doifelsenothing{#2} -     {\getparameters[\??rg][#1]} -     {\def\docommand##1{\getparameters[\??rg##1][#2]}% -      \processcommacommand[#1]\docommand}} +\appendtoks +   \setuevalue{\e!start\currentlines}{\dostartlines[\currentlines]}% +   \setuevalue{\e!stop \currentlines}{\dostoplines}% +\to \everydefinelines -\def\dostartlines[#1]% +\unexpanded\def\dostartlines[#1]%    {\bgroup     \edef\currentlines{#1}%     \obeylines @@ -1843,16 +1815,22 @@        \gdef\afterfirstobeyedline          {\ifx\linesoption\v!packed\nobreak\fi           \linesparameter\c!command}}% -   \dostarttagged\t!line\empty     \def\obeyedline       {\dostoptagged        \par        \dostarttagged\t!line\empty        \futurelet\next\dobetweenthelines}%     \activatespacehandler{\linesparameter\c!space}% +   \dostarttagged\t!line\empty     \GotoPar} -\def\dostoplines +\def\afterfirstobeyedline_indeed % tzt two pass, net als opsomming +  {\linesparameter\c!command +   \gdef\afterfirstobeyedline +     {\ifx\linesoption\v!packed\nobreak\fi +      \linesparameter\c!command}}% + +\unexpanded\def\dostoplines    {\dostoptagged     \endgroup     \dostoptagged @@ -1873,4 +1851,9 @@  \def\doemptylines[#1]%    {\endgraf\dorecurse{\iffirstargument#1\else3\fi}\crlf} +\ifdefined\startlines \else +  \expandafter\let\expandafter\startlines\csname\e!start\v!lines\endcsname +  \expandafter\let\expandafter\stoplines \csname\e!stop \v!lines\endcsname +\fi +  \protect \endinput diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdfBinary files differ index 950214b82..32bfa2650 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdfBinary files differ index f7c9125f0..cbce48dac 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-tag.lua b/tex/context/base/strc-tag.lua index 544dceef9..be8e3f5c8 100644 --- a/tex/context/base/strc-tag.lua +++ b/tex/context/base/strc-tag.lua @@ -158,6 +158,7 @@ local properties  = allocate {      ignore             = { pdf = "Span",       nature = "mixed"   },      metadata           = { pdf = "Div",        nature = "display" }, +    metavariable       = { pdf = "Span",       nature = "mixed"   },      sub                = { pdf = "Span",       nature = "inline"  },      sup                = { pdf = "Span",       nature = "inline"  }, diff --git a/tex/context/base/strc-tag.mkiv b/tex/context/base/strc-tag.mkiv index 51a1d7154..e57a12b6b 100644 --- a/tex/context/base/strc-tag.mkiv +++ b/tex/context/base/strc-tag.mkiv @@ -123,6 +123,10 @@  \def\t!sup               {sup}                    % Span  \def\t!subsup            {subsup}                 % Span +\def\t!unit              {unit}                   % Span +\def\t!quantity          {quantity}               % Span +\def\t!number            {number}                 % Span +  % \setuptaglabeltext  %   [en]  %   [\t!document=document] diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index a33c517e0..831a39164 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@  -- merged file : luatex-fonts-merged.lua  -- parent file : luatex-fonts.lua --- merge date  : 06/15/11 11:49:24 +-- merge date  : 06/16/11 00:34:14  do -- begin closure to overcome local limits and interference | 
