Author: esr
Date: Tue Apr 17 05:31:37 2007
New Revision: 16874
URL: http://svn.gna.org/viewcvs/wesnoth?rev=16874&view=rev
Log:
OK, automatic documentation extraction from macros is fully working.
Modified:
trunk/data/terrain-graphics.cfg
trunk/data/tools/Makefile
trunk/data/tools/helpheader.xhtml
trunk/data/tools/macroscope
trunk/data/traits.cfg
Modified: trunk/data/terrain-graphics.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/terrain-graphics.cfg?rev=16874&r1=16873&r2=16874&view=diff
==============================================================================
--- trunk/data/terrain-graphics.cfg (original)
+++ trunk/data/terrain-graphics.cfg Tue Apr 17 05:31:37 2007
@@ -18,7 +18,7 @@
#-----------------------------------------------------------------
# forest/pine<->Castle|Encampment special cases, also used by some other
# terrain
-# Macro's moved to terrain-graphics/forestcastle.cfg
+# Macros moved to terrain-graphics/forestcastle.cfg
#-----------------------------------------------------------------
{FORESTADJCASTLEA Ff (C*,K*,_K,Xu,Ql,Qxu,Rf*) 100 forest/pine-castle}
Modified: trunk/data/tools/Makefile
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/Makefile?rev=16874&r1=16873&r2=16874&view=diff
==============================================================================
--- trunk/data/tools/Makefile (original)
+++ trunk/data/tools/Makefile Tue Apr 17 05:31:37 2007
@@ -1,7 +1,7 @@
# Recipes for various sanity checks.
#
# Hack this if our location in the Wesnoth source tree changes
-TOPDIR = ../..
+TOPDIR = ../../
# References to terrain graphics go through so many layers of nasty
# opaque macros that trying to reference-check them is hopeless.
# So suppress reporting them unused even if they seem to have
@@ -36,6 +36,6 @@
macro-reference.xhtml:
@cat helpheader.xhtml >macro-reference.xhtml
- @./macroscope --extracthelp --exclude data/scenarios --exclude
data/campaigns $(EXCLUDE) $(TOPDIR) >>macro-reference.xhtml
+ @./macroscope --extracthelp --exclude data/scenarios --exclude
data/tutorial --exclude data/campaigns $(EXCLUDE) $(TOPDIR)
>>macro-reference.xhtml
@cat helptrailer.xhtml >>macro-reference.xhtml
Modified: trunk/data/tools/helpheader.xhtml
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/helpheader.xhtml?rev=16874&r1=16873&r2=16874&view=diff
==============================================================================
--- trunk/data/tools/helpheader.xhtml (original)
+++ trunk/data/tools/helpheader.xhtml Tue Apr 17 05:31:37 2007
@@ -8,8 +8,12 @@
<link rev="made" href="mailto:[EMAIL PROTECTED]" />
<style type="text/css">
/*<![CDATA[*/
-.listing {font-family:monospace;}
-.bold {font-style:bold;}
+.file_header: {font-style:normal; font-weight:bold;}
+.file_explanation {font-style:normal; font-weight:bold;}
+.macro_name {font-style:normal; font-weight:bold;}
+.macro_formals {font-style:italic; font-weight:normal;}
+.macro_explanation {font-style:normal; font-weight:normal;}
+.listing {font-style:normal; font-family:monospace;}
/*]]>*/
</style>
</head>
Modified: trunk/data/tools/macroscope
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/macroscope?rev=16874&r1=16873&r2=16874&view=diff
==============================================================================
--- trunk/data/tools/macroscope (original)
+++ trunk/data/tools/macroscope Tue Apr 17 05:31:37 2007
@@ -46,10 +46,10 @@
"HTML-escape a text line"
return line.replace("<", "<").replace(">", ">").replace("&", "&")
-def interpret(lines):
+def interpret(lines, css):
"Interpret the ! convention for .cfg comments."
inlisting = False
- outstr = "<p>"
+ outstr = '<p class="%s">' % css
for line in lines:
line = line.rstrip()
if not inlisting and not line:
@@ -290,10 +290,10 @@
nrefs = len(defloc.references)
if nrefs:
print name
- def extracthelp(self, fp):
+ def extracthelp(self, pref, fp):
"Deliver all macro help comments in HTML form."
doclist = self.xref.keys()
- doclist = filter(lambda x: self.xref[x].docstring, doclist)
+ doclist = filter(lambda x: self.xref[x].docstring.count("\n") > 1,
doclist)
doclist.sort(lambda x, y: cmp(self.xref[x], self.xref[y]))
outstr = ""
filename = None
@@ -305,7 +305,11 @@
outstr += "</dl>\n"
counted += 1
filename = entry.filename
- outstr += "<h1>From file: " + filename + "</h1>\n"
+ if filename.startswith(pref):
+ displayname = filename[len(pref):]
+ else:
+ displayname = filename
+ outstr += "<h1 class='file_header'>From file: " + displayname
+ "</h1>\n"
hdr = []
dfp = open(filename)
for line in dfp:
@@ -315,7 +319,7 @@
break
dfp.close()
if hdr:
- outstr += interpret(hdr)
+ outstr += interpret(hdr, "file_explanation")
outstr += "<dl>\n"
if entry.docstring:
lines = entry.docstring.split("\n")
@@ -325,12 +329,12 @@
if not lines: # Ignore definitions without a docstring
continue
outstr += "\n<dt>\n"
- outstr += "<emphasis role='bold'>" + header[0] + "</emphasis>"
+ outstr += "<em class='macro_name'>" + header[0] + "</em>"
if header[1:]:
- outstr += " <emphasis>"+" ".join(header[1:])+"</emphasis>"
+ outstr += " <em class='macro_formals'>"+"
".join(header[1:])+"</em>"
outstr += "\n</dt>\n"
outstr += "<dd>\n"
- outstr += interpret(lines)
+ outstr += interpret(lines, "macro_explanation")
outstr += "</dd>\n"
outstr += "</dl>\n"
fp.write(outstr)
@@ -402,7 +406,7 @@
filelist = allfiles(dirpath, "|".join(exclude))
xref = CrossRef(filelist)
if extracthelp:
- xref.extracthelp(sys.stdout)
+ xref.extracthelp(dirpath[0], sys.stdout)
elif listfiles:
for filename in filelist:
print filename
Modified: trunk/data/traits.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/traits.cfg?rev=16874&r1=16873&r2=16874&view=diff
==============================================================================
--- trunk/data/traits.cfg (original)
+++ trunk/data/traits.cfg Tue Apr 17 05:31:37 2007
@@ -1,6 +1,9 @@
+# Traits for the [modifications] clause of SingleWML descriptions
+
#textdomain wesnoth
#define TRAIT_LOYAL
+# Units with trait Loyal have no upkeep.
[trait]
id=loyal
male_name= _ "loyal"
@@ -13,6 +16,7 @@
#enddef
#define TRAIT_UNDEAD
+# Units with trait Undead cannot be poisoned.
[trait]
id=undead
male_name= _ "undead"
@@ -22,6 +26,7 @@
#enddef
#define TRAIT_STRONG
+# Units with trait Strong get a +1 increment in hitpoints and melee damage.
[trait]
id=strong
male_name= _ "strong"
@@ -39,6 +44,7 @@
#enddef
#define TRAIT_DEXTROUS
+# Units with trait Dextrous get a +1 to ranged damage.
[trait]
id=dextrous
male_name= _ "dextrous"
@@ -52,6 +58,7 @@
#enddef
#define TRAIT_QUICK
+# Units with trait Quick have +1 movement.
[trait]
id=quick
male_name= _ "quick"
@@ -68,6 +75,7 @@
#enddef
#define TRAIT_INTELLIGENT
+# Units with trait Intelligent get a 20% decrease in XP required to advance.
[trait]
id=intelligent
male_name= _ "intelligent"
@@ -80,6 +88,7 @@
#enddef
#define TRAIT_RESILIENT
+# Units with trait Resilient get 10% more HP plus 3.
[trait]
id=resilient
male_name= _ "resilient"
@@ -96,6 +105,7 @@
#enddef
#define TRAIT_HEALTHY
+# Units with trait Healthy heal at 3HP per turn.
[trait]
id=healthy
male_name= _ "healthy"
@@ -109,6 +119,7 @@
#enddef
#define TRAIT_FEARLESS
+# Units with trait Fearless fight normally during unfavorable day/night times.
[trait]
id=fearless
male_name= _ "fearless"
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits