Re: [NTG-context] [util-jsn] incorrect handling of escapes

2013-07-09 Thread Philipp Gesang
·

> On 7/8/2013 12:56 AM, Philipp Gesang wrote:
> >Hi,
> >
> >the JSON parser handles backslash escapes improperly. Example:
> >
> > local data = [[ { "escapes" : "(\")(\\)(\b)(\f)(\n)(\r)(\t)",
> >   "invalid" : "\'\v" } ]]
> > local stuff = utilities.json.tolua (data)
> > inspect(stuff)
> >
> >Currently it chokes on double quotes and treats the other escapes
> >like Lua. Fix suggestion attached.
> 
> local escapes= {
>  -- ["\\"] = "\\",  -- lua will escape these
>  -- ["/"]  = "/",   -- no need to escape this one
> ["b"]  = "\010",
> ["f"]  = "\014",
> ["n"]  = "\n",
> ["r"]  = "\r",
> ["t"]  = "\t",
> }
> 
> local escape_un  = C(P("\\u") / "0x" * S("09","AF","af")) /
> function(s) return utfchar(tonumber(s)) end
> local escape_bs  = P([[\]]) / "" * (P(1) / escapes) -- if not found
> then P(1) is returned i.e. the to be escaped char
> 
> local jstring= dquote * Cs((escape_un + escape_bs +
> (1-dquote))^0) * dquote

Fine with me!

Best,
Philipp



pgpCV3D5S3lx2.pgp
Description: PGP signature
___
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
___

[NTG-context] Different font variants (normal <> condensed, light <> regular <> bold, etc.)

2013-07-09 Thread Zenlima
Hi,

I am trying to define the different variants of the Roboto font ([1]
for sans and [2][3][4][5] for serif).

Now I am trying to define this for context but I have no idea how to
define the condensed versions (plus how to access it later). And how
do I enter and access the different weights next to regular and
bold (light, thin, heavy)? And how to define the weight
light as default (instead of regular)? I got so far:

8<--
\enableregime[utf]

\definefontfeature[Latn-smallcaps][smcp=yes,script=latn,kern=yes]
\definefontfeature[fakeitalic][default][slant=.25]

\definefontfeature[arab][mode=node,language=dflt,script=arab,init=yes,medi=yes,fina=yes,isol=yes,liga=yes,dlig=yes,rlig=yes,clig=yes,mark=yes,mkmk=yes,kern=yes,curs=yes]

\definefontsynonym
[arab--scheherazade--serif][name:scheherazade][features=arab]
\definefontsynonym[brai--6punktoj][name:6punktoj] %^1

\starttypescript[sans][roboto]
\definefontfallback[Sans][brai--6punktoj][0x2800-0x283f][force=yes,check=no]
\definefontfallback[Sans][arab--scheherazade--serif][0x0600-0x06ff,0x0750-0x077f,0xfb50-0xfdff,0xfe70-0xfefe][force=yes,check=no,rscale=1.9]
\definefontsynonym[Sans][name:robotoregular][fallbacks=Sans]
\definefontsynonym[SansBold][name:robotobold]
\definefontsynonym[SansItalic][name:robotoitalic]
\definefontsynonym[SansSlanted][name:robotoitalic]
\definefontsynonym[SansBoldItalic][name:robotobolditalic]
\definefontsynonym[SansBoldSlanted][name:robotobolditalic]
\definefontsynonym[SansCaps][name:robotoregular][features=Latn-smallcaps]
\stoptypescript

\starttypescript[serif][roboto] 
\definefontfallback[Serif][brai--6punktoj][0x2800-0x283f][force=yes,check=no]
\definefontfallback[Serif][arab--scheherazade--serif][0x0600-0x06ff,0x0750-0x077f,0xfb50-0xfdff,0xfe70-0xfefe][force=yes,check=no,rscale=1.9]
\definefontsynonym[Serif][name:robotoslabregular][fallbacks=Serif]
\definefontsynonym[SerifBold][name:robotoslabbold]
\definefontsynonym[SerifItalic][name:robotoslabregular][features=fakeitalic]
\definefontsynonym[SerifSlanted][name:robotoslabregular][features=fakeitalic]
\definefontsynonym[SerifBoldItalic][name:robotoslabbold][features=fakeitalic]
\definefontsynonym[SerifBoldSlanted][name:robotoslabbold][features=fakeitalic]
\definefontsynonym[SerifCaps][name:robotoslabregular][features=Latn-smallcaps] 
\stoptypescript

\definetypeface[fliesstext][rm][serif][roboto] 
\definetypeface[fliesstext][ss][sans][roboto] 

\setupbodyfont[fliesstext,rm,11pt]


8<--

Any help is appreciated :-)


1) That braille font is created by myself and will be published for
   ConTeXt soon - still a little rocky.

[1] https://dl-ssl.google.com/android/design/Roboto_Hinted_2029.zip
[2] http://ff.static.1001fonts.net/r/o/roboto-slab.regular.ttf
[3] http://ff.static.1001fonts.net/r/o/roboto-slab.thin.ttf
[4] http://ff.static.1001fonts.net/r/o/roboto-slab.light.ttf
[5] http://ff.static.1001fonts.net/r/o/roboto-slab.bold.ttf
___
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
___


Re: [NTG-context] Different font variants (normal <> condensed, light <> regular <> bold, etc.)

2013-07-09 Thread Wolfgang Schuster

Am 09.07.2013 um 13:20 schrieb Zenlima :

> Hi,
> 
> I am trying to define the different variants of the Roboto font ([1]
> for sans and [2][3][4][5] for serif).
> 
> Now I am trying to define this for context but I have no idea how to
> define the condensed versions (plus how to access it later). And how
> do I enter and access the different weights next to regular and
> bold (light, thin, heavy)? And how to define the weight
> light as default (instead of regular)? I got so far:
> 
> 8<--
> \enableregime[utf]
> 
> \definefontfeature[Latn-smallcaps][smcp=yes,script=latn,kern=yes]
> \definefontfeature[fakeitalic][default][slant=.25]
> 
> \definefontfeature[arab][mode=node,language=dflt,script=arab,init=yes,medi=yes,fina=yes,isol=yes,liga=yes,dlig=yes,rlig=yes,clig=yes,mark=yes,mkmk=yes,kern=yes,curs=yes]
> 
> \definefontsynonym
> [arab--scheherazade--serif][name:scheherazade][features=arab]
> \definefontsynonym[brai--6punktoj][name:6punktoj] %^1
> 
> \starttypescript[sans][roboto]
> \definefontfallback[Sans][brai--6punktoj][0x2800-0x283f][force=yes,check=no]
> \definefontfallback[Sans][arab--scheherazade--serif][0x0600-0x06ff,0x0750-0x077f,0xfb50-0xfdff,0xfe70-0xfefe][force=yes,check=no,rscale=1.9]
> \definefontsynonym[Sans][name:robotoregular][fallbacks=Sans]
> \definefontsynonym[SansBold][name:robotobold]
> \definefontsynonym[SansItalic][name:robotoitalic]
> \definefontsynonym[SansSlanted][name:robotoitalic]
> \definefontsynonym[SansBoldItalic][name:robotobolditalic]
> \definefontsynonym[SansBoldSlanted][name:robotobolditalic]
> \definefontsynonym[SansCaps][name:robotoregular][features=Latn-smallcaps]
> \stoptypescript
> 
> \starttypescript[serif][roboto] 
> \definefontfallback[Serif][brai--6punktoj][0x2800-0x283f][force=yes,check=no]
> \definefontfallback[Serif][arab--scheherazade--serif][0x0600-0x06ff,0x0750-0x077f,0xfb50-0xfdff,0xfe70-0xfefe][force=yes,check=no,rscale=1.9]
> \definefontsynonym[Serif][name:robotoslabregular][fallbacks=Serif]
> \definefontsynonym[SerifBold][name:robotoslabbold]
> \definefontsynonym[SerifItalic][name:robotoslabregular][features=fakeitalic]
> \definefontsynonym[SerifSlanted][name:robotoslabregular][features=fakeitalic]
> \definefontsynonym[SerifBoldItalic][name:robotoslabbold][features=fakeitalic]
> \definefontsynonym[SerifBoldSlanted][name:robotoslabbold][features=fakeitalic]
> \definefontsynonym[SerifCaps][name:robotoslabregular][features=Latn-smallcaps]
>  
> \stoptypescript
> 
> \definetypeface[fliesstext][rm][serif][roboto] 
> \definetypeface[fliesstext][ss][sans][roboto] 
> 
> \setupbodyfont[fliesstext,rm,11pt]
> 
> 
> 8<--
> 
> Any help is appreciated :-)

Try the two attached files (untested):



roboto-test.tex
Description: Binary data


type-roboto.tex
Description: Binary data
___
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
___

[NTG-context] Chapter number in list colored (setuplist)

2013-07-09 Thread Zenlima
Hi,

I want to color the chapter number in the table of content. The
attribute "numbercolor" does not exist in setuplist. So I tried to
color the chapter number via "numberstlye" ("numbercommand" is also not
working):

---8<

\define[1]\listChapterColor{\color[bordeaux]{X #1}}

\setuplist[chapter][color=black,numberstyle=\listChapterColor]

8<--

The X appears in the new color (bordeaux), but the chapter number is
still uncolored - same color like rest of that line (black).

What am I doing wrong here?

H.
___
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
___


Re: [NTG-context] Chapter number in list colored (setuplist)

2013-07-09 Thread Aditya Mahajan

On Tue, 9 Jul 2013, Zenlima wrote:


Hi,

I want to color the chapter number in the table of content. The
attribute "numbercolor" does not exist in setuplist. So I tried to
color the chapter number via "numberstlye" ("numbercommand" is also not
working):

---8<

\define[1]\listChapterColor{\color[bordeaux]{X #1}}

\setuplist[chapter][color=black,numberstyle=\listChapterColor]

8<--

The X appears in the new color (bordeaux), but the chapter number is
still uncolored - same color like rest of that line (black).

What am I doing wrong here?


(Untested): Have you tried `numbercolor=bordeaux`?

Aditya
___
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
___


Re: [NTG-context] Chapter number in list colored (setuplist)

2013-07-09 Thread Wolfgang Schuster

Am 09.07.2013 um 18:08 schrieb Zenlima :

> Hi,
> 
> I want to color the chapter number in the table of content. The
> attribute "numbercolor" does not exist in setuplist. So I tried to
> color the chapter number via "numberstlye" ("numbercommand" is also not
> working):
> 
> ---8<
> 
> \define[1]\listChapterColor{\color[bordeaux]{X #1}}
> 
> \setuplist[chapter][color=black,numberstyle=\listChapterColor]
> 
> 8<--
> 
> The X appears in the new color (bordeaux), but the chapter number is
> still uncolored - same color like rest of that line (black).
> 
> What am I doing wrong here?


1. You forgot a minimal example which demonstrates the problem.

2. You didn’t test numbercolor.

\setuplist
  [chapter]
  [color=green,
   numbercolor=red,
  %pagecolor=orange,
   textcolor=blue]

\starttext
\completecontent
\chapter{Test}
\stoptext

Wolfgang
___
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
___


Re: [NTG-context] Chapter number in list colored (setuplist)

2013-07-09 Thread Zenlima
Am Tue, 9 Jul 2013 12:20:18 -0400 (EDT)
schrieb Aditya Mahajan :

> numbercolor=bordeaux

I am so sorry.. I tried that too but I must have mistyped it then.. now it 
works :)

Thanks
___
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
___


[NTG-context] linenumbering in columnsets (or different solution?)

2013-07-09 Thread Thomas A. Schmitz

Hi,

I want a document with two columns; left column is poetry, so I want the 
lines to be numbered. Unfortunately, linenumbering doesn't appear to 
work in columns(ets), so my next attempt was to produce a third, very 
narrow column which displays the line numbers. However, columnsets with 
different columns is not implemented in mkiv, AFAICS. Examples:


No line numbers:

\setuppapersize[A4,landscape][A4,landscape]

\setuplayout[grid=yes]

\definecolumnset [numbered] [n=2]
\setupcolumnset [numbered] [distance=0.5cm,frame=on]

\starttext

\startcolumnset [numbered]

\startlinenumbering[step=1,location=text]
Poetry

One

Word

Per

Line

is

Poetic
\stoplinenumbering

\column[local]

Two

\column[local]
\stopcolumnset

\stoptext

Works only in mkii:

\setuppapersize[A4,landscape][A4,landscape]

\setuplayout[grid=yes]

\definecolumnset [numbered] [n=2]
\setupcolumnset [numbered] [distance=0.5cm,frame=on]

\starttext

\startcolumnset [numbered]

\startlinenumbering[step=1,location=text]
Poetry

One

Word

Per

Line

is

Poetic
\stoplinenumbering

\column[local]

Two

\column[local]
\stopcolumnset

\stoptext

Any solution?

All best

Thomas
___
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
___


Re: [NTG-context] Chapter number in list colored (setuplist)

2013-07-09 Thread Zenlima
> 2. You didn’t test numbercolor.

You are correct: after my mistyped try'n'error I did not checked it
any further as the documentation in the wiki. I updated it with that
missing attribute.

thanks


signature.asc
Description: PGP signature
___
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
___