Re: [NTG-context] hyphenated url

2010-10-31 Thread Aditya Mahajan

On Mon, 25 Oct 2010, Steffen Wolfrum wrote:


Hi,

the % is a frequently used character in URL.
But \hyphenatedurl{} can deal with it ...

Does someone has a fix?


\starttext
text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
\stoptext


This is more a proof of concept so I did not take care of the optional 
argument of \footnote.


\newcatcodetable \mytxtcatcodes
\startcatcodetable \mytxtcatcodes
\catcode`\^^I = 10
\catcode`\^^M =  5
\catcode`\^^L =  5
\catcode`\= 10
\catcode`\^^Z =  9
\catcode`\\   =  0
\catcode`\{   =  1
\catcode`\}   =  2
\stopcatcodetable

\def\dosingleasciigroup#1%
  {\pushcatcodetable
   \setcatcodetable \mytxtcatcodes
   \def\next##1{#1{##1}\popcatcodetable}%
   \next}

\def\setasciicommand#1%
  {\savenormalmeaning{#1}%
   \def#1{\dosingleasciigroup{\csname normal\strippedcsname#1\endcsname}}}

\setasciicommand\footnote
\setasciicommand\hyphenatedurl

\starttext
\hyphenatedurl{http://www.google.com/some%20thing}
test \footnote{A footnote with a \bold{url} 
\hyphenatedurl{http://www.google.com/some%20thing}}


\stoptext


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] hyphenated url

2010-10-31 Thread Steffen Wolfrum

Am 31.10.2010 um 07:06 schrieb Aditya Mahajan:

 On Mon, 25 Oct 2010, Steffen Wolfrum wrote:
 
 Hi,
 
 the % is a frequently used character in URL.
 But \hyphenatedurl{} can deal with it ...
 
 Does someone has a fix?
 
 
 \starttext
 text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
 \stoptext
 
 This is more a proof of concept so I did not take care of the optional 
 argument of \footnote.
 
 \newcatcodetable \mytxtcatcodes
 \startcatcodetable \mytxtcatcodes
   \catcode`\^^I = 10
   \catcode`\^^M =  5
   \catcode`\^^L =  5
   \catcode`\= 10
   \catcode`\^^Z =  9
   \catcode`\\   =  0
   \catcode`\{   =  1
   \catcode`\}   =  2
 \stopcatcodetable
 
 \def\dosingleasciigroup#1%
 {\pushcatcodetable
  \setcatcodetable \mytxtcatcodes
  \def\next##1{#1{##1}\popcatcodetable}%
  \next}
 
 \def\setasciicommand#1%
 {\savenormalmeaning{#1}%
  \def#1{\dosingleasciigroup{\csname normal\strippedcsname#1\endcsname}}}
 
 \setasciicommand\footnote
 \setasciicommand\hyphenatedurl
 
 \starttext
 \hyphenatedurl{http://www.google.com/some%20thing}
 test \footnote{A footnote with a \bold{url} 
 \hyphenatedurl{http://www.google.com/some%20thing}}
 
 \stoptext


A very nice and clean solution!

Is it also possible to adapt it to useURL?

\setasciicommand\useURL

test 
\useURL[one][http://www.google.com/some%20thing][][http://www.google.com/some%20thing]
 text


Thanks a lot,
Steffen
___
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] hyphenated url

2010-10-31 Thread Aditya Mahajan

On Sun, 31 Oct 2010, Steffen Wolfrum wrote:



Am 31.10.2010 um 07:06 schrieb Aditya Mahajan:


On Mon, 25 Oct 2010, Steffen Wolfrum wrote:


Hi,

the % is a frequently used character in URL.
But \hyphenatedurl{} can deal with it ...

Does someone has a fix?


\starttext
text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
\stoptext


This is more a proof of concept so I did not take care of the optional argument 
of \footnote.


A very nice and clean solution!

Is it also possible to adapt it to useURL?

\setasciicommand\useURL

test 
\useURL[one][http://www.google.com/some%20thing][][http://www.google.com/some%20thing]
 text


It starts getting more confusing...the control passes from tex to luatex 
and then back to tex and at the last step ctxcatcodes are restored. I just bypassed the 
whole last leg. See the attached file for a working example.


A proper fix is much more involved.

Aditya\newcatcodetable \mytxtcatcodes
\startcatcodetable \mytxtcatcodes
\catcode`\^^I = 10
\catcode`\^^M =  5
\catcode`\^^L =  5
\catcode`\= 10
\catcode`\^^Z =  9
\catcode`\\   =  0
\catcode`\{   =  1
\catcode`\}   =  2
\stopcatcodetable

\def\dosingleasciigroup#1%
  {\pushcatcodetable
   \setcatcodetable \mytxtcatcodes
   \def\next##1{#1{##1}\popcatcodetable}%
   \next}

\def\dosingleasciiargument#1%
  {\pushcatcodetable
   \setcatcodetable \mytxtcatcodes
   \def\next[##1]{#1[##1]\popcatcodetable}%
   \dosingleargument\next}

\def\doquadrupleasciiargument#1%
  {\pushcatcodetable
   \setcatcodetable \mytxtcatcodes
   \def\next[##1][##2][##3][##4]{#1[##1][##2][##3][##4]\popcatcodetable}%
   \doquadrupleargument\next}
   
\def\setasciicommand#1#2%arguments cs
  {\savenormalmeaning{#2}%
   \def#2{#1{\csname normal\strippedcsname#2\endcsname}}}

\setasciicommand\dosingleasciigroup\footnote
\setasciicommand\dosingleasciigroup\hyphenatedurl

% This does not work... possible because the context(...) function is using 
% ctxcatcodes rather than current catcodes.

%\setasciicommand\dosingleasciigroup\dofromurldescription

\setasciicommand\doquadrupleasciiargument\useURL
% Not needed
%\setasciicommand\dosingleasciiargument\from

\startluacode
local references  = structures.references
references.urls  = references.urls  or { }
references.urls.data = references.urls.data or { }

function references.from(name)
local u = references.urls.data[name]
if u then
local url, file, description = u[1], u[2], u[3]
if description ~=  then
-- context.dofromurldescription(description)
-- AM: Changed this
tex.sprint(tex.mytxtcatcodes, description)
-- ok
elseif file and file ~=  then
context.dofromurlliteral(url .. / .. file)
else
context.dofromurlliteral(url)
end
else
local f = files[name]
if f then
local description, file = f[1], f[2]
if description ~=  then
context.dofromfiledescription(description)
else
context.dofromfileliteral(file)
end
end
end
end

\stopluacode

\starttext
\hyphenatedurl{http://www.google.com/some%20thing}
test \footnote{A footnote with a \bold{url} \hyphenatedurl{http://www.google.com/some%20thing}}

\useURL[one][http://www.google.com/some%20thing][][http://www.google.com/some%20thing]
\from[one]

\stoptext
   
___
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] hyphenated url

2010-10-28 Thread Steffen Wolfrum

Am 28.10.2010 um 00:05 schrieb Philipp Gesang:

 % Usage example here:
 
 \startuseURL[anotherurl][urldescription]
 http://test%it.example.com
 \stopuseURL
 
 \starttext
 
 \from[anotherurl]\par
 \url[anotherurl]\par
 
 Test.\footnote{\url[anotherurl]}
 
 \stoptext



Hi Philipp,

this doesn't work ... the address gets corrupt!

Just run it, open the PDF in Acrobat and test the link:

Acrobat is attempting to connect to 
http://test%25it.example.com;


Steffen
___
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] hyphenated url

2010-10-28 Thread Taco Hoekwater

On 10/27/2010 02:43 PM, Wolfgang Schuster wrote:


Am 27.10.2010 um 12:35 schrieb Steffen Wolfrum:


Hi Hans and other catcode wizards,

isn't there a way to make this kind of catcode trickery only be available 
*inside* \hyphenatedurl{} environment?


It’s useless in this case because the „%“ is read from the footnote before 
\hyphenatedurl can see it and any local catcode changes have therefore no 
effect.


This works:

\startbuffer [comurl] \catcode`\%=12
\hyphenatedurl{http://www.kommers.se/upload/Analysarkiv/In%20English/Analyses/Woolcock%20paper%20on%20impact%20of%20Lisbontreaty%20on%20tradepolicy.pdf}
\stopbuffer

\setupinteraction
   [state=start]

\starttext

test\footnote{test \getbuffer[comurl] text.} text.

\stoptext
___
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] hyphenated url

2010-10-28 Thread Peter Münster
On Thu, Oct 28 2010, Steffen Wolfrum wrote:
 
  \startuseURL[anotherurl][urldescription]
  http://test%it.example.com
  \stopuseURL
 
 this doesn't work ... the address gets corrupt!
 
 Just run it, open the PDF in Acrobat and test the link:
 
 Acrobat is attempting to connect to 
 http://test%25it.example.com;

This is normal behaviour of Acrobat, see also:
http://archive.contextgarden.net/message/20101027.213001.ba65dced.en.html

it is not hexadecimal.

Peter

-- 
Contact information: http://pmrb.free.fr/contact/


___
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] hyphenated url

2010-10-28 Thread Philipp Gesang
On 2010-10-28 08:46:55, Steffen Wolfrum wrote:
 
 Am 28.10.2010 um 00:05 schrieb Philipp Gesang:
 
  % Usage example here:
  
  \startuseURL[anotherurl][urldescription]
  http://test%it.example.com
  \stopuseURL
  
  \starttext
  
  \from[anotherurl]\par
  \url[anotherurl]\par
  
  Test.\footnote{\url[anotherurl]}
  
  \stoptext
 
 
 
 Hi Philipp,
 
 this doesn't work ... the address gets corrupt!
 
 Just run it, open the PDF in Acrobat and test the link:
 
 Acrobat is attempting to connect to 
 http://test%25it.example.com;

This can’t get corrupted any more because it’s illegal. From
RFC 1738:

···8

hostname   = *[ domainlabel . ] toplabel
domainlabel= alphadigit | alphadigit *[ alphadigit | - ] alphadigit

···8

No percent signs allowed in the hostname. Put your test percent
sign somewhere else and it will work (don’t know about acrobat,
but okular cooperates):

  http://testit.example.com/%25
  http://www.google.com/search?q=L%C3%A4rmbel%C3%A4stigung

Hth, Philipp


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

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments


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


Re: [NTG-context] hyphenated url

2010-10-28 Thread Hans Hagen

On 27-10-2010 7:08, Peter Münster wrote:

On Wed, Oct 27 2010, Wolfgang Schuster wrote:



He wants perhaps:

\starthyphenatedurl
www.%.com
\stophyphenatedurl


No, he wants

\footnote{...\hyphenatedurl{...%...}...}


Yes. But if I understand TeX right, then there will be only 2 possibilities:

1.)
\footnote{bla
\starthyphenatedurl
www.%.com
\stophyphenatedurl
bla bla}




\asciimode \catcode`\%   = \othercatcode

\footnote{bla \hyphenatedurl{www.%.com} bla bla}

\stoptext

If we can agree that asciimode also makes % a characters I can add that 
preset. In that case one should mark comments differently, although when 
one wants % to be % comments are not in the picture anyway.


Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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] hyphenated url

2010-10-28 Thread Peter Münster
On Thu, Oct 28 2010, Hans Hagen wrote:

 If we can agree that asciimode also makes % a characters I can add
 that preset.

I agree. It's more consistent.
Peter

-- 
Contact information: http://pmrb.free.fr/contact/


___
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] hyphenated url

2010-10-28 Thread Khaled Hosny
On Thu, Oct 28, 2010 at 11:53:52AM +0200, Peter Münster wrote:
 On Thu, Oct 28 2010, Hans Hagen wrote:
 
  If we can agree that asciimode also makes % a characters I can add
  that preset.
 
 I agree. It's more consistent.

Me too :) We just need some other way to put inline comments.

Regards,
 Khaled

-- 
 Khaled Hosny
 Arabic localiser and member of Arabeyes.org team
 Free font developer
___
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] hyphenated url

2010-10-28 Thread Peter Münster
On Thu, Oct 28 2010, Khaled Hosny wrote:

 Me too :) We just need some other way to put inline comments.

I don't know, if it's possible, but \% could be nice.
Peter

-- 
Contact information: http://pmrb.free.fr/contact/


___
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] hyphenated url (SOLVED)

2010-10-28 Thread Steffen Wolfrum
Am 28.10.2010 um 08:53 schrieb Taco Hoekwater:

 This works:
 
 \startbuffer [comurl] \catcode`\%=12
 \hyphenatedurl{...



If I didn't overlook something, then this must be finally the solution:


\startbuffer [comurl] \catcode`\%=12
\useURL[test][http://www.kommers.se/upload/Analysarkiv/In%20English/Analyses/Woolcock%20paper%20on%20impact%20of%20Lisbontreaty%20on%20tradepolicy.pdf][]
[http://www.kommers.se/upload/Analysarkiv/In%20English/\crlf 
Analyses/Woolcock%20paper%20on%20impact%20of%20Lisb\crlf 
ontreaty%20on%20tradepolicy.pdf]\from[test]
\stopbuffer 

\setupinteraction
  [state=start]

\starttext

test {\getbuffer[comurl]} text.% HEY!

test
\startfootnote
test \getbuffer[comurl]\ text.% HEY!
\stopfootnote{} text.% HEY!

\stoptext



Here, the % character can be used for URL, both in bodytext and footnote, but 
works as comment, too.
And we can at the same time manually break long URLs that are too weird for 
hyphenation by \hyphenatedurl.

Thank you Taco, Peter, Philipp and Hans for your efforts ...
and eventually getting all the pieces for this solution together!!!

Steffen
___
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] hyphenated url

2010-10-28 Thread Wolfgang Schuster

Am 28.10.2010 um 08:53 schrieb Taco Hoekwater:

 On 10/27/2010 02:43 PM, Wolfgang Schuster wrote:
 
 Am 27.10.2010 um 12:35 schrieb Steffen Wolfrum:
 
 Hi Hans and other catcode wizards,
 
 isn't there a way to make this kind of catcode trickery only be available 
 *inside* \hyphenatedurl{} environment?
 
 It’s useless in this case because the „%“ is read from the footnote before 
 \hyphenatedurl can see it and any local catcode changes have therefore no 
 effect.
 
 This works:
 
 \startbuffer [comurl] \catcode`\%=12
 \hyphenatedurl{http://www.kommers.se/upload/Analysarkiv/In%20English/Analyses/Woolcock%20paper%20on%20impact%20of%20Lisbontreaty%20on%20tradepolicy.pdf}
 \stopbuffer
 
 \setupinteraction
   [state=start]
 
 \starttext
 
 test\footnote{test \getbuffer[comurl] text.} text.
 
 \stoptext

Sure but \getbuffer isn’t expanded when the footnote text is read by tex, when 
you look at the tuc file you can see the entry for the footnote is:

  titledata={
   title=test \\getbuffer [comurl] text.,
  },

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] hyphenated url

2010-10-28 Thread Wolfgang Schuster

Am 28.10.2010 um 13:02 schrieb Khaled Hosny:

 On Thu, Oct 28, 2010 at 11:53:52AM +0200, Peter Münster wrote:
 On Thu, Oct 28 2010, Hans Hagen wrote:
 
 If we can agree that asciimode also makes % a characters I can add
 that preset.
 
 I agree. It's more consistent.
 
 Me too :) We just need some other way to put inline comments.

\bgroup \obeylines

\gdef\hide%
  {\begingroup%
   \obeylines%
   \dohide}

\gdef\dohide#1
  {\endgroup}

\egroup

\starttext

Auf% ligature
lage

Auf\hide ligature
lage

\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] hyphenated url

2010-10-27 Thread Steffen Wolfrum

Am 26.10.2010 um 00:49 schrieb Philipp Gesang:

 On 2010-10-25 17:00:39, Aditya Mahajan wrote:
 On Mon, 25 Oct 2010, Steffen Wolfrum wrote:
 
 
 Am 25.10.2010 um 19:30 schrieb Aditya Mahajan:
 
 On Mon, 25 Oct 2010, Steffen Wolfrum wrote:
 
 Hi,
 
 the % is a frequently used character in URL.
 But \hyphenatedurl{} can deal with it ...
 
 Does someone has a fix?
 
 
 \starttext
 text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
 \stoptext
 
 An extreme solution:
 
 \startcatcodetable \txtcatcodes
  \catcode`\^^I = 10
  \catcode`\^^M =  5
  \catcode`\^^L =  5
  \catcode`\= 10
  \catcode`\^^Z =  9
  \catcode`\\   =  0
  \catcode`\{   =  1
  \catcode`\}   =  2
 %   \catcode`\%   = 14
 \stopcatcodetable
 \starttext
 \asciimode
 text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
 \stoptext
 
 
 
 As I don't have any experience with \asciimode I am not sure if I can 
 map this entirely on a complex book project...
 
 In addition to usual asciimode, I changed the definition so that %
 does not have its usual meaning. So, % is no longer a comment; it
 just typesets percentage sign. You can get a comment using
 
 \starthiding ... \stophiding.
 
 Any known side-effects?
 
 * You need to use \math{...} to go into math mode. $ will just give
 a dollar.
 
 * You need \startformula ... \stopformula to go into display math.
 $$...$$ will just print dollars.
 
 * _ in text mode will produce an underscore instead of an error. _
 in math mode will work fine. The same for ^.
 
 * You need
 
 \starttex(something) (I don't remember on the top of my head)
 \def\whatever#1{...}
 \stoptex(something)
 
 to change the definition of a macro.
 
 I have never really tested it on a large document. Maybe you can
 just add this and see if everything compiles.
 
 Hi Aditya, Steffen and others,
 
 I was toying around with catcode tables too. Shouldn’t it suffice
 to simply change % to ‘other’? This way you can keep the dollar
 style math.
 
 Philipp
 
 ···8
 
 \setupinteraction[state=start]
 
 \unprotect
 \newcatcodetable \urlcatcodes % ordinary \ctxcatcodes except for minor changes
 \startcatcodetable \urlcatcodes
\catcode`\^^I = 10
\catcode`\^^M =  5
\catcode`\^^L =  5
\catcode`\= 10
\catcode`\^^Z =  9
\catcode`\\   =  0
\catcode`\{   =  1
\catcode`\}   =  2
\catcode`\$   =  3
\catcode`\   =  4
\catcode`\#   =  6
\catcode`\^   =  7
\catcode`\_   =  8
\catcode`\~   = 13
\catcode`\|   = 13
\catcode`\%   = \@@other
\catcode`\*   = \@@comment % comment this out if you don’t need line 
 comments
 \stopcatcodetable
 
 \protect
 
 \starttext
 
 \bgroup
  TEST
  \setcatcodetable \urlcatcodes
  \hyphenatedurl{www.test%it.com}
  * this should be treated as comment
  \footnote{
\hyphenatedurl{www.test%it.com}
  }
  Math mode: $(x)(y)\,(Fx\,.\,x=y\,.\supset\,Fy)$
  TEST
 \egroup
 
 \stoptext
 
 ···8



Hi Hans and other catcode wizards,

isn't there a way to make this kind of catcode trickery only be available 
*inside* \hyphenatedurl{} environment?

Steffen
___
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] hyphenated url

2010-10-27 Thread Wolfgang Schuster

Am 27.10.2010 um 12:35 schrieb Steffen Wolfrum:

 Hi Hans and other catcode wizards,
 
 isn't there a way to make this kind of catcode trickery only be available 
 *inside* \hyphenatedurl{} environment?

It’s useless in this case because the „%“ is read from the footnote before 
\hyphenatedurl can see it and any local catcode changes have therefore no 
effect.

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] hyphenated url

2010-10-27 Thread Aditya Mahajan

On Wed, 27 Oct 2010, Peter Münster wrote:


On Wed, Oct 27 2010, Peter Münster wrote:


Yes. But if I understand TeX right, then there will be only 2 possibilities:

1.)
\footnote{bla
\starthyphenatedurl
www.%.com
\stophyphenatedurl
bla bla}


Ok, I must be wrong, because this does not work neither:

\starttext
bla
\footnote{
 bla
 \starttyping
   bla%bla
 \stoptyping
 bla
}
\stoptext


That has to do with the definition of typing: 
http://tracker.luatex.org/view.php?id=505


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] hyphenated url

2010-10-27 Thread Peter Münster
On Wed, Oct 27 2010, Aditya Mahajan wrote:

 That has to do with the definition of typing:
 http://tracker.luatex.org/view.php?id=505

Ah, that means, that buffers can solve the problem:

\starttext
\startbuffer
  \starttyping
bla%bla
  \stoptyping
\stopbuffer
bla\footnote{
  bla
  \getbuffer
  bla
}

\startbuffer
  bla%bla
\stopbuffer
bla\footnote{
  bla
  \typebuffer
  bla
}

\startbuffer
\type{bla%bla}
\stopbuffer
bla\footnote{bla\getbuffer bla}
\stoptext

Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/


___
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] hyphenated url

2010-10-27 Thread Steffen Wolfrum

Hi,

I tried an other approach: \useURL

But here the letterpercent trick doesn't work at all ... ie. there is no 
clickable link at all anymore!


\setupinteraction
   [state=start]

\showframe

\starttext

\useURL[aurl]   [http://www.kommers.se/upload/Analysarkiv/In\letterpercent 
English/Analyses/Woolcock\letterpercent paper\letterpercent on\letterpercent 
impact\letterpercent of\letterpercent Lisbontreaty\letterpercent 
on\letterpercent tradepolicy.pdf] [] 
[http://www.kommers.se/upload/Analysarkiv/In\letterpercent 
English/Analyses/Woolcock\letterpercent paper\letterpercent on\letterpercent 
impact\letterpercent of\letterpercent Lisbontreaty\letterpercent 
on\letterpercent tradepolicy.pdf] 

test \from[aurl] text
\stoptext




Steffen






Am 25.10.2010 um 15:12 schrieb Philipp Gesang:

 On 2010-10-25 12:45:17, Steffen Wolfrum wrote:
 
 Am 25.10.2010 um 12:26 schrieb Philipp Gesang:
 \unexpanded\gdef\hyphenatedurl
 
 Should work in footnotes. Regards, Philipp
 
 
 No, it doesn't (see below).
 Do you have an other idea?
 
 Right; it works in footnotes but doesn’t accomplish what you
 want. Sorry, I tried a lot but ‘\letterpercent’ is the only
 way it works for me.
 
 Concerning the urlencoding I referred to browsers automatically
 converting raw urls, like for instance
 
  http://www.google.com/search?q=ähre
 
 , which is encoded as
 
  http://www.google.com/search?q=%C3%A4hre
 
 by my browser. As long as your urls mainly consist of unicode
 strings you might not need the actual (ascii) percent sign.  In
 this case you could be fine simply by converting strings like
 ‘%C3%A4hre’ to ‘Ähre’, rendering urls percent-less, and rely on
 the browsers to re-encode them on the fly. Might be a bit far
 fetched, though.
 
 Philipp
 
 
 
 Thanks, Steffen
 (ConTeXt  ver: 2010.10.21)
 
 
 Runaway argument?
 {test \hyphenatedurl {www.test\par \stoptext \par 
 ! File ended while scanning use of \@@notemakedescription.
 
 system   error on line 0 in file : File ended while scanning use of 
 \@@notemakedescription ...
 
 
 \let\normalhyphenatedurl\hyphenatedurl
 
 \bgroup
 
 \catcode`\%=11
 
 \unexpanded\gdef\hyphenatedurl
 {\bgroup
  \catcode`\%=11
  \expandafter\egroup
  \normalhyphenatedurl}
 
 \egroup
 
 \setupinteraction
   [state=start]
 
 \starttext
 
 text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
 
 \stoptext
 
 
 
 
 ___
 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
 ___
 ___
 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
 ___

___
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] hyphenated url

2010-10-27 Thread Peter Münster
On Mon, Oct 25 2010, Steffen Wolfrum wrote:
 
 http://www.cirp.ru/conferences/new%20neighborhood%20policy/publications/frellesen%20paper.doc
 
 There is no way to typeset this in ConTeXt MkIV???

No problem here:

\setupinteraction[state=start]
\starttext
No hexa-code after percent, so Acroread transforms \% to
\%25\footnote{\hyphenatedurl{www.test.com/\letterpercent/test}}

ok\footnote{\hyphenatedurl{www.test.com/\letterpercent24/test}}

ok\footnote{\hyphenatedurl{http://www.cirp.ru/conferences/new\letterpercent
20neighborhood\letterpercent20policy/publications/frellesen\letterpercent
20paper.doc}}

Does not work, perhaps bug in
\ConTeXt\footnote{\hyphenatedurl{http://www.cirp.ru/conferences/new
neighborhood policy/publications/frellesen paper.doc}}
\stoptext

Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/


___
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] hyphenated url

2010-10-27 Thread Philipp Gesang
On 2010-10-27 22:28:56, Steffen Wolfrum wrote:
 
 Hi,
 
 I tried an other approach: \useURL
 
 But here the letterpercent trick doesn't work at all ... ie.
 there is no clickable link at all anymore!

Hi Steffen,

if you consider an environment-style version of ‘\useURL’
appropriate, you could hack your way through like this:

···8

\setupinteraction[state=start]

\unprotect
\newcatcodetable \urlcatcodes
\startcatcodetable \urlcatcodes
\catcode`\^^I = 10
\catcode`\^^M =  5
\catcode`\^^L =  5
\catcode`\= 10
\catcode`\^^Z =  9
\catcode`\\   =  0
\catcode`\{   =  1
\catcode`\}   =  2
\catcode`\$   = \@@other
\catcode`\   = \@@other
\catcode`\#   = \@@other
\catcode`\^   = \@@other
\catcode`\_   = \@@other
\catcode`\~   = \@@other
\catcode`\|   = \@@other
\catcode`\%   = \@@other
\catcode`\*   = \@@other
\stopcatcodetable

\startluacode
function structures.references.urls.get(name,method,space)
local u = structures.references.urls.data[name]
if u then 
local url, file = u[1], u[2] 
if file and file ~=  then 
context(%s/%s,url,file)
else 
context.pushcatcodes(vrb)
context(url)
context.popcatcodes()
end  
end  
end

\stopluacode

\def\startuseURL{%
  \bgroup%
  \catcodetable \urlcatcodes
  \dodoubleempty\dostartuseURL%
}

\let\stopuseURL\relax

\def\dostartuseURL[#1][#2]#3\stopuseURL{
  \egroup
  
\ctxlua{structures.references.urls.define(#1,string.strip(\!!bs\detokenize{#3}\!!es),,\!!bs\detokenize{#2}\!!es)}
}

% Usage example here:

\startuseURL[anotherurl][urldescription]
http://test%it.example.com
\stopuseURL

\starttext

\from[anotherurl]\par
\url[anotherurl]\par

Test.\footnote{\url[anotherurl]}

\stoptext

···8

This deviates from standard ‘\useURL’ in the order of parameters:

  \startuseURL[#1][#2]
  #3
  \stopuseURL

where #1 is the id, #2 is the display text and #3 the url itself.
This eliminates the need to resort to ‘\letterpercent’ as well
and works in footnotes.

Philipp


 
 
 \setupinteraction
[state=start]
 
 \showframe
 
 \starttext
 
 \useURL[aurl]   
 [http://www.kommers.se/upload/Analysarkiv/In\letterpercent 
 English/Analyses/Woolcock\letterpercent paper\letterpercent on\letterpercent 
 impact\letterpercent of\letterpercent Lisbontreaty\letterpercent 
 on\letterpercent tradepolicy.pdf] [] 
 [http://www.kommers.se/upload/Analysarkiv/In\letterpercent 
 English/Analyses/Woolcock\letterpercent paper\letterpercent on\letterpercent 
 impact\letterpercent of\letterpercent Lisbontreaty\letterpercent 
 on\letterpercent tradepolicy.pdf] 
 
 test \from[aurl] text
 \stoptext
 
 
 
 
 Steffen
 
 
 
 
 
 
 Am 25.10.2010 um 15:12 schrieb Philipp Gesang:
 
  On 2010-10-25 12:45:17, Steffen Wolfrum wrote:
  
  Am 25.10.2010 um 12:26 schrieb Philipp Gesang:
  \unexpanded\gdef\hyphenatedurl
  
  Should work in footnotes. Regards, Philipp
  
  
  No, it doesn't (see below).
  Do you have an other idea?
  
  Right; it works in footnotes but doesn’t accomplish what you
  want. Sorry, I tried a lot but ‘\letterpercent’ is the only
  way it works for me.
  
  Concerning the urlencoding I referred to browsers automatically
  converting raw urls, like for instance
  
   http://www.google.com/search?q=ähre
  
  , which is encoded as
  
   http://www.google.com/search?q=%C3%A4hre
  
  by my browser. As long as your urls mainly consist of unicode
  strings you might not need the actual (ascii) percent sign.  In
  this case you could be fine simply by converting strings like
  ‘%C3%A4hre’ to ‘Ähre’, rendering urls percent-less, and rely on
  the browsers to re-encode them on the fly. Might be a bit far
  fetched, though.
  
  Philipp
  
  
  
  Thanks, Steffen
  (ConTeXt  ver: 2010.10.21)
  
  
  Runaway argument?
  {test \hyphenatedurl {www.test\par \stoptext \par 
  ! File ended while scanning use of \@@notemakedescription.
  
  system   error on line 0 in file : File ended while scanning use 
  of \@@notemakedescription ...
  
  
  \let\normalhyphenatedurl\hyphenatedurl
  
  \bgroup
  
  \catcode`\%=11
  
  \unexpanded\gdef\hyphenatedurl
  {\bgroup
   \catcode`\%=11
   \expandafter\egroup
   \normalhyphenatedurl}
  
  \egroup
  
  \setupinteraction
[state=start]
  
  \starttext
  
  text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
  
  \stoptext
  
  
  
  
  ___
  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] hyphenated url

2010-10-26 Thread Steffen Wolfrum

Hi Aditya, Philipp and all,

thank you very much for your interesting ideas!
As far as I understood, your starting point is to avoid % being treated as 
comment ...
This is nice for controlled situations.

But in real life projects there are many, various situations where the % is 
used and needed as comment!


Isn't there a way to treat % as a regular character dedicated in the 
\hyphenatedurl{} environment only??


Steffen

PS @ Philipp: Using * as line comment would start the problem again, as * 
is also a valid part of URL addresses ...



of course we need to keep a character for comment.

Am 26.10.2010 um 00:49 schrieb Philipp Gesang:

 Hi Aditya, Steffen and others,
 
 I was toying around with catcode tables too. Shouldn’t it suffice
 to simply change % to ‘other’? This way you can keep the dollar
 style math.
 
 Philipp
 
 ···8
 
 \setupinteraction[state=start]
 
 \unprotect
 \newcatcodetable \urlcatcodes % ordinary \ctxcatcodes except for minor changes
 \startcatcodetable \urlcatcodes
\catcode`\^^I = 10
\catcode`\^^M =  5
\catcode`\^^L =  5
\catcode`\= 10
\catcode`\^^Z =  9
\catcode`\\   =  0
\catcode`\{   =  1
\catcode`\}   =  2
\catcode`\$   =  3
\catcode`\   =  4
\catcode`\#   =  6
\catcode`\^   =  7
\catcode`\_   =  8
\catcode`\~   = 13
\catcode`\|   = 13
\catcode`\%   = \@@other
\catcode`\*   = \@@comment % comment this out if you don’t need line 
 comments
 \stopcatcodetable
 
 \protect
 
 \starttext
 
 \bgroup
  TEST
  \setcatcodetable \urlcatcodes
  \hyphenatedurl{www.test%it.com}
  * this should be treated as comment
  \footnote{
\hyphenatedurl{www.test%it.com}
  }
  Math mode: $(x)(y)\,(Fx\,.\,x=y\,.\supset\,Fy)$
  TEST
 \egroup
 
 \stoptext
 
 ···8

___
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] hyphenated url

2010-10-25 Thread Philipp Gesang
On 2010-10-25 10:25:55, Steffen Wolfrum wrote:
 Hi,
 
 the % is a frequently used character in URL.
 But \hyphenatedurl{} can deal with it ...
 
 Does someone has a fix?
 
 
 \starttext
 text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
Ugly, but it works:

text\footnote{test \hyphenatedurl{www.test\letterpercent it.com} test.} text.

Regards, Philipp

PS: As I understand, the percent sign appears mostly in
url-encoded strings. Couldn’t you just convert that to unicode
and let the browser do the re-encoding when the url is accessed?

 \stoptext
 
 
 Thanks,
 Steffen
 ___
 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
 ___

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments


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


Re: [NTG-context] hyphenated url

2010-10-25 Thread Steffen Wolfrum

Am 25.10.2010 um 11:16 schrieb Philipp Gesang:

 On 2010-10-25 10:25:55, Steffen Wolfrum wrote:
 Hi,
 
 the % is a frequently used character in URL.
 But \hyphenatedurl{} can deal with it ...
 
 Does someone has a fix?
 
 
 \starttext
 text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
 Ugly, but it works:
 
 text\footnote{test \hyphenatedurl{www.test\letterpercent it.com} test.} text.


If setupinteraction is set [state=start] it does not work:


! Undefined control sequence.


\normalhyphenatedurl ...phenatedurlnormal \let \b 
  \dohyphenatedurlbefore \le...
\@@ddfootnotetitle ...w.test\letterpercent it.com}
   test.
\dododescriptioncomponent ...onparameter \c!title 
  }}}\endgroup \fi \fi \fi \...
\@@notemakedescription ...list =,\c!bookmark =,][]
  \xdef \currentnotenumber {...
l.27 ...durl{www.test\letterpercent it.com} test.}
   text.
? 



Steffen
___
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] hyphenated url

2010-10-25 Thread Philipp Gesang
On 2010-10-25 11:39:12, Steffen Wolfrum wrote:
 
 Am 25.10.2010 um 11:16 schrieb Philipp Gesang:
 
  On 2010-10-25 10:25:55, Steffen Wolfrum wrote:
  Hi,
  
  the % is a frequently used character in URL.
  But \hyphenatedurl{} can deal with it ...
  
  Does someone has a fix?
  
  
  \starttext
  text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
  Ugly, but it works:
  
  text\footnote{test \hyphenatedurl{www.test\letterpercent it.com} test.} 
  text.
 
 
 If setupinteraction is set [state=start] it does not work:

Did you try exactly this:

··8·
\setupinteraction[state=start]
\starttext
text\footnote{test \hyphenatedurl{www.test\letterpercent it.com} test.} text.
\stoptext
··8·

?

 
 
 ! Undefined control sequence.
 
 
 \normalhyphenatedurl ...phenatedurlnormal \let \b 
   \dohyphenatedurlbefore 
 \le...
 \@@ddfootnotetitle ...w.test\letterpercent it.com}
test.
 \dododescriptioncomponent ...onparameter \c!title 
   }}}\endgroup \fi \fi \fi 
 \...
 \@@notemakedescription ...list =,\c!bookmark =,][]
   \xdef \currentnotenumber 
 {...
 l.27 ...durl{www.test\letterpercent it.com} test.}
text.
 ? 

Ahh, looks like your ‘\hyphenatedurl’ is not yet unexpanded …
how old is your context? With the one from  2010.10.22 16:46 it
definitely works. If you don’t want to update, check
lang-url.mkiv for ‘\def\hyphenatedurl#1%’ and prefix it with an
‘\unexpanded’.

Philipp

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

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments


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


Re: [NTG-context] hyphenated url

2010-10-25 Thread Steffen Wolfrum

Am 25.10.2010 um 11:50 schrieb Philipp Gesang:

 On 2010-10-25 11:39:12, Steffen Wolfrum wrote:
 
 Am 25.10.2010 um 11:16 schrieb Philipp Gesang:
 
 On 2010-10-25 10:25:55, Steffen Wolfrum wrote:
 Hi,
 
 the % is a frequently used character in URL.
 But \hyphenatedurl{} can deal with it ...
 
 Does someone has a fix?
 
 
 \starttext
 text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
 Ugly, but it works:
 
 text\footnote{test \hyphenatedurl{www.test\letterpercent it.com} test.} 
 text.
 
 
 If setupinteraction is set [state=start] it does not work:
 
 Did you try exactly this:
 
 ··8·
 \setupinteraction[state=start]
 \starttext
 text\footnote{test \hyphenatedurl{www.test\letterpercent it.com} test.} text.
 \stoptext
 ··8·



sorry, in the meanwhile I was experimenting with another hack (but does not 
work when used in footnotes) that mixed things up:


\let\normalhyphenatedurl\hyphenatedurl

\bgroup

\catcode`\%=11

\gdef\hyphenatedurl
 {\bgroup
  \catcode`\%=11
  \expandafter\egroup
  \normalhyphenatedurl}

\egroup



Steffen
___
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] hyphenated url

2010-10-25 Thread Steffen Wolfrum

Am 25.10.2010 um 11:16 schrieb Philipp Gesang:

 text\footnote{test \hyphenatedurl{www.test\letterpercent it.com} test.} text.
 
 Regards, Philipp
 
 PS: As I understand, the percent sign appears mostly in
 url-encoded strings. Couldn’t you just convert that to unicode
 and let the browser do the re-encoding when the url is accessed?


I am not sure what you mean ... when I enter the code as above pressing the 
link in Acrobat gives:


http://www.test%25it.com


So using \hyphenatedurl doesn't make sense anymore ... or did I miss the 
crucial part?!


Steffen
___
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] hyphenated url

2010-10-25 Thread Philipp Gesang
On 2010-10-25 12:05:37, Steffen Wolfrum wrote:
 
 \let\normalhyphenatedurl\hyphenatedurl
 
 \bgroup
 
 \catcode`\%=11
 
 \gdef\hyphenatedurl

\unexpanded\gdef\hyphenatedurl

Should work in footnotes. Regards, Philipp

  {\bgroup
   \catcode`\%=11
   \expandafter\egroup
   \normalhyphenatedurl}
 
 \egroup
 
 
 
 Steffen
 ___
 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
 ___

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments


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


Re: [NTG-context] hyphenated url

2010-10-25 Thread Steffen Wolfrum

Am 25.10.2010 um 12:26 schrieb Philipp Gesang:

 On 2010-10-25 12:05:37, Steffen Wolfrum wrote:
 
 \let\normalhyphenatedurl\hyphenatedurl
 
 \bgroup
 
 \catcode`\%=11
 
 \gdef\hyphenatedurl
 
 \unexpanded\gdef\hyphenatedurl
 
 Should work in footnotes. Regards, Philipp


No, it doesn't (see below).
Do you have an other idea?

Thanks, Steffen
(ConTeXt  ver: 2010.10.21)


Runaway argument?
{test \hyphenatedurl {www.test\par \stoptext \par 
! File ended while scanning use of \@@notemakedescription.

system   error on line 0 in file : File ended while scanning use of 
\@@notemakedescription ...


\let\normalhyphenatedurl\hyphenatedurl

\bgroup

\catcode`\%=11

\unexpanded\gdef\hyphenatedurl
 {\bgroup
  \catcode`\%=11
  \expandafter\egroup
  \normalhyphenatedurl}

\egroup

\setupinteraction
   [state=start]

\starttext

text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.

\stoptext




___
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] hyphenated url

2010-10-25 Thread Philipp Gesang
On 2010-10-25 12:45:17, Steffen Wolfrum wrote:
 
 Am 25.10.2010 um 12:26 schrieb Philipp Gesang:
  \unexpanded\gdef\hyphenatedurl
  
  Should work in footnotes. Regards, Philipp
 
 
 No, it doesn't (see below).
 Do you have an other idea?

Right; it works in footnotes but doesn’t accomplish what you
want. Sorry, I tried a lot but ‘\letterpercent’ is the only
way it works for me.

Concerning the urlencoding I referred to browsers automatically
converting raw urls, like for instance

  http://www.google.com/search?q=ähre

, which is encoded as

  http://www.google.com/search?q=%C3%A4hre

by my browser. As long as your urls mainly consist of unicode
strings you might not need the actual (ascii) percent sign.  In
this case you could be fine simply by converting strings like
‘%C3%A4hre’ to ‘Ähre’, rendering urls percent-less, and rely on
the browsers to re-encode them on the fly. Might be a bit far
fetched, though.

Philipp


 
 Thanks, Steffen
 (ConTeXt  ver: 2010.10.21)
 
 
 Runaway argument?
 {test \hyphenatedurl {www.test\par \stoptext \par 
 ! File ended while scanning use of \@@notemakedescription.
 
 system   error on line 0 in file : File ended while scanning use of 
 \@@notemakedescription ...
 
 
 \let\normalhyphenatedurl\hyphenatedurl
 
 \bgroup
 
 \catcode`\%=11
 
 \unexpanded\gdef\hyphenatedurl
  {\bgroup
   \catcode`\%=11
   \expandafter\egroup
   \normalhyphenatedurl}
 
 \egroup
 
 \setupinteraction
[state=start]
 
 \starttext
 
 text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
 
 \stoptext
 
 
 
 
 ___
 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
 ___


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


Re: [NTG-context] hyphenated url

2010-10-25 Thread Steffen Wolfrum

Am 25.10.2010 um 15:12 schrieb Philipp Gesang:

 Concerning the urlencoding I referred to browsers automatically
 converting raw urls, like for instance
 
  http://www.google.com/search?q=ähre
 
 , which is encoded as
 
  http://www.google.com/search?q=%C3%A4hre
 
 by my browser. As long as your urls mainly consist of unicode
 strings you might not need the actual (ascii) percent sign.  In
 this case you could be fine simply by converting strings like
 ‘%C3%A4hre’ to ‘Ähre’, rendering urls percent-less, and rely on
 the browsers to re-encode them on the fly. Might be a bit far
 fetched, though.



It is the space the encodes to %20. Thus, it might look a bit strange eg. in 
cases like this:

http://www.cirp.ru/conferences/new%20neighborhood%20policy/publications/frellesen%20paper.doc


There is no way to typeset this in ConTeXt MkIV???

Steffen
___
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] hyphenated url

2010-10-25 Thread Aditya Mahajan

On Mon, 25 Oct 2010, Steffen Wolfrum wrote:


Hi,

the % is a frequently used character in URL.
But \hyphenatedurl{} can deal with it ...

Does someone has a fix?


\starttext
text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
\stoptext


An extreme solution:

\startcatcodetable \txtcatcodes
\catcode`\^^I = 10
\catcode`\^^M =  5
\catcode`\^^L =  5
\catcode`\= 10
\catcode`\^^Z =  9
\catcode`\\   =  0
\catcode`\{   =  1
\catcode`\}   =  2
%   \catcode`\%   = 14
\stopcatcodetable
\starttext
\asciimode
text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
\stoptext

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] hyphenated url

2010-10-25 Thread Steffen Wolfrum

Am 25.10.2010 um 19:30 schrieb Aditya Mahajan:

 On Mon, 25 Oct 2010, Steffen Wolfrum wrote:
 
 Hi,
 
 the % is a frequently used character in URL.
 But \hyphenatedurl{} can deal with it ...
 
 Does someone has a fix?
 
 
 \starttext
 text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
 \stoptext
 
 An extreme solution:
 
 \startcatcodetable \txtcatcodes
\catcode`\^^I = 10
\catcode`\^^M =  5
\catcode`\^^L =  5
\catcode`\= 10
\catcode`\^^Z =  9
\catcode`\\   =  0
\catcode`\{   =  1
\catcode`\}   =  2
 %   \catcode`\%   = 14
 \stopcatcodetable
 \starttext
 \asciimode
 text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
 \stoptext



As I don't have any experience with \asciimode I am not sure if I can map 
this entirely on a complex book project...

Any known side-effects?

Steffen
___
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] hyphenated url

2010-10-25 Thread Aditya Mahajan

On Mon, 25 Oct 2010, Steffen Wolfrum wrote:



Am 25.10.2010 um 19:30 schrieb Aditya Mahajan:


On Mon, 25 Oct 2010, Steffen Wolfrum wrote:


Hi,

the % is a frequently used character in URL.
But \hyphenatedurl{} can deal with it ...

Does someone has a fix?


\starttext
text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
\stoptext


An extreme solution:

\startcatcodetable \txtcatcodes
   \catcode`\^^I = 10
   \catcode`\^^M =  5
   \catcode`\^^L =  5
   \catcode`\= 10
   \catcode`\^^Z =  9
   \catcode`\\   =  0
   \catcode`\{   =  1
   \catcode`\}   =  2
%   \catcode`\%   = 14
\stopcatcodetable
\starttext
\asciimode
text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
\stoptext




As I don't have any experience with \asciimode I am not sure if I can map 
this entirely on a complex book project...


In addition to usual asciimode, I changed the definition so that % does 
not have its usual meaning. So, % is no longer a comment; it just typesets 
percentage sign. You can get a comment using


\starthiding ... \stophiding.


Any known side-effects?


* You need to use \math{...} to go into math mode. $ will just give a 
dollar.


* You need \startformula ... \stopformula to go into display math.
$$...$$ will just print dollars.

* _ in text mode will produce an underscore instead of an error. _ in math 
mode will work fine. The same for ^.


* You need

\starttex(something) (I don't remember on the top of my head)
\def\whatever#1{...}
\stoptex(something)

to change the definition of a macro.

I have never really tested it on a large document. Maybe you can just add 
this and see if everything compiles.


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] hyphenated url

2010-10-25 Thread Wolfgang Schuster

Am 25.10.2010 um 23:00 schrieb Aditya Mahajan:

 In addition to usual asciimode, I changed the definition so that % does not 
 have its usual meaning. So, % is no longer a comment; it just typesets 
 percentage sign. You can get a comment using
 
 \starthiding ... \stophiding.

But there is now command which end at the end of the line like a normal 
comment, maybe this should be added to luatex (like we have \Ustartmath ... 
\Ustopmath as alternative to $...$)

 Any known side-effects?
 
 * You need to use \math{...} to go into math mode. $ will just give a dollar.

There is also \formula{...}.

 * You need \startformula ... \stopformula to go into display math.
 $$...$$ will just print dollars.
 
 * _ in text mode will produce an underscore instead of an error. _ in math 
 mode will work fine. The same for ^.
 
 * You need
 
 \starttex(something) (I don't remember on the top of my head)
 \def\whatever#1{...}
 \stoptex(something)
 
 to change the definition of a macro.

\starttexcode
...
\stoptexcode

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] hyphenated url

2010-10-25 Thread Philipp Gesang
On 2010-10-25 17:00:39, Aditya Mahajan wrote:
 On Mon, 25 Oct 2010, Steffen Wolfrum wrote:
 
 
 Am 25.10.2010 um 19:30 schrieb Aditya Mahajan:
 
 On Mon, 25 Oct 2010, Steffen Wolfrum wrote:
 
 Hi,
 
 the % is a frequently used character in URL.
 But \hyphenatedurl{} can deal with it ...
 
 Does someone has a fix?
 
 
 \starttext
 text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
 \stoptext
 
 An extreme solution:
 
 \startcatcodetable \txtcatcodes
\catcode`\^^I = 10
\catcode`\^^M =  5
\catcode`\^^L =  5
\catcode`\= 10
\catcode`\^^Z =  9
\catcode`\\   =  0
\catcode`\{   =  1
\catcode`\}   =  2
 %   \catcode`\%   = 14
 \stopcatcodetable
 \starttext
 \asciimode
 text\footnote{test \hyphenatedurl{www.test%it.com} test.} text.
 \stoptext
 
 
 
 As I don't have any experience with \asciimode I am not sure if I can map 
 this entirely on a complex book project...
 
 In addition to usual asciimode, I changed the definition so that %
 does not have its usual meaning. So, % is no longer a comment; it
 just typesets percentage sign. You can get a comment using
 
 \starthiding ... \stophiding.
 
 Any known side-effects?
 
 * You need to use \math{...} to go into math mode. $ will just give
 a dollar.
 
 * You need \startformula ... \stopformula to go into display math.
 $$...$$ will just print dollars.
 
 * _ in text mode will produce an underscore instead of an error. _
 in math mode will work fine. The same for ^.
 
 * You need
 
 \starttex(something) (I don't remember on the top of my head)
 \def\whatever#1{...}
 \stoptex(something)
 
 to change the definition of a macro.
 
 I have never really tested it on a large document. Maybe you can
 just add this and see if everything compiles.

Hi Aditya, Steffen and others,

I was toying around with catcode tables too. Shouldn’t it suffice
to simply change % to ‘other’? This way you can keep the dollar
style math.

Philipp

···8

\setupinteraction[state=start]

\unprotect
\newcatcodetable \urlcatcodes % ordinary \ctxcatcodes except for minor changes
\startcatcodetable \urlcatcodes
\catcode`\^^I = 10
\catcode`\^^M =  5
\catcode`\^^L =  5
\catcode`\= 10
\catcode`\^^Z =  9
\catcode`\\   =  0
\catcode`\{   =  1
\catcode`\}   =  2
\catcode`\$   =  3
\catcode`\   =  4
\catcode`\#   =  6
\catcode`\^   =  7
\catcode`\_   =  8
\catcode`\~   = 13
\catcode`\|   = 13
\catcode`\%   = \@@other
\catcode`\*   = \@@comment % comment this out if you don’t need line 
comments
\stopcatcodetable

\protect

\starttext

\bgroup
  TEST
  \setcatcodetable \urlcatcodes
  \hyphenatedurl{www.test%it.com}
  * this should be treated as comment
  \footnote{
\hyphenatedurl{www.test%it.com}
  }
  Math mode: $(x)(y)\,(Fx\,.\,x=y\,.\supset\,Fy)$
  TEST
\egroup

\stoptext

···8





-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments


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