1. pygame
  2. Untitled project
  3. pygame


marcus  committed be5f89d

Added alias support for ducmentation

  • Participants
  • Parent commits c744791
  • Branches pgreloaded

Comments (0)

Files changed (12)

File doc/api_template.xml

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

File doc/create_rstref.py

View file
     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:

File doc/src/api.dtd

View file
 <!DOCTYPE module [
-<!ELEMENT module (short, desc, example?, (func | class)*)>
+<!ELEMENT module (alias?, short, desc, example?, (func | class)*)>
+<!ELEMENT alias (#PCDATA)>
 <!ELEMENT desc (#PCDATA)>
 <!ELEMENT short (#PCDATA)>
 <!ELEMENT call (#PCDATA)>

File doc/src/base.xml

View file
 <!DOCTYPE module SYSTEM "api.dtd">
 <module name="pygame2.base">
+  <alias>pygame2</alias>
   <short>basic features used by pygame2</short>
     Base features for pygame2 that are shared shared and used throughout

File doc/src/freetypebase.xml

View file
 <!DOCTYPE module SYSTEM "api.dtd">
 <module name="pygame2.freetype.base">
+  <alias>pygame2.freetype</alias>
   <short>Wrapping module for the FreeType 2 font library</short>
       This module wraps the FreeType 2 font library to add

File doc/src/mask.xml

View file
 <?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>

File doc/src/sdlbase.xml

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

File doc/src/sdlextbase.xml

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

File doc/src/sdlgfxbase.xml

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

File doc/src/sdlimagebase.xml

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

File doc/src/sdlmixerbase.xml

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

File doc/src/sdlttfbase.xml

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