summaryrefslogtreecommitdiffabout
path: root/build-aux
authorSergey Poznyakoff <gray@gnu.org.ua>2008-11-26 21:56:26 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2008-11-26 21:56:32 (GMT)
commit34268ebe03133b799208da261dbdbf7c0fb40b93 (patch) (side-by-side diff)
tree355c58a6d9a8325ff1d395b6dadff2cec8013271 /build-aux
parent67cd79c3c64d6dfe73ff5dd80ba51d0bf9267b04 (diff)
downloadwikitrans-34268ebe03133b799208da261dbdbf7c0fb40b93.tar.gz
wikitrans-34268ebe03133b799208da261dbdbf7c0fb40b93.tar.bz2
Fix HTML generation.
* wikins.py: New file (automatically generated.) * build-aux/extrns.php: New file (generator for the above). * wiki2html.py (HtmlWikiMarkup.image_kw, target): Remove (wiki_ns_name,link,mktgt): New methods. (str_link,str_tmpl): Rewrite using self.link. * wiki2text.py, wikimarkup.py (__init__): Fix handling of multiple keywords.
Diffstat (limited to 'build-aux') (more/less context) (ignore whitespace changes)
-rw-r--r--build-aux/extrns.php71
1 files changed, 71 insertions, 0 deletions
diff --git a/build-aux/extrns.php b/build-aux/extrns.php
new file mode 100644
index 0000000..e2e8c4f
--- a/dev/null
+++ b/build-aux/extrns.php
@@ -0,0 +1,71 @@
+<?php
+$nss = array();
+$ns_res = array();
+function select_ns($file, $lang)
+{
+ global $nss, $ns_res;
+
+ include($file);
+ if (isset($namespaceNames)) {
+ array_push($nss, $lang);
+ printf("wiki_ns_%s = {\n", $lang);
+ $reg = array();
+ foreach ($namespaceNames as $ns => $val) {
+ if ($val == '')
+ continue;
+ if (preg_match('/(.*)\$1(.*)/', $val, $matches))
+ array_push($reg,
+ array($matches[1], $matches[2],
+ $ns));
+ else
+ printf(" \"%s\": \"%s\",\n", $val, $ns);
+ }
+ print "}\n";
+ if (count($reg)) {
+ array_push($ns_res, $lang);
+ printf("wiki_ns_re_%s = [\n", $lang);
+ foreach ($reg as $val) {
+ printf(" (\"%s\", \"%s\", \"%s\"),\n",
+ $val[0], $val[1], $val[2]);
+ }
+ print "]\n";
+ }
+ }
+}
+
+
+function process_dir($dir)
+{
+ if (!($dp = opendir ($dir)))
+ die ("Can't open data directory.");
+ while ($name = readdir ($dp)) {
+ if (preg_match('|.*/?Messages([A-Z][a-z_-]+).php|', $name, $matches)) {
+ $lang = strtolower($matches[1]);
+ #print "$lang\n";
+ select_ns($name, $lang);
+ }
+
+ }
+ closedir ($dp);
+}
+
+echo "# This file is generated automatically. Do not edit.\n";
+echo "# -*- coding: utf-8 -*-\n";
+process_dir(".");
+
+print "wiki_ns = {\n";
+if (count($nss)) {
+ foreach ($nss as $lang)
+ printf(" \"%s\": wiki_ns_%s,\n", $lang, $lang);
+}
+print "}\n";
+
+print "wiki_ns_re = {\n";
+if (count($ns_res)) {
+ foreach ($nss as $lang)
+ printf(" \"%s\": wiki_ns_re_%s,\n", $lang, $lang);
+}
+print "}\n";
+
+
+?>

Return to:

Send suggestions and report system problems to the System administrator.