summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2014-11-12 22:15:04 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2014-11-12 22:15:04 +0100
commit1de6c31af257171be8ba0d5c7e28896612214dca (patch)
tree078db3779e02ea07d4218e48a1dcbf69d53b7a17
parent58113383a37974c6d65694c80dbfabd96f29b4c2 (diff)
downloadcontext-1de6c31af257171be8ba0d5c7e28896612214dca.tar.gz
2014-11-12 21:48:00
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4392 -> 4387 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/core-con.lua66
-rw-r--r--tex/context/base/core-con.mkiv59
-rw-r--r--tex/context/base/lang-def.mkiv44
-rw-r--r--tex/context/base/publ-ini.lua6
-rw-r--r--tex/context/base/status-files.pdfbin24700 -> 24695 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin342480 -> 342642 bytes
-rw-r--r--tex/context/base/strc-doc.lua18
-rw-r--r--tex/context/base/strc-sec.mkiv1
-rw-r--r--tex/context/base/typo-wrp.lua9
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
13 files changed, 126 insertions, 83 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index a6dcfb992..887899070 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{2014.11.12 18:16}
+\newcontextversion{2014.11.12 21:46}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index a733bef02..902b45c8c 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 051bf6508..38ebbad4b 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -28,7 +28,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2014.11.12 18:16}
+\edef\contextversion{2014.11.12 21:46}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/core-con.lua b/tex/context/base/core-con.lua
index e805b23e9..6aaed7954 100644
--- a/tex/context/base/core-con.lua
+++ b/tex/context/base/core-con.lua
@@ -42,6 +42,8 @@ converters.numbers = tonumber
commands.number = context
commands.numbers = context
+ctx_doifelse = commands.doifelse
+
-- to be reconsidered ... languages namespace here, might become local plus a register command
local counters = allocate {
@@ -157,6 +159,9 @@ counters['koreannumerals'] = counters['korean']
counters['koreanparentnumerals'] = counters['korean-parent']
counters['koreancirclenumerals'] = counters['korean-circle']
+counters['sloveniannumerals'] = counters['slovenian']
+counters['spanishnumerals'] = counters['spanish']
+
local fallback = utfbyte('0')
local function chr(n,m)
@@ -218,13 +223,11 @@ local function do_alphabetic(n,mapping,mapper,t) -- todo: make zero based varian
end
end
-function converters.alphabetic(n,code)
- return do_alphabetic(n,code and counters[code] or defaultcounter,lowercharacter)
-end
+local function alphabetic(n,code) return do_alphabetic(n,code and counters[code] or defaultcounter,lowercharacter) end
+local function Alphabetic(n,code) return do_alphabetic(n,code and counters[code] or defaultcounter,uppercharacter) end
-function converters.Alphabetic(n,code)
- return do_alphabetic(n,code and counters[code] or defaultcounter,uppercharacter)
-end
+converters.alphabetic = alphabetic
+converters.Alphabetic = Alphabetic
local lower_offset = 96
local upper_offset = 64
@@ -282,7 +285,7 @@ function commands.second () context(date("%S")) end
function commands.textime() context(textime()) end
function commands.doifleapyearelse(year)
- commands.doifelse(isleapyear(year))
+ ctx_doifelse(isleapyear(year))
end
local roman = {
@@ -515,6 +518,20 @@ converters['cn'] = converters.chinesenumerals
converters['cn-c'] = converters.chinesecapnumerals
converters['cn-a'] = converters.chineseallnumerals
+-- this is a temporary solution: we need a better solution when we have
+-- more languages
+
+function converters.spanishnumerals(n) return alphabetic(n,"es") end
+function converters.Spanishnumerals(n) return Alphabetic(n,"es") end
+function converters.sloviannumerals(n) return alphabetic(n,"sl") end
+function converters.Sloviannumerals(n) return Alphabetic(n,"sl") end
+
+converters['characters:es'] = converters.spanishnumerals
+converters['characters:sl'] = converters.sloveniannumerals
+
+converters['Characters:es'] = converters.Spanishnumerals
+converters['Characters:sl'] = converters.Sloveniannumerals
+
function commands.chinesenumerals (n) context(tochinese(n,"normal")) end
function commands.chinesecapnumerals(n) context(tochinese(n,"cap" )) end
function commands.chineseallnumerals(n) context(tochinese(n,"all" )) end
@@ -524,40 +541,49 @@ local sequences = converters.sequences
storage.register("converters/sequences", sequences, "converters.sequences")
-function converters.define(name,set)
+function converters.define(name,set) -- ,language)
+ -- if language then
+ -- name = name .. ":" .. language
+ -- end
sequences[name] = settings_to_array(set)
end
commands.defineconversion = converters.define
-local function convert(method,n) -- todo: language
- local converter = converters[method]
+local function convert(method,n,language)
+ local converter = language and converters[method..":"..language] or converters[method]
if converter then
return converter(n)
else
local lowermethod = lower(method)
- local linguistic = counters[lowermethod]
+ local linguistic = counters[lowermethod]
if linguistic then
return do_alphabetic(n,linguistic,lowermethod == method and lowercharacter or uppercharacter)
end
local sequence = sequences[method]
if sequence then
- local max = #sequence
- if n > max then
- return sequence[(n-1) % max + 1]
- else
- return sequence[n]
+ local set = sequences.set
+ if set then
+ local max = #set
+ if n > max then
+ return set[(n-1) % max + 1]
+ else
+ return set[n]
+ end
end
- else
- return n
end
+ return n
end
end
converters.convert = convert
-function commands.checkedconversion(method,n)
- context(convert(method,n))
+function commands.doifelseconverter(method,language)
+ ctx_doifelse(converters[method..":"..language] or converters[method] or sequences[method])
+end
+
+function commands.checkedconversion(method,n,language)
+ context(convert(method,n,language))
end
-- Well, since the one asking for this didn't test it the following code is not
diff --git a/tex/context/base/core-con.mkiv b/tex/context/base/core-con.mkiv
index 34ab90839..fcc16ef12 100644
--- a/tex/context/base/core-con.mkiv
+++ b/tex/context/base/core-con.mkiv
@@ -523,6 +523,13 @@
\installcorenamespace {conversionarguments}
\installcorenamespace {conversionwords}
+%D It might be better to move more to lua as we also need conversion there
+%D and doublicating logic doesn't make things cleaner. It means that all
+%D conversions will get a language argument too. However, we permit definitions
+%D at the \TEX\ end so we have to provide some hybrid method.
+
+% checkedconversion(method,n,language)
+
\unexpanded\def\defineconversion
{\dotripleempty\syst_converters_define_conversion}
@@ -535,7 +542,7 @@
\def\syst_converters_define_conversion_indeed#1#2#3%
{\doifinstringelse{,}{\detokenize{#3}}
- {\ctxcommand{defineconversion("#2",\!!bs\detokenize{#3}\!!es)}%
+ {\ctxcommand{defineconversion("#2",\!!bs\detokenize{#3}\!!es)}% a set e.g. of symbols
\setgvalue{\??conversion#1}{\syst_converters_checked_conversion{#2}}}
{\setgvalue{\??conversion#1}{#3}}}
@@ -560,6 +567,10 @@
\setvalue{\??conversionarguments2}#1{\csname\??conversion #1\endcsname}
\letvalue{\??conversionarguments3}\syst_converters_checked_conversion
+% we can also add a \ctxcommand{doifelseconversion("#1","\currentlanguage")} to check
+% if we have definitions that are not matched at the lua end .. eventually we might do
+% that when more shows up
+
\def\doifconversiondefinedelse#1%
{\ifcsname\??conversion\currentlanguage#1\endcsname
\expandafter\firstoftwoarguments
@@ -665,12 +676,12 @@
\defineconversion [\v!greek] [\greeknumerals]
\defineconversion [\v!Greek] [\Greeknumerals]
-\defineconversion [ñ] [\spanishnumerals]
-\defineconversion [Ñ] [\Spanishnumerals]
-
\defineconversion [g] [\greeknumerals]
\defineconversion [G] [\Greeknumerals]
+%defineconversion [ñ] [\spanishnumerals]
+%defineconversion [Ñ] [\Spanishnumerals]
+
\defineconversion [abjadnumerals] [\abjadnumerals]
\defineconversion [abjadnodotnumerals] [\adjadnodotnumerals]
\defineconversion [abjadnaivenumerals] [\adjadnaivenumerals]
@@ -702,6 +713,46 @@
\defineconversion [cn-c] [\chinesecapnumerals]
\defineconversion [cn-a] [\chineseallnumerals]
+%D Moved from lang-def.mkiv:
+%D
+%D Define these as the general character enumeration when language is Slovenian. If
+%D you feel uncomfortable with this, mail Mojca, since she promised to to take the
+%D heat. Pablo was next to request this. We changed characters to numerals for this
+%D feature. We do need these definitions for mechanisms like itemize that check
+%D for converters.
+
+\def\sloveniannumerals#1{\ctxcommand{alphabetic(\number#1,"sl")}}
+\def\slovenianNumerals#1{\ctxcommand{Alphabetic(\number#1,"sl")}}
+
+\def\spanishnumerals #1{\ctxcommand{alphabetic(\number#1,"es")}}
+\def\spanishNumerals #1{\ctxcommand{Alphabetic(\number#1,"es")}}
+
+\defineconversion [\s!sl] [character] [\sloveniannumerals]
+\defineconversion [\s!sl] [Character] [\slovenianNumerals]
+\defineconversion [\s!sl] [characters] [\sloveniannumerals]
+\defineconversion [\s!sl] [Characters] [\slovenianNumerals]
+
+\defineconversion [\s!sl] [a] [\sloveniannumerals]
+\defineconversion [\s!sl] [A] [\slovenianNumerals]
+\defineconversion [\s!sl] [AK] [\smallcapped\sloveniannumerals]
+\defineconversion [\s!sl] [KA] [\smallcapped\sloveniannumerals]
+
+\defineconversion [\s!es] [character] [\spanishnumerals]
+\defineconversion [\s!es] [Character] [\spanishNumerals]
+\defineconversion [\s!es] [characters] [\spanishnumerals]
+\defineconversion [\s!es] [Characters] [\spanishNumerals]
+
+\defineconversion [\s!es] [a] [\spanishnumerals]
+\defineconversion [\s!es] [A] [\spanishNumerals]
+\defineconversion [\s!es] [AK] [\smallcapped\spanishnumerals]
+\defineconversion [\s!es] [KA] [\smallcapped\spanishnumerals]
+
+\defineconversion [sloveniannumerals] [\sloveniannumerals]
+\defineconversion [slovenianNumerals] [\slovenianNumerals]
+
+\defineconversion [spanishnumerals] [\spanishnumerals]
+\defineconversion [spanishNumerals] [\spanishNumerals]
+
%D In case a font has no greek (WS):
\defineconversion [mathgreek]
diff --git a/tex/context/base/lang-def.mkiv b/tex/context/base/lang-def.mkiv
index 2d9c88a18..c2fb9640c 100644
--- a/tex/context/base/lang-def.mkiv
+++ b/tex/context/base/lang-def.mkiv
@@ -271,50 +271,6 @@
\installlanguage [\s!slovenian] [\s!sl]
\installlanguage [slovene] [\s!sl] % both possible (mojca: still needed?)
-%D Define general-purpose macros for Slovenian character enumerations:
-
-\defineconversion [sloveniancharacter] [\sloveniancharacter]
-\defineconversion [slovenianCharacter] [\slovenianCharacter]
-
-\defineconversion [sloveniancharacters] [\sloveniancharacters]
-\defineconversion [slovenianCharacters] [\slovenianCharacters]
-
-\defineconversion [spanishcharacter] [\spanishcharacter]
-\defineconversion [spanishCharacter] [\spanishCharacter]
-
-\defineconversion [spanishcharacters] [\spanishcharacters]
-\defineconversion [spanishCharacters] [\spanishCharacters]
-
-%D Define these as the general character enumeration when
-%D language is Slovenian. If you feel uncomfortable with this,
-%D mail Mojca, since she promised to to take the heat.
-
-\def\sloveniancharacters#1{\ctxcommand{alphabetic(\number#1,"sl")}}
-\def\slovenianCharacters#1{\ctxcommand{Alphabetic(\number#1,"sl")}}
-
-\def\spanishcharacters #1{\ctxcommand{alphabetic(\number#1,"es")}}
-\def\spanishCharacters #1{\ctxcommand{Alphabetic(\number#1,"es")}}
-
-\defineconversion [\s!sl] [character] [\sloveniancharacters]
-\defineconversion [\s!sl] [Character] [\slovenianCharacters]
-\defineconversion [\s!sl] [characters] [\sloveniancharacters]
-\defineconversion [\s!sl] [Characters] [\slovenianCharacters]
-
-\defineconversion [\s!sl] [a] [\sloveniancharacters]
-\defineconversion [\s!sl] [A] [\slovenianCharacters]
-\defineconversion [\s!sl] [AK] [\smallcapped\sloveniancharacters]
-\defineconversion [\s!sl] [KA] [\smallcapped\sloveniancharacters]
-
-\defineconversion [\s!es] [character] [\spanishcharacters]
-\defineconversion [\s!es] [Character] [\spanishCharacters]
-\defineconversion [\s!es] [characters] [\spanishcharacters]
-\defineconversion [\s!es] [Characters] [\spanishCharacters]
-
-\defineconversion [\s!es] [a] [\spanishcharacters]
-\defineconversion [\s!es] [A] [\spanishCharacters]
-\defineconversion [\s!es] [AK] [\smallcapped\spanishcharacters]
-\defineconversion [\s!es] [KA] [\smallcapped\spanishcharacters]
-
% Cyrillic Languages
\installlanguage
diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua
index a200445f4..c4cca2047 100644
--- a/tex/context/base/publ-ini.lua
+++ b/tex/context/base/publ-ini.lua
@@ -958,9 +958,9 @@ do
end
local function get(dataset,tag,field,what,check,catspec)
- dataset = rawget(datasets,name)
- if dataset then
- local data = dataset.luadata[tag]
+ local current = rawget(datasets,dataset)
+ if current then
+ local data = current.luadata[tag]
if data then
local category = data.category
local catspec = (catspec or currentspecification).categories[category]
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index c99834d6b..77f7dbed8 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index 540af65cc..88d2dd01f 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/strc-doc.lua b/tex/context/base/strc-doc.lua
index 87ad27986..24a705164 100644
--- a/tex/context/base/strc-doc.lua
+++ b/tex/context/base/strc-doc.lua
@@ -564,10 +564,9 @@ end
-- sign=positive => also zero
-- sign=hang => llap sign
---~ todo: test this
---~
+-- this can be a local function
-local function process(index,numbers,ownnumbers,criterium,separatorset,conversion,conversionset,index,entry,result,preceding,done)
+local function process(index,numbers,ownnumbers,criterium,separatorset,conversion,conversionset,entry,result,preceding,done,language)
-- todo: too much (100 steps)
local number = numbers and (numbers[index] or 0)
local ownnumber = ownnumbers and ownnumbers[index] or ""
@@ -588,10 +587,10 @@ local function process(index,numbers,ownnumbers,criterium,separatorset,conversio
if ownnumber ~= "" then
result[#result+1] = ownnumber
elseif conversion and conversion ~= "" then -- traditional (e.g. used in itemgroups) .. inherited!
- result[#result+1] = converters.convert(conversion,number)
+ result[#result+1] = converters.convert(conversion,number,language)
else
local theconversion = sets.get("structure:conversions",block,conversionset,index,"numbers")
- result[#result+1] = converters.convert(theconversion,number)
+ result[#result+1] = converters.convert(theconversion,number,language)
end
else
if ownnumber ~= "" then
@@ -623,6 +622,7 @@ function sections.typesetnumber(entry,kind,...) -- kind='section','number','pref
local set = ""
local segments = ""
local criterium = ""
+ local language = ""
for d=1,select("#",...) do
local data = select(d,...) -- can be multiple parametersets
if data then
@@ -636,6 +636,7 @@ function sections.typesetnumber(entry,kind,...) -- kind='section','number','pref
if set == "" then set = data.set or "" end
if segments == "" then segments = data.segments or "" end
if criterium == "" then criterium = data.criterium or "" end
+ if language == "" then language = data.language or "" end
end
end
if separatorset == "" then separatorset = "default" end
@@ -647,6 +648,7 @@ function sections.typesetnumber(entry,kind,...) -- kind='section','number','pref
if connector == "" then connector = nil end
if set == "" then set = "default" end
if segments == "" then segments = nil end
+ if language == "" then language = nil end
--
if criterium == v_strict then
criterium = 0
@@ -739,15 +741,13 @@ function sections.typesetnumber(entry,kind,...) -- kind='section','number','pref
local prefix = prefixlist[k]
local index = sections.getlevel(prefix) or k
if index >= firstprefix and index <= lastprefix then
- -- process(index,result)
- preceding, done = process(index,numbers,ownnumbers,criterium,separatorset,conversion,conversionset,index,entry,result,preceding,done)
+ preceding, done = process(index,numbers,ownnumbers,criterium,separatorset,conversion,conversionset,entry,result,preceding,done,language)
end
end
else
-- also holes check
for index=firstprefix,lastprefix do
- -- process(index,result)
- preceding, done = process(index,numbers,ownnumbers,criterium,separatorset,conversion,conversionset,index,entry,result,preceding,done)
+ preceding, done = process(index,numbers,ownnumbers,criterium,separatorset,conversion,conversionset,entry,result,preceding,done,language)
end
end
--
diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv
index a55a8951b..06a34c11a 100644
--- a/tex/context/base/strc-sec.mkiv
+++ b/tex/context/base/strc-sec.mkiv
@@ -235,6 +235,7 @@
set = "\structureparameter\c!sectionset",
segments = "\structureparameter\c!sectionsegments",
ownnumber = "\currentstructureownnumber",
+ language = "\currentlanguage", % for the moment, needed for bookmarks conversion
},
userdata = \!!bs\detokenize{#3}\!!es % will be converted to table at the lua end
}
diff --git a/tex/context/base/typo-wrp.lua b/tex/context/base/typo-wrp.lua
index e859d2ef2..1a3aac386 100644
--- a/tex/context/base/typo-wrp.lua
+++ b/tex/context/base/typo-wrp.lua
@@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['typo-wrp'] = {
license = "see context related readme files"
}
+-- begin/end par wrapping stuff ... more to come
+
local nodecodes = nodes.nodecodes
local glue_code = nodecodes.glue
@@ -27,6 +29,10 @@ local remove = nuts.remove
local wrappers = { }
typesetters.wrappers = wrappers
+local trace_wrappers = trackers.register("typesetters.wrappers",function(v) trace_wrappers = v end)
+
+local report = logs.reporter("paragraphs","wrappers")
+
-- we really need to pass tail too ... but then we need to check all the plugins
-- bah ... slowdown
@@ -39,6 +45,9 @@ local function remove_dangling_crlf(head,tail)
if tail == head then
-- can't happen
else
+ if trace_wrappers then
+ report("removing a probably unwanted end-of-par break in line %s (guess)",tex.inputlineno)
+ end
remove(head,tail,true)
return head, tail, true
end
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 8d402ddac..b1cf6044c 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 : 11/12/14 18:16:32
+-- merge date : 11/12/14 21:46:32
do -- begin closure to overcome local limits and interference