I've been working on an implementation of Unicode Bidirectional Algorithm[1] purely in lua for quite sometime now, the code started as translation of an implementation written in C but have evolved since then.
The algorithm part is more or less done, I've, informally, verified that relevant rules are implemented correctly (some optional rules make no sense in the ConTeXt of luatex). The interface with luatex's node list is the trickiest part, but so far I think the result is acceptable now, though I still encounter some mysterious results occasionally that I've no explanation for. The code is macro package neutral as far as it goes, and there is currently packages for ConTeXt, plain and LaTeX though only ConTeXt was tested with real world documents. The code is located on github[2]. There are some sample documents (a ConTeXt demo is at the end of the t-bidi.tex file, processing it with context will run it). There are some issue that I want to solve, including handling of math mode a providing a real interface with more options for customisable parts and writing some documentation. The LaTeX package is called luabidi but there already a package with that name and bidi is already taken, I'm still thinking of another name (originally I named it luadirection as I had that ambitious goal of supporting vertical text as well, but I'm now aiming at bidi in horizontal contexts only). [1] http://www.unicode.org/reports/tr9/ [2] https://github.com/khaledhosny/luadirections Regards, Khaled -- Khaled Hosny Egyptian Arab
