Commits

Anonymous committed be5f89d

Added alias support for ducmentation

  • Participants
  • Parent commits c744791
  • Branches pgreloaded

Comments (0)

Files changed (12)

doc/api_template.xml

 -->
 
 <module name="NAME">
+  <alias>ALIAS</alias>
   <short>SHORT DESC (single line)</short>
   <desc>DESCRIPTION</desc>
   <example>EXAMPLE CODE</example>

doc/create_rstref.py

     def __init__ (self, filename):
         self.filename = filename
         self.modulename = None
+        self.modulealias = None
         self.shortdesc = "TODO"
         self.description = "TODO"
         self.example = ""
     def get_module_docs (self, dom):
         module = dom.getElementsByTagName ("module")[0]
         self.modulename = module.getAttribute ("name")
+        node = module.getElementsByTagName ("alias")
+        if node and node[0].firstChild:
+            self.modulealias = node[0].firstChild.nodeValue
+            self.modulealias = self.modulealias.strip ()
         node = module.getElementsByTagName ("short")[0]
         if node.firstChild:
             self.shortdesc = node.firstChild.nodeValue
         fname = os.path.join ("ref", "%s.rst")
         fp = open (fname % self.modulename.replace (".", "_"), "w")
         fp.write (RST_HEADER)
-        
-        fp.write (":mod:`%s` -- %s\n" % (self.modulename, self.shortdesc))
-        fp.write ("%s\n" %
-                  ("=" * (11 + len (self.modulename) + len (self.shortdesc))))
+
+        name = self.modulename
+        if self.modulealias:
+            name = self.modulealias
+
+        fp.write (":mod:`%s` -- %s\n" % (name, self.shortdesc))
+        fp.write ("%s\n" % ("=" * (11 + len (name) + len (self.shortdesc))))
         fp.write ("%s" % self.create_desc_rst (self.description))
-        fp.write (".. module:: %s\n" % (self.modulename))
+        fp.write (".. module:: %s\n" % (name))
         fp.write ("   :synopsis: %s\n\n" % (self.shortdesc))
 
         if len (self.example) > 0:
 <!DOCTYPE module [
-<!ELEMENT module (short, desc, example?, (func | class)*)>
+<!ELEMENT module (alias?, short, desc, example?, (func | class)*)>
 <!ATTLIST module name CDATA #REQUIRED>
 
+<!ELEMENT alias (#PCDATA)>
 <!ELEMENT desc (#PCDATA)>
 <!ELEMENT short (#PCDATA)>
 <!ELEMENT call (#PCDATA)>
 <!DOCTYPE module SYSTEM "api.dtd">
 
 <module name="pygame2.base">
+  <alias>pygame2</alias>
   <short>basic features used by pygame2</short>
   <desc>
     Base features for pygame2 that are shared shared and used throughout

doc/src/freetypebase.xml

 <!DOCTYPE module SYSTEM "api.dtd">
 
 <module name="pygame2.freetype.base">
+  <alias>pygame2.freetype</alias>
   <short>Wrapping module for the FreeType 2 font library</short>
   <desc>
       This module wraps the FreeType 2 font library to add
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE module SYSTEM "api.dtd">
 
-
 <module name="pygame2.mask">
   <short>image masks for fast pixel-perfect overlap checks</short>
   <desc>

doc/src/sdlbase.xml

 <!DOCTYPE module SYSTEM "api.dtd">
 
 <module name="pygame2.sdl.base">
+  <alias>pygame2.sdl</alias>
   <short>basic SDL wrapper module</short>
   <desc>
     Basic Pygame2 SDL wrapper module

doc/src/sdlextbase.xml

 <!DOCTYPE module SYSTEM "api.dtd">
 
 <module name="pygame2.sdlext.base">
+  <alias>pygame2.sdlext</alias>
   <short>basic extensions for SDL modules</short>
   <desc>
     Extension module for the pygame2 SDL wrapper.

doc/src/sdlgfxbase.xml

 <!DOCTYPE module SYSTEM "api.dtd">
 
 <module name="pygame2.sdlgfx.base">
+  <alias>pygame2.sdlgfx</alias>
   <short>basic SDL_gfx wrapper module</short>
   <desc>
     Basic SDL_gfx library wrapper module

doc/src/sdlimagebase.xml

 <!DOCTYPE module SYSTEM "api.dtd">
 
 <module name="pygame2.sdlimage.base">
+  <alias>pygame2.sdlimage</alias>
   <short>basic SDL_image wrapper module</short>
   <desc>
     Basic SDL_image wrapper module

doc/src/sdlmixerbase.xml

 <!DOCTYPE module SYSTEM "api.dtd">
 
 <module name="pygame2.sdlmixer.base">
+  <alias>pygame2.sdlmixer</alias>
   <short>basic SDL_mixer wrapper module</short>
   <desc>
     .. note::

doc/src/sdlttfbase.xml

 <!DOCTYPE module SYSTEM "api.dtd">
 
 <module name="pygame2.sdlttf.base">
+  <alias>pygame2.sdlttf</alias>
   <short>basic SDL_ttf wrapper module</short>
   <desc>
     Basic SDL_ttf wrapper module