Update of /cvsroot/gtkpod/libgpod/bindings/python
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv3560
Added Files:
gpod_doc.i.in gtkdoc-to-swig.xsl
Log Message:
add support files for converting gtk-docs to python docstrings
--- NEW FILE: gpod_doc.i.in ---
%feature("autodoc", "1");
%feature("autodoc", "sw_get_tracks(Itdb_iTunesDB itdb) -> [Itdb_Track, ...]")
sw_get_tracks;
%feature("docstring", "
Get tracks in itdb.
Parameters
itdb: an Itdb_iTunesDB
Returns: a list of Itdb_Track objects
") sw_get_tracks;
%feature("autodoc", "sw_get_track(GList list, gint index) -> Itdb_Track")
sw_get_track;
%feature("docstring", "
Get a track
Parameters
list: a GList
index: position of the track
Returns: an Itdb_Track
") sw_get_track;
%feature("autodoc", "sw_get_rule(GList list, gint index) -> SPLRule")
sw_get_rule;
%feature("docstring", "
Get a rule
Parameters
list: a GList
index: position of the rule
Returns: an SPLRule
") sw_get_rule;
%feature("autodoc", "sw_get_playlist(GList list, gint index) -> Itdb_Playlist")
sw_get_playlist;
%feature("docstring", "
Get a playlist
Parameters
list: a GList
index: position of the playlist
Returns: an Itdb_Playlist
") sw_get_playlist;
%feature("autodoc", "sw_get_list_len(GList list) -> Int") sw_get_list_len;
%feature("docstring", "
Get the length of list
Parameters
list: a GList
Returns: length of list
") sw_get_list_len;
%feature("autodoc", "sw_get_playlists(Itdb_iTunesDB itdb) -> [Itdb_Playlist,
...]") sw_get_playlists;
%feature("docstring", "
Get playlists
Parameters
itdb: an Itdb_iTunesDB
Returns: a list of Itdb_Playlist objects
") sw_get_playlists;
%feature("autodoc", "sw_get_playlist_tracks(Itdb_Playlist pl) -> [Itdb_Track,
...]") sw_get_playlist_tracks;
%feature("docstring", "
Get tracks in playlist
pl: an Itdb_Playlist
Returns: a list of Itdb_Track objects
") sw_get_playlist_tracks;
%feature("autodoc", "sw_set_track_userdata(Itdb_Track track, Dictionary
userdata)") sw_set_track_userdata;
%feature("docstring", "
Set a tracks userdata
Parameters
track: an Itdb_Track
userdata: a dictionary. Note that userdata can be None, in order to
clear all userdata.
") sw_set_track_userdata;
%feature("autodoc", "sw_get_track_userdata(Itdb_Track track) -> Dictionary")
sw_get_track_userdata;
%feature("docstring", "
Get track userdata
Parameters
track: an Itdb_Track
Returns: a dictionary containing any userdata for track
") sw_get_track_userdata;
--- NEW FILE: gtkdoc-to-swig.xsl ---
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output
encoding="ASCII"
method="text"/>
<xsl:template match="/">
<xsl:for-each select="//refsect2[./title/anchor/@role='function']">
<xsl:text>%feature("docstring", "</xsl:text>
<xsl:call-template name="CleanQuotes">
<xsl:with-param name="body" select="para"/>
</xsl:call-template>
<xsl:if test="[EMAIL PROTECTED]'params']">
<xsl:text> Parameters </xsl:text>
<xsl:for-each select="[EMAIL PROTECTED]'params']/varlistentry">
<xsl:call-template name="CleanQuotes">
<!-- We're going to remove the nbsp chars as we're rendering to
python docstrings -->
<xsl:with-param name="body" select="translate(term,' ','')"/>
</xsl:call-template>
<xsl:call-template name="CleanQuotes">
<xsl:with-param name="body"
select="translate(listitem,' ','')"/>
</xsl:call-template>
</xsl:for-each>
</xsl:if>
<xsl:text>") </xsl:text>
<xsl:value-of
select="substring-before(./title[./anchor/@role='function'],' ')"/>
<xsl:text>; </xsl:text>
</xsl:for-each>
</xsl:template>
<!-- recursive cleaner, matches string to first quote then recurses to
process the rest
Note how it uses a When to test if the termination condition of no
quotes has been reached
-->
<xsl:template name="CleanQuotes"><xsl:param name="body"/>
<xsl:choose>
<xsl:when test="contains($body, '"')">
<xsl:value-of select="substring-before($body, '"')" />
<xsl:text>\"</xsl:text>
<xsl:call-template name="CleanQuotes">
<xsl:with-param name="body" select="substring-after($body,'"')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$body"/><!-- finished recursing -->
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2