Move allefant's Python-based modules where they belong.

This commit is contained in:
Eric S. Raymond 2007-05-07 14:27:02 +00:00
parent 566d56938e
commit a3d35d0149
4 changed files with 55 additions and 55 deletions

View file

@ -1,3 +1,57 @@
Tools for hacking or generating WML, maps, images, and sounds belong here.
Tools for sanity-checking the mainline campaigns and associated data
also belong here.
== Python API ==
=== wmltools.py ===
The main facility in this module is a cross-referencer class.
It also contains utility methods for working with the data tree.
See the header comment of wmtools.p for details
=== wmlparser.py ===
This python module contains code originally developed for CampGen - it contains
a general WML Parser written in Python, just like the Perl one. So if you want
to develop tools in Python instead of Perl and need a WML parser, it may save
some time.
The API currently is very sparsely documented, but I plan to extend this. In
general, wmlparser.py contains the WML Parser, which is used like:
parser = wmlparser.Parser(datapath)
Then:
parser.parse_file(filename)
or
parser.parse_stream(file)
or
parser.parse_text(string)
to set what to parse, and finally:
wmldata = parser.parse()
to read everything into a Python representation of the parsed data.
=== wmldata.py ===
This file has several utility methods defined to access and manipulate
WML data. Most of them will not be generally useful. An example:
for unit in wmldata.get_all("unit"):
print unit.get_text_val("id")
== Standalone use ==
=== wmparser ===
If called standalone, wmlparser.py will parse whatever you give it and
dump back to stdout. For example:
python wmlparser.py -e {game.cfg} > game.dump
Should produce a nice several 100000 lines file of the complete configuration
with all included files and macros expanded to a single file.

View file

@ -1,58 +1,4 @@
== About ==
This python module contains code originally developed for CampGen - it contains
a general WML Parser written in Python, just like the Perl one. So if you want
to develop tools in Python instead of Perl and need a WML parser, it may safe
some time.
== API ==
=== wmlparser ===
The API currently is very sparsely documented, but I plan to extend this. In
general, wmlparser.py contains the WML Parser, which is used like:
parser = wmlparser.Parser(datapath)
Then:
parser.parse_file(filename)
or
parser.parse_stream(file)
or
parser.parse_text(string)
to set what to parse, and finally:
wmldata = parser.parse()
to read everything into a Python representation of the parsed data.
=== wmldata ===
This file has several utility methods defined to access and manipulate WML data.
Most of them will not be generally useful. An example:
for unit in wmldata.get_all("unit"):
print unit.get_text_val("id")
=== campaign_client ===
This has some functions to connect to the campaign server, and to convert
between binary WML, WML objects, and WML on disk.
== Standalone ==
=== wmparser ===
If called standalone, wmlparser.py will parse whatever you give it and dump back
to stdout. For example:
python wmlparser.py -e {game.cfg} > game.dump
Should produce a nice several 100000 lines file of the complete configuration
with all included files and macros expanded to a single file.
=== campaigns_client ===
campign_clientpy is an experimental replacement for the Perl campaign client.
If called standalone, it can be used to list, download and upload campaigns.