ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Procházka Lukáš Ing. - Pontex s. r. o." <LPr@pontex.cz>
To: "mailing list for ConTeXt users" <ntg-context@ntg.nl>
Subject: Re: \enableregime (was: Re: Problem with context.startsection)
Date: Wed, 01 Dec 2010 13:13:27 +0100	[thread overview]
Message-ID: <op.vm1awph3tpjj8f@lpr> (raw)
In-Reply-To: <20101201115945.GA24894@micropit.couberia.bzh>

[-- Attachment #1: Type: text/plain, Size: 1136 bytes --]

I had the same problem several days ago; Wolfgang answered but I cannot remember the mail thread.

It requires a small patch in c:\ConTeXt\tex\texmf-context\tex\context\base\regi-ini.lua - see the attachment.

Or maybe it's been patched in the newest ctx minimals.

Note that if you replace reg-ini.lua manually, you'll probably need to delete the lua-cache (c:\ConTeXt\tex\texmf-cache\luatex-cache\context\f53042fa2e1c106bc7e3383ec8c3a00c in my case) directory as well.

Cheers,

Lukas


On Wed, 01 Dec 2010 12:59:45 +0100, Peter Münster <pmlists@free.fr> wrote:

> On Wed, Dec 01 2010, Hans Hagen wrote:
>
>> support for 8 bit is rather trivial so what is the problem?
>
> Test file:
>
> \enableregime[cp1250]
> \starttext
> bla
> \stoptext
>
>
> Error:
>
> ! LuaTeX error ...text/tex/texmf-context/tex/context/base/regi-ini.lua:100:
>   attempt to call global 'translate' (a nil value).
>
> Peter
>


-- 
Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
Pontex s. r. o.      [mailto:pontex@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

[-- Attachment #2: regi-ini.lua --]
[-- Type: application/octet-stream, Size: 3298 bytes --]

if not modules then modules = { } end modules ['regi-ini'] = {
    version   = 1.001,
    comment   = "companion to regi-ini.mkiv",
    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
    copyright = "PRAGMA ADE / ConTeXt Development Team",
    license   = "see context related readme files"
}

local utf = unicode.utf8
local char, utfchar, gsub = string.char, utf.char, string.gsub

--[[ldx--
<p>Regimes take care of converting the input characters into
<l n='utf'/> sequences. The conversion tables are loaded at
runtime.</p>
--ldx]]--

regimes          = regimes or { }
local regimes    = regimes

regimes.data     = regimes.data or { }
local data       = regimes.data

regimes.utf      = regimes.utf or { }

regimes.synonyms = regimes.synonyms or { }
local synonyms   = regimes.synonyms

if storage then
    storage.register("regimes/synonyms", synonyms, "regimes.synonyms")
else
    regimes.synonyms = { }
end

-- setmetatable(regimes.data,_empty_table_)

regimes.currentregime = "utf"

--[[ldx--
<p>We will hook regime handling code into the input methods.</p>
--ldx]]--

function regimes.number(n)
    if type(n) == "string" then return tonumber(n,16) else return n end
end

function regimes.setsynonym(synonym,target)
    synonyms[synonym] = target
end

function regimes.truename(regime)
    context((regime and synonyms[synonym] or regime) or regimes.currentregime)
end

function regimes.load(regime)
    regime = synonyms[regime] or regime
    if not data[regime] then
        environment.loadluafile("regi-"..regime, 1.001)
        if data[regime] then
            regimes.utf[regime] = { }
            for k,v in next, data[regime] do
                regimes.utf[regime][char(k)] = utfchar(v)
            end
        end
    end
end

function regimes.translate(line,regime)
    regime = synonyms[regime] or regime
    if regime and line then
        local rur = regimes.utf[regime]
        if rur then
            return (gsub(line,"(.)",rur)) -- () redundant
        end
    end
    return line
end

-- function regimes.enable(regime)
--     regime = synonyms[regime] or regime
--     if data[regime] then
--         regimes.currentregime = regime
--         local translate = regimes.translate
--         resolvers.filters.install('input',function(s)
--             return translate(s,regime)
--         end)
--     else
--         regimes.disable()
--     end
-- end
--
-- function regimes.disable()
--     regimes.currentregime = "utf"
--     resolvers.filters.install('input',nil)
-- end

local sequencers = utilities.sequencers

function regimes.process(s)
    return regimes.translate(s,regimes.currentregime)
end

function regimes.enable(regime)
    regime = synonyms[regime] or regime
    if data[regime] then
        regimes.currentregime = regime
        sequencers.enableaction(resolvers.openers.textfileactions,"regimes.process")
    else
        sequencers.disableaction(resolvers.openers.textfileactions,"regimes.process")
    end
end

function regimes.disable()
    regimes.currentregime = "utf"
    sequencers.disableaction(resolvers.openers.textfileactions,"regimes.process")
end

utilities.sequencers.prependaction(resolvers.openers.textfileactions,"system","regimes.process")
utilities.sequencers.disableaction(resolvers.openers.textfileactions,"regimes.process")

[-- Attachment #3: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2010-12-01 12:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-28 17:29 Problem with \nolist Procházka Lukáš
2010-11-28 18:00 ` Wolfgang Schuster
2010-11-28 20:54   ` Procházka Lukáš
2010-11-30 16:51   ` Problem with context.startsection (was: Problem with \nolist) Procházka Lukáš Ing. - Pontex s. r. o.
2010-11-30 17:13     ` Wolfgang Schuster
2010-11-30 21:38     ` Problem with context.startsection Peter Münster
2010-12-01  7:23       ` Procházka Lukáš Ing. - Pontex s. r. o.
2010-12-01  9:22       ` Hans Hagen
2010-12-01 11:59         ` \enableregime (was: Re: Problem with context.startsection) Peter Münster
2010-12-01 12:13           ` Procházka Lukáš Ing. - Pontex s. r. o. [this message]
2010-12-01 14:31           ` \enableregime Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.vm1awph3tpjj8f@lpr \
    --to=lpr@pontex.cz \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).