mail[Wesnoth-commits] r33398 - in /trunk: src/gui/widgets/canvas.cpp utils/wiki_grabber.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by koraq on March 07, 2009 - 22:31:
Author: mordante
Date: Sat Mar  7 22:31:40 2009
New Revision: 33398

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33398&view=rev
Log:
Add an extra formatting option to the grabber.

Also cleaned up the source of the grabber slightly. Used the new
formatting at some places.

Modified:
    trunk/src/gui/widgets/canvas.cpp
    trunk/utils/wiki_grabber.py

Modified: trunk/src/gui/widgets/canvas.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/canvas.cpp?rev=33398&r1=33397&r2=33398&view=diff
==============================================================================
--- trunk/src/gui/widgets/canvas.cpp (original)
+++ trunk/src/gui/widgets/canvas.cpp Sat Mar  7 22:31:40 2009
@@ -211,7 +211,7 @@
  *                                     @* bold      bold font
  *                                     @* italic    italic font
  *                                     @* underline underlined font
- *                                     Since SDL has problems combining these
+ *                                     @-Since SDL has problems combining 
these
  *                                     styles only one can be picked. Once 
SDL
  *                                     will allow multiple options, this type
  *                                     will be transformed to a comma 
separated
@@ -228,8 +228,9 @@
  *                                     @* top    aligned at the top
  *                                     @* bottom aligned at the bottom
  *                                     @* center centered
- *                                     When nothing is set or an another 
value
- *                                     as in the list the item is centred.
+ *                                     @-When nothing is set or an another
+ *                                     value as in the list the item is
+ *                                     centred.
  *
  *     h_align                         Horizontal alignment; how an item is
  *                                     aligned horizontal in the available

Modified: trunk/utils/wiki_grabber.py
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/wiki_grabber.py?rev=33398&r1=33397&r2=33398&view=diff
==============================================================================
--- trunk/utils/wiki_grabber.py (original)
+++ trunk/utils/wiki_grabber.py Sat Mar  7 22:31:40 2009
@@ -87,6 +87,15 @@
             for j in range(len(res[i])):
                  sys.stderr.write("Line " + str(i) + " match " + str(j) + " 
: " + res[i][j] + "\n")
 
+    def format(data):
+        """Formats the data for the wiki.
+        
+        @* -> \n* needed in a list.
+        @- -> \n needed to add text after a list."""
+        data = re.sub(r'@\*', "\n*", data)
+        data = re.sub(r'@\-', "\n", data)
+        return data
+
     def create_config_table(data):
         """Creates a table for data in a config table.
 
@@ -115,7 +124,7 @@
                 result += "| mandatory\n"
             else:
                 result += "| " + res[i][2] + "\n"
-            result += "| " + re.sub(r'@\*', "\n*", res[i][3]) + "\n"
+            result += "| " + format(res[i][3]) + "\n"
         result += "|}"
 
         return result
@@ -144,7 +153,7 @@
             result += "|-\n"
             result += "| " + res[i][0] + "\n"
             result += "| " + res[i][1] + "\n"
-            result += "| " + re.sub(r'@\*', "\n*", res[i][2]) + "\n"
+            result += "| " + format(res[i][2]) + "\n"
         result += "|}"
 
         return result
@@ -168,7 +177,7 @@
         for i in range(len(res)):
             result += "|-\n"
             result += "| <span id=\"" + res[i][0] + "\">" + res[i][0] + 
"</span>\n"
-            result += "| " + re.sub(r'@\*', "\n*", res[i][1]) + "\n"
+            result += "| " + format(res[i][1]) + "\n"
         result += "|}"
 
         return result
@@ -192,7 +201,7 @@
         for i in range(len(res)):
             result += "|-\n"
             result += "| " + res[i][0] + "\n"
-            result += "| " + re.sub(r'@\*', "\n*", res[i][1]) + "\n"
+            result += "| " + format(res[i][1]) + "\n"
         result += "|}"
 
         return result




Related Messages


Powered by MHonArc, Updated Sat Mar 07 22:40:39 2009