Philipp Gesang avatar Philipp Gesang committed 2e4bb99

fix globals; bump version

Comments (0)

Files changed (3)

doc/context/third/transliterator/COPYING

-Copyright 2010, 2011 Philipp Gesang. All rights reserved.
+Copyright 2010-2013 Philipp Gesang. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:

tex/context/third/transliterator/t-transliterator.mkiv

 %D \module
 %D   [      file=t-transliterator,
-%D        version=2010-12-23 22:10:09+0100,
+%D        version=2013-03-27 21:23:59+0100,
 %D          title=\CONTEXT\ User Module,
 %D       subtitle=The Transliterator,
 %D         author=Philipp Gesang,
   setup=list,
   parent=TRL,
   style=no,
-  version=hg-r16,
+  version=hg-r56,
   comment=Transliteration from non-Latin scripts.,
 ]
 

tex/context/third/transliterator/transliterator.lua

 #!/usr/bin/env texlua
 --------------------------------------------------------------------------------
 --         FILE:  transliterator.lua
---        USAGE:  to be called by t-transliterator.mkiv 
+--        USAGE:  to be called by t-transliterator.mkiv
 --  DESCRIPTION:  basic lua environment for the Transliterator module
 -- REQUIREMENTS:  latest ConTeXt MkIV
---       AUTHOR:  Philipp Gesang (Phg), <megas.kapaneus@gmail.com>
+--       AUTHOR:  Philipp Gesang (Phg), <phg42.2a@gmail.com>
 --      CREATED:  2010-12-23 22:12:31+0100
 --------------------------------------------------------------------------------
 --
 translit.deficient_font = "no"
 translit.parser_cache   = { }
 
+local utf8     = unicode.utf8
+local utf8byte = utf8.byte
+local utf8len  = utf8.len
+
 --------------------------------------------------------------------------------
 -- Predefining vowel lists
 --------------------------------------------------------------------------------
         end
     }
 
-    function translit.make_add_dict(dict)
+    translit.make_add_dict = function (dict)
         return setmetatable(dict, Dict_add)
     end
 end
 -- Generate a rule pattern from hash table.
 do
     local P, R, V = lpeg.P, lpeg.R, lpeg.V
-    local len     = unicode.utf8.len
 
     -- multi-char rules first
-    function translit.addrules (dict, rules)
+    translit.addrules = function (dict, rules)
         local by_length, occurring_lengths = { }, { }
         for chr, _ in next, dict do
-            local l = len(chr)
+            local l = utf8len(chr)
             if not by_length[l] then
                 by_length[l] = { }
                 occurring_lengths[#occurring_lengths+1] = l
         local i = 1
         local r = ""
         repeat
-            r = r .. utf.byte(s,i) .. " "
+            r = r .. utf8byte(s,i) .. " "
             i = i + 1
-        until utf.byte(s,i) == nil
+        until utf8byte(s,i) == nil
         return r
     end
 end
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.