ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* lua questions
@ 2009-01-22 21:24 Thomas A. Schmitz
  2009-01-23 11:13 ` Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas A. Schmitz @ 2009-01-22 21:24 UTC (permalink / raw)
  To: mailing ConTeXt users list for

Hi all,

this is a bit OT and should probably go to a lua list, but since some  
people here are very proficient in lua and I feel less embarrassed  
about noob questions here... I have a half-functioning python script  
to convert entries from a classics database into the bibtex format. I  
want to rewrite it in lua and make it more functional. Three little  
problems/questions:

1. I found a script to convert Roman numerals via lpeg here: http://lua-users.org/wiki/LpegRecipes 
  but it uses the syntax lpeg.Ca which my lpeg doesn't recognize and  
which I can't find in the lpeg manual. According to a talk by Roberto  
Ierusalimschy, "lpeg.Ca(patt) - "accumulates" the nested captures." (http://www.inf.puc-rio.br/~roberto/lpeg/slides-lpeg-workshop2008.pdf 
) Is this obsolete, has it been replaced by anything?

2. How can I check if a string begins with a class of words "(Der |Die  
|Das |The |An )" etc. and strip these words from the string? I do it  
with a compiled regexp in python, but "Programming in lua" has this to  
say: "Unlike some other systems, in Lua a modifier can only be applied  
to a character class; there is no way to group patterns under a  
modifier. For instance, there is no pattern that matches an optional  
word (unless the word has only one letter). Usually you can circumvent  
this limitation using some of the advanced techniques that we will see  
later." I haven't found these techniques yet.

3. How can I compare strings with utf8 characters? My naive approach
    if string.find(record, "Résumé")
doesn't appear to work (while the same method does work if the string  
has only ASCII characters).

Sorry if this is OT, and I'll be grateful for any pointers.

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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-01-29 12:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-22 21:24 lua questions Thomas A. Schmitz
2009-01-23 11:13 ` Hans Hagen
2009-01-23 13:04   ` Thomas A. Schmitz
2009-01-29 12:35   ` Thomas A. Schmitz
2009-01-29 12:42     ` Taco Hoekwater

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).