summaryrefslogtreecommitdiff
path: root/wikicvt.py
diff options
context:
space:
mode:
Diffstat (limited to 'wikicvt.py')
-rw-r--r--wikicvt.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/wikicvt.py b/wikicvt.py
new file mode 100644
index 0000000..7d22c2e
--- /dev/null
+++ b/wikicvt.py
@@ -0,0 +1,52 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+# Copyright (C) 2008 Sergey Poznyakoff
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import sys
+import getopt
+from wiki2html import *
+
+def usage(code=0):
+ print "usage: " + sys.argv[0] + "[-hv] [--help] [--verbose] file\n"
+ sys.exit(code)
+
+def main():
+ verbose_flag = 0
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "hv",
+ ["help", "verbose" ])
+ except getopt.GetoptError:
+ usage(1)
+
+ for o, a in opts:
+ if o in ("-h", "--help"):
+ usage()
+ if o in ("-v", "--verbose"):
+ verbose_flag = verbose_flag + 1
+
+ if len(args) == 1:
+ inputfilename = args[0]
+ else:
+ usage(1)
+
+ markup = HtmlWiktionaryMarkup(filename=inputfilename, lang="pl")
+ markup.parse()
+ print str(markup)
+ if verbose_flag > 0:
+ markup.output()
+
+if __name__ == '__main__':
+ main()

Return to:

Send suggestions and report system problems to the System administrator.