summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2008-11-26 23:56:26 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2008-11-26 23:56:32 +0200
commit34268ebe03133b799208da261dbdbf7c0fb40b93 (patch)
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')
-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
--- /dev/null
+++ b/build-aux/extrns.php
@@ -0,0 +1,71 @@
1<?php
2$nss = array();
3$ns_res = array();
4function select_ns($file, $lang)
5{
6 global $nss, $ns_res;
7
8 include($file);
9 if (isset($namespaceNames)) {
10 array_push($nss, $lang);
11 printf("wiki_ns_%s = {\n", $lang);
12 $reg = array();
13 foreach ($namespaceNames as $ns => $val) {
14 if ($val == '')
15 continue;
16 if (preg_match('/(.*)\$1(.*)/', $val, $matches))
17 array_push($reg,
18 array($matches[1], $matches[2],
19 $ns));
20 else
21 printf(" \"%s\": \"%s\",\n", $val, $ns);
22 }
23 print "}\n";
24 if (count($reg)) {
25 array_push($ns_res, $lang);
26 printf("wiki_ns_re_%s = [\n", $lang);
27 foreach ($reg as $val) {
28 printf(" (\"%s\", \"%s\", \"%s\"),\n",
29 $val[0], $val[1], $val[2]);
30 }
31 print "]\n";
32 }
33 }
34}
35
36
37function process_dir($dir)
38{
39 if (!($dp = opendir ($dir)))
40 die ("Can't open data directory.");
41 while ($name = readdir ($dp)) {
42 if (preg_match('|.*/?Messages([A-Z][a-z_-]+).php|', $name, $matches)) {
43 $lang = strtolower($matches[1]);
44 #print "$lang\n";
45 select_ns($name, $lang);
46 }
47
48 }
49 closedir ($dp);
50}
51
52echo "# This file is generated automatically. Do not edit.\n";
53echo "# -*- coding: utf-8 -*-\n";
54process_dir(".");
55
56print "wiki_ns = {\n";
57if (count($nss)) {
58 foreach ($nss as $lang)
59 printf(" \"%s\": wiki_ns_%s,\n", $lang, $lang);
60}
61print "}\n";
62
63print "wiki_ns_re = {\n";
64if (count($ns_res)) {
65 foreach ($nss as $lang)
66 printf(" \"%s\": wiki_ns_re_%s,\n", $lang, $lang);
67}
68print "}\n";
69
70
71?>

Return to:

Send suggestions and report system problems to the System administrator.