Re: [NTG-context] substitutions: can i send this?

2009-03-29 Thread Khaled Hosny
On Sat, Mar 28, 2009 at 07:27:07PM -0600, Idris Samawi Hamid ادريس سماوي حامد 
wrote:
 On Fri, 27 Mar 2009 06:05:03 -0600, Khaled Hosny khaledho...@eglug.org
 wrote:
 If it's not so complex, have you considered overloading font features with
 fea files? Now that Adobe has (finally!) completed a major overhaul of the
 spec, including the features neeeded for arabic, that's an option.

Yes, it is an option, but not for complex operations as you know, and
also font dependant (not all fonts use Adobe glyph names etc.)

 But for your more complex needs, see the m-translate module. Maybe that
 can be developed further? Note that Hans has pointed out that this is NOT
 a core module and that it is preferable to fix the source beforehand.

That module shows exactly the problem I mentioned in my earlier message,
it processes the whole input file not only the text buffers that will be
actually typesetted, so If I've an \Idris macro it'll get replaced as
well, or I've to parse the file myself which isn't really an option.
OTP fits nicely in this, but it isn't as powerful as lua, and there seem
not to be much interest in maintaining it in the future.

I think, being able to process the to-be-typesetted text in lua is
desirable and have many use cases. Now we have callbacks for input
buffer, which is not very handy when you need to handle only the textual
material without messing with TeX commands and macros, and callbacks for
token and node list, which make very complex what is otherwise simple
task, like 1st - 1\high{st} conversion, etc.

Regards,
 Khaled


-- 
 Khaled Hosny
 Arabic localiser and member of Arabeyes.org team
 Free font developer


signature.asc
Description: Digital 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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] substitutions: can i send this?

2009-03-29 Thread Hans Hagen

Khaled Hosny wrote:


That module shows exactly the problem I mentioned in my earlier message,
it processes the whole input file not only the text buffers that will be
actually typesetted, so If I've an \Idris macro it'll get replaced as
well, or I've to parse the file myself which isn't really an option.
OTP fits nicely in this, but it isn't as powerful as lua, and there seem
not to be much interest in maintaining it in the future.


we already have spellchecking (operates on node lists) so having some 
kind of replacement mechanism is doable too (not now, later when i've 
cleaned up some code)


otp's are gone from mkiv .. i simple don't enable the primitives any 
more and the filter mechanisms is not loaded; of course that coule 
become a module to be loaded at runtime if there is some real need for it


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] substitutions: can i send this?

2009-03-28 Thread Idris Samawi Hamid ادريس سماوي ح امد

On Fri, 27 Mar 2009 06:05:03 -0600, Khaled Hosny khaledho...@eglug.org
wrote:


(I know this an old thread, but I just happen to exactly the same
feature Idris was asking for)

On Thu, Oct 09, 2008 at 12:53:47AM +0200, Mojca Miklavec wrote:

usage: ruby scriptname.rb  input.tex  output.tex

#!/usr/bin/env ruby

subs_hash = {
  Mohamed = Muḥammad,
  Idris = ادريس,
}

while line = STDIN.gets
  subs_hash.each do |key,value|
line.gsub!(Regexp.new(key), value)
  end
  puts line
end


Such approach has a major disadvantage, one have to take care of not
altering macros and tex commands or we may end with a broken document (I
have more general use case where the to be substituted strings can
occur in macros as well), and we know that only TeX can read TeX :)

I'm thinking in lua callback that get fed with text buffers in a similar
way to OTPs, so one can use regular expressions to pre-process the text
without messing with node list, think in code that replaces 2nd with
2\high{nd} etc. which would be very complex to be done at node list
level.


If it's not so complex, have you considered overloading font features with
fea files? Now that Adobe has (finally!) completed a major overhaul of the
spec, including the features neeeded for arabic, that's an option.

But for your more complex needs, see the m-translate module. Maybe that
can be developed further? Note that Hans has pointed out that this is NOT
a core module and that it is preferable to fix the source beforehand.

سلام
Idris

--
Professor Idris Samawi Hamid, Editor-in-Chief
International Journal of Shi`i Studies
Department of Philosophy
Colorado State University
Fort Collins, CO 80523
___
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
___