diff options
author | Norbert Preining <preining@logic.at> | 2019-02-24 15:12:57 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2019-02-24 15:12:57 +0000 |
commit | 1314fbe93790c501dc436a5cf99f106b9e5c0f63 (patch) | |
tree | 04dc7734c8be8ffe385d41f4388826ef5857b6f9 /Master/texmf-dist/tex/context/base/mkiv/lxml-css.lua | |
parent | eb80ce7b34f59896a1dfee5ca422495394d6677f (diff) |
Revert "ConTeXt version 2019.02.22 19:35"
This reverts commit 5c6357cdb820b4f628d036ba7b2248f221d50c0b.
git-svn-id: svn://tug.org/texlive/trunk@50112 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/lxml-css.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/lxml-css.lua | 137 |
1 files changed, 20 insertions, 117 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/lxml-css.lua b/Master/texmf-dist/tex/context/base/mkiv/lxml-css.lua index b0f5c9b72f6..1787c53df18 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/lxml-css.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/lxml-css.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['lxml-css'] = { license = "see context related readme files" } -local tonumber, rawset, type, select = tonumber, rawset, type, select +local tonumber, rawset, type = tonumber, rawset, type local lower, format, find, gmatch = string.lower, string.format, string.find, string.gmatch local topattern, is_empty = string.topattern, string.is_empty local P, S, C, R, Cb, Cg, Carg, Ct, Cc, Cf, Cs = lpeg.P, lpeg.S, lpeg.C, lpeg.R, lpeg.Cb, lpeg.Cg, lpeg.Carg, lpeg.Ct, lpeg.Cc, lpeg.Cf, lpeg.Cs @@ -118,33 +118,24 @@ css.padding = padding -- print(padding("0",pixel,hsize,exheight,emwidth)) -local context = context - -if context then - - local currentfont = font.current - local texget = tex.get - local hashes = fonts.hashes - local quads = hashes.quads - local xheights = hashes.xheights - - local function todimension(str) - local font = currentfont() - local exheight = xheights[font] - local emwidth = quads[font] - local hsize = texget("hsize")/100 - local pixel = emwidth/100 - return dimension(str,pixel,hsize,exheight,emwidth) - end - - css.todimension = todimension - - function context.cssdimension(str) - -- context("%ssp",todimension(str)) - context(todimension(str) .. "sp") - end - -end +-- local currentfont = font.current +-- local texget = tex.get +-- local hashes = fonts.hashes +-- local quads = hashes.quads +-- local xheights = hashes.xheights +-- +-- local function padding(str) +-- local font = currentfont() +-- local exheight = xheights[font] +-- local emwidth = quads[font] +-- local hsize = texget("hsize")/100 +-- local pixel = emwidth/100 +-- return padding(str,pixel,hsize,exheight,emwidth) +-- end +-- +-- function css.simplepadding(str) +-- context("%ssp",padding(str,pixel,hsize,exheight,emwidth)) +-- end local pattern = Cf( Ct("") * ( Cg( @@ -958,7 +949,7 @@ local someaction = skipspace * colon * skipspace * (somevalue/ctx_sprint) -- -- cache patterns (2.13): -local patterns = setmetatableindex(function(t,k) +local patterns= setmetatableindex(function(t,k) local v = P(k * someaction + 1)^0 t[k] = v return v @@ -1002,91 +993,3 @@ interfaces.implement { actions = css.mappedstylevalue, arguments = "3 strings", } - --- more (for mm) - -local containsws = string.containsws -local classsplitter = lpeg.tsplitat(whitespace^1) - -function xml.functions.classes(e,class) -- cache - if class then - local at = e.at - local data = at[class] or at.class - if data then - return lpegmatch(classsplitter,data) or { } - end - end - return { } -end - --- function xml.functions.hasclass(e,class,name) --- if class then --- local at = e.at --- local data = at[class] or at.class --- if data then --- return data == name or containsws(data,name) --- end --- end --- return false --- end --- --- function xml.expressions.hasclass(attribute,name) --- if attribute then --- return attribute == name or containsws(attribute,name) --- end --- return false --- end - -function xml.functions.hasclass(e,class,name,more,...) - if class and name then - local at = e.at - local data = at[class] or at.class - if not data or data == "" then - return false - end - if data == name or data == more then - return true - end - if containsws(data,name) then - return true - end - if not more then - return false - end - if containsws(data,more) then - return true - end - for i=1,select("#",...) do - if containsws(data,select(i,...)) then - return true - end - end - end - return false -end - -function xml.expressions.hasclass(data,name,more,...) - if data then - if not data or data == "" then - return false - end - if data == name or data == more then - return true - end - if containsws(data,name) then - return true - end - if not more then - return false - end - if containsws(data,more) then - return true - end - for i=1,select("#",...) do - if containsws(data,select(i,...)) then - return true - end - end - end - return false -end |