diff options
author | Marius <mariausol@gmail.com> | 2011-09-18 23:40:29 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2011-09-18 23:40:29 +0300 |
commit | 4530daff791f4e5e6b9ded048cad042b9e4ec46f (patch) | |
tree | 385eeb2618f1331f6b7a0cf736ac0c1c8fbd3c96 | |
parent | 6a1645d499e26ab02b365dd4b93da771815d8c0d (diff) | |
download | context-4530daff791f4e5e6b9ded048cad042b9e4ec46f.tar.gz |
beta 2011.09.18 22:35
35 files changed, 524 insertions, 149 deletions
diff --git a/context/data/scite/lexers/scite-context-lexer-lua.lua b/context/data/scite/lexers/scite-context-lexer-lua.lua index 49799a978..62577d4a9 100644 --- a/context/data/scite/lexers/scite-context-lexer-lua.lua +++ b/context/data/scite/lexers/scite-context-lexer-lua.lua @@ -12,6 +12,8 @@ local P, R, S, C, Cg, Cb, Cs, Cmt = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cg, lpe local match, find = string.match, string.find local global = _G +-- beware: all multiline is messy, so even if it's no lexer, it should be an embedded lexer + module(...) local cldlexer = _M diff --git a/context/data/scite/lexers/scite-context-lexer-mps.lua b/context/data/scite/lexers/scite-context-lexer-mps.lua index 2d8cc3a70..afde63bcc 100644 --- a/context/data/scite/lexers/scite-context-lexer-mps.lua +++ b/context/data/scite/lexers/scite-context-lexer-mps.lua @@ -15,7 +15,6 @@ local type, next, pcall, loadfile = type, next, pcall, loadfile module(...) local metafunlexer = _M -local basepath = lexer.context and lexer.context.path or _LEXERHOME local metafunhelpers = { } local metafunconstants = { } diff --git a/context/data/scite/lexers/scite-context-lexer-tex.lua b/context/data/scite/lexers/scite-context-lexer-tex.lua index 340c3f75e..0866b35b4 100644 --- a/context/data/scite/lexers/scite-context-lexer-tex.lua +++ b/context/data/scite/lexers/scite-context-lexer-tex.lua @@ -45,8 +45,6 @@ local contextlexer = _M local cldlexer = lexer.load('scite-context-lexer-cld') local mpslexer = lexer.load('scite-context-lexer-mps') -local basepath = lexer.context and lexer.context.path or _LEXERHOME - local commands = { en = { } } local primitives = { } local helpers = { } @@ -111,9 +109,14 @@ local knowncommand = Cmt(cstoken^1, function(_,i,s) return currentcommands[s] and i end) -local validwords = false +local wordpattern = lexer.context.wordpattern +local checkedword = lexer.context.checkedword +local setwordlist = lexer.context.setwordlist +local validwords = false + +-- % language=uk -local knownpreamble = Cmt(P("% "), function(input,i,_) +local knownpreamble = Cmt(#P("% "), function(input,i,_) -- todo : utfbomb if i < 10 then validwords = false local s, e, word = find(input,'^(.+)[\n\r]',i) -- combine with match @@ -123,7 +126,7 @@ local knownpreamble = Cmt(P("% "), function(input,i,_) currentcommands = commands[interface] or commands.en or { } end local language = match(word,"language=(..)") - validwords = language and lexer.context.setwordlist(language) + validwords = language and setwordlist(language) end end return false @@ -195,26 +198,34 @@ local p_text = cstoken^1 --maybe add punctuation and space -- no looking back = #(1-S("[=")) * cstoken^3 * #(1-S("=]")) -local p_word = Cmt(cstoken^3, function(_,i,s) - if not validwords then - return true, { "text", i } +-- local p_word = Cmt(wordpattern, function(_,i,s) +-- if not validwords then +-- return true, { "text", i } +-- else +-- -- keys are lower +-- local word = validwords[s] +-- if word == s then +-- return true, { "okay", i } -- exact match +-- elseif word then +-- return true, { "warning", i } -- case issue +-- else +-- local word = validwords[lower(s)] +-- if word == s then +-- return true, { "okay", i } -- exact match +-- elseif word then +-- return true, { "warning", i } -- case issue +-- else +-- return true, { "error", i } +-- end +-- end +-- end +-- end) + +local p_word = Cmt(wordpattern, function(_,i,s) + if validwords then + return checkedword(validwords,s,i) else - -- keys are lower - local word = validwords[s] - if word == s then - return true, { "okay", i } -- exact match - elseif word then - return true, { "warning", i } -- case issue - else - local word = validwords[lower(s)] - if word == s then - return true, { "okay", i } -- exact match - elseif word then - return true, { "warning", i } -- case issue - else - return true, { "error", i } - end - end + return true, { "text", i } end end) @@ -274,7 +285,7 @@ local csname = token('user', p_csname ) local grouping = token('grouping', p_grouping ) local special = token('special', p_special ) local extra = token('extra', p_extra ) -local text = token('default', p_text ) +----- text = token('default', p_text ) ----- word = token("okay", p_word ) local word = p_word diff --git a/context/data/scite/lexers/scite-context-lexer-xml-cdata.lua b/context/data/scite/lexers/scite-context-lexer-xml-cdata.lua new file mode 100644 index 000000000..71826099c --- /dev/null +++ b/context/data/scite/lexers/scite-context-lexer-xml-cdata.lua @@ -0,0 +1,22 @@ +local lexer = lexer +local token = lexer.token +local P = lpeg.P + +module(...) + +local commentlexer = _M + +local whitespace = commentlexer.WHITESPACE -- triggers states + +local space = lexer.space +local nospace = 1 - space - P("]]>") + +local p_spaces = token(whitespace, space ^1) +local p_cdata = token("comment", nospace^1) + +_rules = { + { "whitespace", p_spaces }, + { "cdata", p_cdata }, +} + +_tokenstyles = lexer.context.styleset diff --git a/context/data/scite/lexers/scite-context-lexer-xml-comment.lua b/context/data/scite/lexers/scite-context-lexer-xml-comment.lua new file mode 100644 index 000000000..2d9ce66bd --- /dev/null +++ b/context/data/scite/lexers/scite-context-lexer-xml-comment.lua @@ -0,0 +1,31 @@ +local lexer = lexer +local token = lexer.token +local P = lpeg.P + +module(...) + +local commentlexer = _M + +local whitespace = commentlexer.WHITESPACE -- triggers states + +local space = lexer.space +local nospace = 1 - space - P("-->") + +local p_spaces = token(whitespace, space ^1) +local p_comment = token("comment", nospace^1) + +_rules = { + { "whitespace", p_spaces }, + { "comment", p_comment }, +} + +_tokenstyles = lexer.context.styleset + +_foldsymbols = { + _patterns = { + "<%!%-%-", "%-%->", -- comments + }, + ["comment"] = { + ["<!--"] = 1, ["-->" ] = -1, + } +} diff --git a/context/data/scite/lexers/scite-context-lexer-xml.lua b/context/data/scite/lexers/scite-context-lexer-xml.lua new file mode 100644 index 000000000..0441585c1 --- /dev/null +++ b/context/data/scite/lexers/scite-context-lexer-xml.lua @@ -0,0 +1,202 @@ +local info = { + version = 1.002, + comment = "scintilla lpeg lexer for metafun", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +-- adapted from the regular context pretty printer code (after all, lexing +-- boils down to much of the same and there are only so many ways to do +-- things). Simplified a bit as we have a different nesting model. + +-- todo: parse entities in attributes + +local lexer = lexer +local global, string, table, lpeg = _G, string, table, lpeg +local token, style, colors, exact_match, no_style = lexer.token, lexer.style, lexer.colors, lexer.exact_match, lexer.style_nothing +local P, R, S, V, C, Cmt = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.C, lpeg.Cmt +local type, setmetatable = type, setmetatable +local match, find = string.match, string.find + +module(...) + +local examplelexer = _M + +local whitespace = examplelexer.WHITESPACE -- triggers states + +local space = lexer.space -- S(" \t\n\r\v\f") +local any = lexer.any -- P(1) + +local dquote = P('"') +local squote = P("'") +local colon = P(":") +local semicolon = P(";") +local equal = P("=") +local ampersand = P("&") + +local name = (R("az","AZ","09") + S('_-.'))^1 +local openbegin = P("<") +local openend = P("</") +local closebegin = P("/>") + P(">") +local closeend = P(">") +local opencomment = P("<!--") +local closecomment = P("-->") +local openinstruction = P("<?") +local closeinstruction = P("?>") +local opencdata = P("<![CDATA[") +local closecdata = P("]]>") + +local entity = ampersand * (1-semicolon)^1 * semicolon + +local wordpattern = lexer.context.wordpattern +local checkedword = lexer.context.checkedword +local setwordlist = lexer.context.setwordlist +local validwords = false + +-- <?xml version="1.0" encoding="UTF-8" language="uk" ?> +-- +-- <?context-xml-directive editor language us ?> + +local p_preamble = Cmt(#P("<?xml "), function(input,i,_) -- todo: utf bomb + if i < 10 then + validwords = false + local language = match(input,"^<%?xml[^>]*%?>%s*<%?context%-xml%-directive%s+editor%s+language%s+(..)%s+%?>") + if not language then + language = match(input,'^<%?xml[^>]*language=[\"\'](..)[\"\'][^>]*%?>',i) + end + if language then + validwords = setwordlist(language) + end + end + return false +end) + + +local p_word = + Cmt(wordpattern, function(_,i,s) + if validwords then + return checkedword(validwords,s,i) + else + return true, { "text", i } + end + end) + +local p_rest = + token("default", any) + +local p_text = + token("default", (1-S("<>&")-space)^1) + +local p_spacing = + token(whitespace, space^1) + +local p_optionalwhitespace = + p_spacing^0 + +local p_localspacing = + token("default", space^1) + +-- Because we want a differently colored open and close we need an embedded lexer (whitespace +-- trigger). What is actually needed is that scintilla applies the current whitespace style. +-- Even using different style keys is not robust as they can be shared. I'll fix the main +-- lexer code. + +local p_sstring = + token("quote",dquote) + * token("string",(1-dquote)^0) -- different from context + * token("quote",dquote) + +local p_dstring = + token("quote",squote) + * token("string",(1-squote)^0) -- different from context + * token("quote",squote) + +-- local p_comment = +-- token("command",opencomment) +-- * token("comment",(1-closecomment)^0) -- different from context +-- * token("command",closecomment) + +-- local p_cdata = +-- token("command",opencdata) +-- * token("comment",(1-closecdata)^0) -- different from context +-- * token("command",closecdata) + +local commentlexer = lexer.load("scite-context-lexer-xml-comment") +local cdatalexer = lexer.load("scite-context-lexer-xml-cdata") + +lexer.embed_lexer(examplelexer, commentlexer, token("command",opencomment), token("command",closecomment)) +lexer.embed_lexer(examplelexer, cdatalexer, token("command",opencdata), token("command",closecdata)) + +-- maybe cdata just text (then we don't need the extra lexer as we only have one comment then) + +local p_name = + token("plain",name) + * ( + token("default",colon) + * token("keyword",name) + )^1 + + token("keyword",name) + +local p_key = p_name + +local p_attributes = ( + p_optionalwhitespace + * p_key + * p_optionalwhitespace + * token("plain",equal) + * p_optionalwhitespace + * (p_dstring + p_sstring) + * p_optionalwhitespace +)^0 + +local p_open = + token("keyword",openbegin) + * p_name + * p_optionalwhitespace + * p_attributes + * token("keyword",closebegin) + +local p_close = + token("keyword",openend) + * p_name + * p_optionalwhitespace + * token("keyword",closeend) + +local p_entity = + token("constant",entity) + +local p_instruction = + token("command",openinstruction * P("xml")) + * p_optionalwhitespace + * p_attributes + * p_optionalwhitespace + * token("command",closeinstruction) + + token("command",openinstruction * name) + * token("default",(1-closeinstruction)^1) + * token("command",closeinstruction) + +_rules = { + { "whitespace", p_spacing }, + { "preamble", p_preamble }, + { "word", p_word }, +-- { "text", p_text }, +-- { "comment", p_comment }, +-- { "cdata", p_cdata }, + { "instruction", p_instruction }, + { "close", p_close }, + { "open", p_open }, + { "entity", p_entity }, + { "rest", p_rest }, +} + +_tokenstyles = lexer.context.styleset + +_foldsymbols = { -- somehow doesn't work yet + _patterns = { + "[<>]", + }, + ["keyword"] = { + ["<"] = 1, [">"] = -1, + }, +} diff --git a/context/data/scite/lexers/scite-context-lexer.lua b/context/data/scite/lexers/scite-context-lexer.lua index 20af5d68f..a2bb35a57 100644 --- a/context/data/scite/lexers/scite-context-lexer.lua +++ b/context/data/scite/lexers/scite-context-lexer.lua @@ -9,6 +9,11 @@ local info = { -- The fold and lex functions are copied and patched from original code by Mitchell (see -- lexer.lua). All errors are mine. -- +-- I'll probably make a whole copy and patch the other functions too as we need an extra +-- nesting model. +-- +-- Also needed: preamble scan once. Can be handled in caller below and _M.preamble. +-- -- For huge files folding can be pretty slow and I do have some large ones that I keep -- open all the time. Loading is normally no ussue, unless one has remembered the status -- and the cursor is at the last line of a 200K line file. Optimizing the fold function @@ -24,6 +29,9 @@ local info = { -- an issue we can rewrite the main lex function (memorize the grammars and speed up the -- byline variant). +-- Maybe it's safer to copy th eother methods here so that we have no dependencies, apart +-- from the the library. + local R, P, S, C, Cp, Cs, Ct, Cmt, Cc, Cf, Cg = lpeg.R, lpeg.P, lpeg.S, lpeg.C, lpeg.Cp, lpeg.Cs, lpeg.Ct, lpeg.Cmt, lpeg.Cc, lpeg.Cf, lpeg.Cg local lpegmatch = lpeg.match local find, gmatch, match, lower, upper, gsub = string.find, string.gmatch, string.match, string.lower, string.upper, string.gsub @@ -158,6 +166,74 @@ function lexer.context.exact_match(words,word_chars,case_insensitive) end end + +-- spell checking (we can only load lua files) + +-- return { +-- words = { +-- ["someword"] = "someword", +-- ["anotherword"] = "Anotherword", +-- }, +-- } + +local lists = { } + +local splitter = (Cf(Ct("") * (Cg(C((1-S(" \t\n\r"))^1 * Cc(true))) + P(1))^1,rawset) )^0 +local splitter = (Cf(Ct("") * (Cg(C(R("az","AZ","\127\255")^1) * Cc(true)) + P(1))^1,rawset) )^0 + +local function splitwords(words) + return lpegmatch(splitter,words) +end + +function lexer.context.setwordlist(tag,limit) -- returns hash (lowercase keys and original values) + if not tag or tag == "" then + return false + elseif lists[tag] ~= nil then + return lists[tag] + else + local list = lexer.context.loaddefinitions("spell-" .. tag) + if not list or type(list) ~= "table" then + lists[tag] = false + return nil + elseif type(list.words) == "string" then + list = splitwords(list.words) + lists[tag] = list + return list + else + list = list.words or false + lists[tag] = list + return list + end + end +end + +lexer.context.wordpattern = R("az","AZ","\127\255")^3 -- todo: if limit and #s < limit then + +function lexer.context.checkedword(validwords,s,i) -- ,limit + if not validwords then + return true, { "text", i } + else + -- keys are lower + local word = validwords[s] + if word == s then + return true, { "okay", i } -- exact match + elseif word then + return true, { "warning", i } -- case issue + else + local word = validwords[lower(s)] + if word == s then + return true, { "okay", i } -- exact match + elseif word then + return true, { "warning", i } -- case issue + elseif upper(s) == s then + return true, { "warning", i } -- probably a logo or acronym + else + return true, { "error", i } + end + end + end +end + -- overloaded functions local FOLD_BASE = SC_FOLDLEVELBASE @@ -348,7 +424,7 @@ function lexer.context.lex(text,init_style) local noftokens = 0 if true then for line in gmatch(text,'[^\r\n]*\r?\n?') do -- could be an lpeg - local line_tokens = lpeg_match(grammar,line) + local line_tokens = lpegmatch(grammar,line) if line_tokens then for i=1,#line_tokens do local token = line_tokens[i] @@ -366,7 +442,7 @@ function lexer.context.lex(text,init_style) else -- alternative local lasttoken, lastoffset for line in gmatch(text,'[^\r\n]*\r?\n?') do -- could be an lpeg - local line_tokens = lpeg_match(grammar,line) + local line_tokens = lpegmatch(grammar,line) if line_tokens then for i=1,#line_tokens do lasttoken = line_tokens[i] @@ -431,37 +507,3 @@ lexer.fold = lexer.context.fold lexer.lex = lexer.context.lex lexer.token = lexer.context.token lexer.exact_match = lexer.context.exact_match - --- spell checking (we can only load lua files) - -local lists = { } - -local splitter = (Cf(Ct("") * (Cg(C((1-S(" \t\n\r"))^1 * Cc(true))) + P(1))^1,rawset) )^0 -local splitter = (Cf(Ct("") * (Cg(C(R("az","AZ","\127\255")^1) * Cc(true)) + P(1))^1,rawset) )^0 - -local function splitwords(words) - return lpegmatch(splitter,words) -end - -function lexer.context.setwordlist(tag) - if not tag or tag == "" then - return false - elseif lists[tag] ~= nil then - return lists[tag] - else - local list = collect("spell-" .. tag) - if not list or type(list) ~= "table" then - lists[tag] = false - return nil - elseif type(list.words) == "string" then - list = splitwords(list.words) - lists[tag] = list - return list - else - list = list.words or false - lists[tag] = list - return list - end - end -end - diff --git a/context/data/scite/lexers/themes/scite-context-theme.lua b/context/data/scite/lexers/themes/scite-context-theme.lua index 94f623cd8..ed1c5086b 100644 --- a/context/data/scite/lexers/themes/scite-context-theme.lua +++ b/context/data/scite/lexers/themes/scite-context-theme.lua @@ -13,6 +13,10 @@ local context_path = "t:/sources" -- c:/data/tex-context/tex/texmf-context/tex/b local font_name = 'Dejavu Sans Mono' local font_size = 14 +if not WIN32 then + font_name = '!' .. font_name +end + local global = _G -- dofile(_LEXERHOME .. '/themes/scite.lua') -- starting point so we miss nothing diff --git a/context/data/scite/scite-context-external.properties b/context/data/scite/scite-context-external.properties index 5cb0e8f98..14bdd222f 100644 --- a/context/data/scite/scite-context-external.properties +++ b/context/data/scite/scite-context-external.properties @@ -23,7 +23,7 @@ lexer.$(file.patterns.metafun)=lpeg_scite-context-lexer-mps lexer.$(file.patterns.context)=lpeg_scite-context-lexer-tex lexer.$(file.patterns.tex)=lpeg_scite-context-lexer-tex lexer.$(file.patterns.lua)=lpeg_scite-context-lexer-lua -lexer.$(file.patterns.xml)=lpeg_xml +lexer.$(file.patterns.example)=lpeg_scite-context-lexer-xml comment.block.lpeg_scite-context-lexer-tex=% comment.block.at.line.start.lpeg_scite-context-lexer-tex=1 @@ -37,6 +37,9 @@ comment.block.at.line.start.lpeg_scite-context-lexer-lua=1 comment.block.lpeg_scite-context-lexer-cld=-- comment.block.at.line.start.lpeg_scite-context-lexer-cld=1 +#~ comment.block.lpeg_scite-context-lexer-xml=<!-- +#~ comment.block.at.line.start.lpeg_scite-context-lexer-xml=1 + comment.block.lpeg_props=# comment.block.at.line.start.lpeg_props=1 diff --git a/context/data/scite/scite-context-readme.tex b/context/data/scite/scite-context-readme.tex index 6f32c87bc..57a99502c 100644 --- a/context/data/scite/scite-context-readme.tex +++ b/context/data/scite/scite-context-readme.tex @@ -126,6 +126,8 @@ {\em This is an updated but yet uncorrected version.} +{\em Todo: look into using lpeg without special library (might be faster).} + \SCITE\ is a source code editor written by Neil Hodgson. After playing with several editors we decided that this editor was quite configurable and extendible. diff --git a/context/data/scite/scite-ctx.lua b/context/data/scite/scite-ctx.lua index 72fcb967c..8db99693f 100644 --- a/context/data/scite/scite-ctx.lua +++ b/context/data/scite/scite-ctx.lua @@ -80,6 +80,8 @@ function traceln(str) io.flush() end +-- traceln("LPEG " .. tostring(lpeg)) + function string.grab(str,delimiter) local list = { } for snippet in gmatch(str,delimiter) do diff --git a/tex/context/base/cont-log.mkiv b/tex/context/base/cont-log.mkiv index c0ed606e0..0e866d665 100644 --- a/tex/context/base/cont-log.mkiv +++ b/tex/context/base/cont-log.mkiv @@ -250,4 +250,7 @@ \unexpanded\def\MKIV{MkIV} \unexpanded\def\MKVI{MkVI} +\unexpanded\def\MPII{MpII} +\unexpanded\def\MPIV{MpIV} + \protect \endinput diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index d90576138..95ada7443 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.09.17 15:56} +\newcontextversion{2011.09.18 22:35} %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 a2b5e8fc9..45c97a2ed 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.09.17 15:56} +\newcontextversion{2011.09.18 22:35} %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-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 94d1b8d35..f81c97e37 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex 876c4ab7d..df771f0c4 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index d7841eb80..00e384030 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.09.17 15:56} +\edef\contextversion{2011.09.18 22:35} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index b8b7378f4..35e92543f 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.09.17 15:56} +\edef\contextversion{2011.09.18 22:35} %D For those who want to use this: diff --git a/tex/context/base/l-pdfview.lua b/tex/context/base/l-pdfview.lua index c8cfa1229..3f4a8bea5 100644 --- a/tex/context/base/l-pdfview.lua +++ b/tex/context/base/l-pdfview.lua @@ -8,35 +8,63 @@ if not modules then modules = { } end modules ['l-pdfview'] = { -- Todo: figure out pdfopen/pdfclose on linux. Calling e.g. okular directly -- doesn't work in linux when issued from scite as it blocks the editor (no --- & possible or so). +-- & possible or so). Unfortunately pdfopen keeps changing with not keeping +-- downward compatibility (command line arguments and so). + +-- no 2>&1 any more, needs checking on windows local format, concat = string.format, table.concat pdfview = pdfview or { } -local opencalls = { - ['default'] = "pdfopen --ax --file", -- "pdfopen --back --file" - ['xpdf'] = "xpdfopen", -} +local opencalls, closecalls, allcalls, runner -local closecalls= { - ['default'] = "pdfclose --ax --file", - ['xpdf'] = nil, -} +if os.type == "windows" then -local allcalls = { - ['default'] = "pdfclose --ax --all", - ['xpdf'] = nil, -} + opencalls = { + ['default'] = "pdfopen --ax --file", -- --back --file --ax + ['acrobat'] = "pdfopen --ax --file", -- --back --file --ax + ['okular'] = 'start "test" "c:/data/system/kde/bin/okular.exe" --unique' -- todo! + } + closecalls= { + ['default'] = "pdfclose --ax --file", -- --ax + ['acrobat'] = "pdfclose --ax --file", -- --ax + ['okular'] = false, + } + allcalls = { + ['default'] = "pdfclose --ax --all", -- --ax + ['acrobat'] = "pdfclose --ax --all", -- --ax + ['okular'] = false, + } + + pdfview.method = "acrobat" + + runner = function(...) + os.execute(...) + end -if os.type == "windows" then - -- opencalls['okular'] = 'start "test" "c:/program files/kde/bin/okular.exe" --unique' -- todo: get focus - opencalls['okular'] = 'start "test" "c:/data/system/kde/bin/okular.exe" --unique' -- todo: get focus else - opencalls['okular'] = 'okular --unique' -end -pdfview.method = "default" + opencalls = { + ['default'] = "pdfopen", -- we could pass the default here + ['okular'] = 'okular --unique' + } + closecalls= { + ['default'] = "pdfclose --file", + ['okular'] = false, + } + allcalls = { + ['default'] = "pdfclose --all", + ['okular'] = false, + } + + pdfview.method = "okular" + + runner = function(...) + os.spawn(...) + end + +end directives.register("pdfview.method", function(v) pdfview.method = (opencalls[v] and v) or 'default' @@ -69,7 +97,7 @@ function pdfview.open(...) for i=1,#t do local name = fullname(t[i]) if io.exists(name) then - os.execute(format('%s "%s"', opencall, name)) -- no 2>&1 any more, needs checking on windows + runner(format('%s "%s"', opencall, name)) openedfiles[name] = true end end @@ -83,7 +111,7 @@ function pdfview.close(...) for i=1,#t do local name = fullname(t[i]) if openedfiles[name] then - os.execute(format('%s "%s"', closecall, name)) -- no 2>&1 any more, needs checking on windows + runner(format('%s "%s"', closecall, name)) openedfiles[name] = nil else pdfview.closeall() @@ -96,7 +124,7 @@ end function pdfview.closeall() local allcall = allcalls[pdfview.method] if allcall then - os.execute(format('%s', allcall)) -- no 2>&1 any more, needs checking on windows + runner(format('%s', allcall)) end openedfiles = { } end diff --git a/tex/context/base/mlib-pps.lua b/tex/context/base/mlib-pps.lua index 8034fbc32..330339c40 100644 --- a/tex/context/base/mlib-pps.lua +++ b/tex/context/base/mlib-pps.lua @@ -832,17 +832,24 @@ local function sh_process(object,prescript,before,after) local value_a, components_a, fractions_a, name_a local value_b, components_b, fractions_b, name_b for i=1,#prescript do + -- { "sh_color_a", "1" }, + -- { "sh_color", "into" }, + -- { "sh_radius_b", "0" }, + -- { "sh_radius_a", "141.73225" }, + -- { "sh_center_b", "425.19676 141.73225" }, + -- { "sh_center_a", "425.19676 0" }, + -- { "sh_factor", "1" }, local tag = prescript[i][1] if not name_a and tag == "sh_color_a" then - value_a = prescript[i-4][2] - components_a = prescript[i-3][2] - fractions_a = prescript[i-2][2] - name_a = prescript[i-1][2] + value_a = prescript[i-5][2] + components_a = prescript[i-4][2] + fractions_a = prescript[i-3][2] + name_a = prescript[i-2][2] elseif not name_b and tag == "sh_color_b" then - value_b = prescript[i-4][2] - components_b = prescript[i-3][2] - fractions_b = prescript[i-2][2] - name_b = prescript[i-1][2] + value_b = prescript[i-5][2] + components_b = prescript[i-4][2] + fractions_b = prescript[i-3][2] + name_b = prescript[i-2][2] end if name_a and name_b then break diff --git a/tex/context/base/s-abr-01.tex b/tex/context/base/s-abr-01.tex index 46336940d..51e2cb5a2 100644 --- a/tex/context/base/s-abr-01.tex +++ b/tex/context/base/s-abr-01.tex @@ -24,6 +24,8 @@ \logo [MKIII] {MkIII} % joke \logo [MKIV] {MkIV} \logo [MKVI] {MkVI} +\logo [MPII] {MpII} +\logo [MPIV] {MpIV} %logo [FGA] {fga} %logo [FGBBS] {fgbbs} diff --git a/tex/context/base/s-pre-62.tex b/tex/context/base/s-pre-62.tex index d4f2a54f8..cc9762e12 100644 --- a/tex/context/base/s-pre-62.tex +++ b/tex/context/base/s-pre-62.tex @@ -54,14 +54,13 @@ backspace=5\measure{layoutwd}, topspace=5\measure{layoutht}] -\setuplayout +\definelayout [step] [ backspace=\numexpr2+ \getvariable{layout}{dx}\relax\measure{layoutwd}, cutspace=\numexpr3+\getvariable{layout}{nx}-\getvariable{layout}{dx}\relax\measure{layoutwd}, topspace=\numexpr2+ \getvariable{layout}{dy}\relax\measure{layoutht}, bottomspace=\numexpr3+\getvariable{layout}{ny}-\getvariable{layout}{dy}\relax\measure{layoutht}] - \definecolor[layout:left] [t=.5,a=1,b=1] \definecolor[layout:right] [t=.5,a=1,r=1] \definecolor[layout:top] [t=.5,a=1,g=1] diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex edab0a6b8..2acd1ac05 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.pdf Binary files differindex eee3ffe94..0bd966ab6 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv index 1990e0d97..a2f011941 100644 --- a/tex/context/base/strc-sec.mkiv +++ b/tex/context/base/strc-sec.mkiv @@ -183,11 +183,11 @@ \unexpanded\def\setupsection {\dotripleempty\dosetupsection} -\def\dosetupsection[#1]% +\def\dosetupsection[#1][#2][#3]% {\ifcsname\??nh:\c!level:#1\endcsname - \dodosetupsection[#1]% + \dodosetupsection[#1][#2][#3]% \else - \dodosetupsection[\sectionheadsection{#1}]% + \dodosetupsection[\sectionheadsection{#1}][#2][#3]% \fi} \def\dodosetupsection[#1][#2][#3]% diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index a0f32c713..63718babd 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -966,7 +966,7 @@ {\begingroup\let\do_process_comma_item\do_quit_prev_comma_list} \def\do_quit_prev_comma_list#1]% - {\let\do_process_comma_item\do_quit_commalist} + {\let\do_process_comma_item\do_quit_comma_list} %D The hack we used for checking the next character %D \type {\doifnextcharelse} is also used here. @@ -6601,12 +6601,12 @@ % \setmeasure {xx} {1cm} % \setmeasure {xxx}{1cm} -\def\setmeasure #1#2{\expandafter\def \csname\??dm#1\endcsname{#2}} % quick way -\def\setemeasure#1#2{\expandafter\edef\csname\??dm#1\endcsname{#2}} % quick way -\def\setgmeasure#1#2{\expandafter\gdef\csname\??dm#1\endcsname{#2}} % quick way -\def\setxmeasure#1#2{\expandafter\xdef\csname\??dm#1\endcsname{#2}} % quick way +\unexpanded\def\setmeasure #1#2{\expandafter\def \csname\??dm#1\endcsname{#2}} % quick way +\unexpanded\def\setemeasure#1#2{\expandafter\edef\csname\??dm#1\endcsname{#2}} % quick way +\unexpanded\def\setgmeasure#1#2{\expandafter\gdef\csname\??dm#1\endcsname{#2}} % quick way +\unexpanded\def\setxmeasure#1#2{\expandafter\xdef\csname\??dm#1\endcsname{#2}} % quick way -\def\measure#1% +\def\measure#1% maybe \dimexpr ... \relax {\ifcsname\??dm#1\endcsname\csname\??dm#1\endcsname\else\zeropoint\fi} %D \macros diff --git a/tex/context/interface/cont-cs.xml b/tex/context/interface/cont-cs.xml index a7b246655..988f8476e 100644 --- a/tex/context/interface/cont-cs.xml +++ b/tex/context/interface/cont-cs.xml @@ -2,16 +2,18 @@ <!-- versions: - comment : user interface definitions of ConTeXt + comment : user interface definitions of ConTeXt - authors : Hans Hagen, Taco Hoekwater, Patrick Gundlach, Wolfgang Schuster, and others + authors : Hans Hagen, Taco Hoekwater, Patrick Gundlach, Wolfgang Schuster, and others - versions : 2004.11.17 : initial version - 2006.08.02 : define + resolve + versions : 2004.11.17 : initial version + 2006.08.02 : define + resolve + + <lexertest/>ss --> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cs" version="2006.08.02"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context test" language="cs" version="2006.08.02"> <cd:define name="align"> <cd:constant type="uvnitr"/> diff --git a/tex/context/interface/cont-de.xml b/tex/context/interface/cont-de.xml index 61441dd9c..ff375be46 100644 --- a/tex/context/interface/cont-de.xml +++ b/tex/context/interface/cont-de.xml @@ -2,16 +2,18 @@ <!-- versions: - comment : user interface definitions of ConTeXt + comment : user interface definitions of ConTeXt - authors : Hans Hagen, Taco Hoekwater, Patrick Gundlach, Wolfgang Schuster, and others + authors : Hans Hagen, Taco Hoekwater, Patrick Gundlach, Wolfgang Schuster, and others - versions : 2004.11.17 : initial version - 2006.08.02 : define + resolve + versions : 2004.11.17 : initial version + 2006.08.02 : define + resolve + + <lexertest/>ss --> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2006.08.02"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context test" language="de" version="2006.08.02"> <cd:define name="align"> <cd:constant type="innen"/> diff --git a/tex/context/interface/cont-en.xml b/tex/context/interface/cont-en.xml index b532f2b21..100148f42 100644 --- a/tex/context/interface/cont-en.xml +++ b/tex/context/interface/cont-en.xml @@ -2,16 +2,18 @@ <!-- versions: - comment : user interface definitions of ConTeXt + comment : user interface definitions of ConTeXt - authors : Hans Hagen, Taco Hoekwater, Patrick Gundlach, Wolfgang Schuster, and others + authors : Hans Hagen, Taco Hoekwater, Patrick Gundlach, Wolfgang Schuster, and others - versions : 2004.11.17 : initial version - 2006.08.02 : define + resolve + versions : 2004.11.17 : initial version + 2006.08.02 : define + resolve + + <lexertest/>ss --> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2006.08.02"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context test" language="en" version="2006.08.02"> <cd:define name="align"> <cd:constant type="inner"/> diff --git a/tex/context/interface/cont-fr.xml b/tex/context/interface/cont-fr.xml index 615eda784..d6096aa55 100644 --- a/tex/context/interface/cont-fr.xml +++ b/tex/context/interface/cont-fr.xml @@ -2,16 +2,18 @@ <!-- versions: - comment : user interface definitions of ConTeXt + comment : user interface definitions of ConTeXt - authors : Hans Hagen, Taco Hoekwater, Patrick Gundlach, Wolfgang Schuster, and others + authors : Hans Hagen, Taco Hoekwater, Patrick Gundlach, Wolfgang Schuster, and others - versions : 2004.11.17 : initial version - 2006.08.02 : define + resolve + versions : 2004.11.17 : initial version + 2006.08.02 : define + resolve + + <lexertest/>ss --> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2006.08.02"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context test" language="fr" version="2006.08.02"> <cd:define name="align"> <cd:constant type="interieur"/> diff --git a/tex/context/interface/cont-it.xml b/tex/context/interface/cont-it.xml index 5038f13ac..7675c612c 100644 --- a/tex/context/interface/cont-it.xml +++ b/tex/context/interface/cont-it.xml @@ -2,16 +2,18 @@ <!-- versions: - comment : user interface definitions of ConTeXt + comment : user interface definitions of ConTeXt - authors : Hans Hagen, Taco Hoekwater, Patrick Gundlach, Wolfgang Schuster, and others + authors : Hans Hagen, Taco Hoekwater, Patrick Gundlach, Wolfgang Schuster, and others - versions : 2004.11.17 : initial version - 2006.08.02 : define + resolve + versions : 2004.11.17 : initial version + 2006.08.02 : define + resolve + + <lexertest/>ss --> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2006.08.02"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context test" language="it" version="2006.08.02"> <cd:define name="align"> <cd:constant type="interno"/> diff --git a/tex/context/interface/cont-nl.xml b/tex/context/interface/cont-nl.xml index dbe1b0223..a84a88c0e 100644 --- a/tex/context/interface/cont-nl.xml +++ b/tex/context/interface/cont-nl.xml @@ -2,16 +2,18 @@ <!-- versions: - comment : user interface definitions of ConTeXt + comment : user interface definitions of ConTeXt - authors : Hans Hagen, Taco Hoekwater, Patrick Gundlach, Wolfgang Schuster, and others + authors : Hans Hagen, Taco Hoekwater, Patrick Gundlach, Wolfgang Schuster, and others - versions : 2004.11.17 : initial version - 2006.08.02 : define + resolve + versions : 2004.11.17 : initial version + 2006.08.02 : define + resolve + + <lexertest/>ss --> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2006.08.02"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context test" language="nl" version="2006.08.02"> <cd:define name="align"> <cd:constant type="binnen"/> diff --git a/tex/context/interface/cont-pe.xml b/tex/context/interface/cont-pe.xml index 12a54339d..94e042012 100644 --- a/tex/context/interface/cont-pe.xml +++ b/tex/context/interface/cont-pe.xml @@ -2,16 +2,18 @@ <!-- versions: - comment : user interface definitions of ConTeXt + comment : user interface definitions of ConTeXt - authors : Hans Hagen, Taco Hoekwater, Patrick Gundlach, Wolfgang Schuster, and others + authors : Hans Hagen, Taco Hoekwater, Patrick Gundlach, Wolfgang Schuster, and others - versions : 2004.11.17 : initial version - 2006.08.02 : define + resolve + versions : 2004.11.17 : initial version + 2006.08.02 : define + resolve + + <lexertest/>ss --> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="pe" version="2006.08.02"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context test" language="pe" version="2006.08.02"> <cd:define name="align"> <cd:constant type="داخلی"/> diff --git a/tex/context/interface/cont-ro.xml b/tex/context/interface/cont-ro.xml index b7fa62d59..8c12b7c35 100644 --- a/tex/context/interface/cont-ro.xml +++ b/tex/context/interface/cont-ro.xml @@ -2,16 +2,18 @@ <!-- versions: - comment : user interface definitions of ConTeXt + comment : user interface definitions of ConTeXt - authors : Hans Hagen, Taco Hoekwater, Patrick Gundlach, Wolfgang Schuster, and others + authors : Hans Hagen, Taco Hoekwater, Patrick Gundlach, Wolfgang Schuster, and others - versions : 2004.11.17 : initial version - 2006.08.02 : define + resolve + versions : 2004.11.17 : initial version + 2006.08.02 : define + resolve + + <lexertest/>ss --> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2006.08.02"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context test" language="ro" version="2006.08.02"> <cd:define name="align"> <cd:constant type="intern"/> diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 132562502..e4d504969 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 09/17/11 15:56:52 +-- merge date : 09/18/11 22:35:11 do -- begin closure to overcome local limits and interference |