diff options
Diffstat (limited to 'Master/texmf-dist/scripts/context/lua/mtx-patterns.lua')
-rw-r--r-- | Master/texmf-dist/scripts/context/lua/mtx-patterns.lua | 57 |
1 files changed, 45 insertions, 12 deletions
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-patterns.lua b/Master/texmf-dist/scripts/context/lua/mtx-patterns.lua index fbcb251b1f2..7144da9b090 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-patterns.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-patterns.lua @@ -12,17 +12,36 @@ local addsuffix = file.addsuffix local lpegmatch, validutf8 = lpeg.match, lpeg.patterns.validutf8 local helpinfo = [[ ---convert generate context language files (mnemonic driven, if not given then all) ---check check pattern file (or those used by context when no file given) ---path source path where hyph-foo.tex files are stored ---destination destination path - -examples of usage: - -mtxrun --script pattern --check hyph-*.tex -mtxrun --script pattern --check --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns -mtxrun --script pattern --convert --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns/tex --destination=e:/tmp/patterns -mtxrun --script pattern --convert --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns/txt --destination=e:/tmp/patterns +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-patterns</entry> + <entry name="detail">ConTeXt Pattern File Management</entry> + <entry name="version">0.20</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="convert"><short>generate context language files (mnemonic driven, if not given then all)</short></flag> + <flag name="check"><short>check pattern file (or those used by context when no file given)</short></flag> + <flag name="path"><short>source path where hyph-foo.tex files are stored</short></flag> + <flag name="destination"><short>destination path</short></flag> + <flag name="specification"><short>additional patterns: e.g.: =cy,hyph-cy,welsh</short></flag> + </subcategory> + </category> + </flags> + <examples> + <category> + <title>Examples</title> + <subcategory> + <example><command>mtxrun --script pattern --check hyph-*.tex</command></example> + <example><command>mtxrun --script pattern --check --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns</command></example> + <example><command>mtxrun --script pattern --convert --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns/tex --destination=e:/tmp/patterns</command></example> + <example><command>mtxrun --script pattern --convert --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns/txt --destination=e:/tmp/patterns</command></example> + </subcategory> + </category> + </examples> +</application> ]] local application = logs.application { @@ -454,7 +473,19 @@ function scripts.patterns.save(destination,mnemonic,name,patternsnew,hyphenation end function scripts.patterns.prepare() + -- dofile(resolvers.findfile("char-def.lua")) + -- + local specification = environment.argument("specification") + if specification then + local components = utilities.parsers.settings_to_array(specification) + if #components == 3 then + table.insert(scripts.patterns.list,1,components) + report("specification added: %s %s %s",table.unpack(components)) + else + report('invalid specification: %q, "xx,lang-yy,zzzz" expected',specification) + end + end end function scripts.patterns.check() @@ -484,7 +515,7 @@ function scripts.patterns.convert() else local destination = environment.argument("destination") or "." if path == destination then - resport("source path and destination path should differ (use --path and/or --destination)") + report("source path and destination path should differ (use --path and/or --destination)") else local files = environment.files local only = false @@ -516,6 +547,8 @@ if environment.argument("check") then elseif environment.argument("convert") then scripts.patterns.prepare() scripts.patterns.convert() +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end |