PKd‚68“×2EGG-INFO/zip-safe PK]‚68Œ³jÕÕEGG-INFO/SOURCES.txtREADME setup.py TracNav.egg-info/PKG-INFO TracNav.egg-info/SOURCES.txt TracNav.egg-info/dependency_links.txt TracNav.egg-info/entry_points.txt TracNav.egg-info/top_level.txt tracnav/__init__.py tracnav/tracnav.py PK\‚68ÈDê**EGG-INFO/entry_points.txt[trac.plugins] TracNav = tracnav.tracnav PK\‚68“×2EGG-INFO/dependency_links.txt PK\‚68V1zßEGG-INFO/PKG-INFOMetadata-Version: 1.0 Name: TracNav Version: 3.92 Summary: The Navigation Bar for Trac Home-page: http://svn.ipd.uka.de/trac/javaparty/wiki/TracNav Author: Thomas Moschny Author-email: moschny@ipd.uni-karlsruhe.de License: GPL Description: UNKNOWN Keywords: trac toc Platform: UNKNOWN PK\‚68*F© EGG-INFO/top_level.txttracnav PKFP,6œ… tracnav/__init__.py__version__ = '3.92' PKc‚68ÅߘØ'9'9tracnav/tracnav.pyo;ò “5¦Ec@sëdZdZdZdkZdklZlZdklZl Z dk l Z l Z dk lZdklZlZd klZd Zeid eiƒZd gZd efd„ƒYZdefd„ƒYZdefd„ƒYZdS(s = !TracNav: The Navigation Bar for Trac = This macro implements a fully customizable navigation bar for the Trac wiki engine. The contents of the navigation bar is a wiki page itself and can be edited like any other wiki page through the web interface. The navigation bar supports hierarchical ordering of topics. The design of !TracNav mimics the design of the !TracGuideToc that was originally supplied with Trac. The drawback of !TracGuideToc is that it is not customizable without editing its source code and that it does not support hierarchical ordering. == Installation == See http://projects.edgewall.com/trac/wiki/TracPlugins. == Usage == To use !TracNav, create an index page for your site and call the TracNav macro on each page, where the navigation bar should be displayed. The index page is a regular wiki page. The page with the table of contents must include an unordered list of links that should be displayed in the navigation bar. To display the navigation bar on a page, you must call the !TracNav macro on that page an pass the name of your table of contents as argument. == Additional information and a life example == Please visit: http://svn.ipd.uka.de/trac/javaparty/wiki/TracNav. == Author and License == Copyright 2005, 2006 * Bernhard Haumacher (haui at haumacher.de) * Thomas Moschny (moschny at ipd.uni-karlsruhe.de) {{{ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA }}} s3$Id: tracnav.py 3142 2007-01-11 13:03:15Z moschny $s$LastChangedRevision: 3142 $N(s Components implements(s WikiSystemsIWikiMacroProvider(sITemplateProvidersadd_stylesheet(sWikiPage(s FormattersOneLinerFormatter(sStringIOs1http://svn.ipd.uka.de/trac/javaparty/wiki/TracNavs&^(?P[ \t\v]+)\* +(?P.*)$simages TocFormattercBs5tZdZd„Zed„Zd„Zd„ZRS(s] Basically the OneLinerFormatter, but additionally remembers the last wiki link. cCs<t|_tƒ}ti|||ƒ|iƒ|ifSdS(N( sNonesselfslinksStringIOsoutsOneLinerFormattersformatswikitextsgetvalue(sselfswikitextsout((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys format_tocOs  cCs&ti||ƒ||_t|_dS(N(sOneLinerFormatters__init__sselfsenvsreqsNoneslink(sselfsenvsreq((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys__init__Us cCs7|djo ||_nti|||||ƒSdS(Nswiki(s namespacestargetsselfslinksOneLinerFormatters _make_linksmatchslabel(sselfs namespacestargetsmatchslabel((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys _make_link[s  cCsV|idƒiƒ}|djodSn)|tjoti|||ƒSndSdS(Ns macronamesbrs s( s fullmatchsgroupslowersnamesALLOWED_MACROSs Formatters_macro_formattersselfsmatch(sselfsmatchs fullmatchsname((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys_macro_formatteras   (s__name__s __module__s__doc__s format_tocsNones__init__s _make_links_macro_formatter(((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys TocFormatterJs    s InvocationcBsƒtZd„Zd„Zd„Zd„Zdd„Zd„Zd„Zd „Z d „Z d „Z dd „Z d „Z d„ZRS(NcCsÎ||_||_||_d|_|iiddƒ|_|iiddƒ|_|i i dƒ|_ g|_ t |_|oHxE|idƒD]0}|djo t|_q’|i i|ƒq’WndS( Nispreviewsspages WikiStarts WIKI_MODIFYs|s nocollapse(senvsselfsreqsoutscolsargssgetspreviewscurpagespermshas_permissionsmodifysnamessTruescollapsessplitsargsFalsesappend(sselfsenvsreqsargssoutsarg((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys__init__qs        cCsl|io ||ijo|iiiddƒSn5t|iƒi |ƒot |i|ƒi SndSdS(sG Fetch the wiki page containing the toc, if available. stextsN( sselfspreviewsnamescurpagesreqsargssgets WikiSystemsenvshas_pagesWikiPagestext(sselfsname((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pysget_tocˆs ccsst|i|iƒ}xWti|ƒD]F}t |i dƒƒ}|i |i dƒƒ\}}|||fVq%WdS(s; Parse and format the entries in toc_text. sindentsrestN(s TocFormattersselfsenvsreqs formattersLISTRULEsfinditerstoc_textsmatchslensgroupsindents format_tocslabelslink(sselfstoc_textslabelslinksindents formattersmatch((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys get_toc_entry“sccsXxQtoIy|iƒ\}}}Wntj odVdSnX|V||fVqWdS(sÚ Filter for get_toc_entry(). The first call to next() returns the indentation level of the next entry (or -1 if there are no more entries) and the second call returns the entry itself. iÿÿÿÿN(sTruesgensnextsindentslinkslabels StopIteration(sselfsgensindentslabelslink((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pysget_toc_entry_and_indents icCsg}||joT|i|||dƒ\}}||jo||fSqg|itt|fƒnx§t oŸ||jo„|i ƒ|i ƒf\\}}}||jo9|i|||dƒ\}}|i|||fƒq |i||tfƒqj||fSqjWdS(s< Construct the toc tree at the given level. iN( stoclists next_indentslevelsselfs _parse_tocsgenssublistsappendsNonesTruesnextslinkslabel(sselfsgens next_indentslevelstoclistssublistslabelslink((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys _parse_toc¬s"   $ cCs>|i|i|ƒƒ}|i||iƒƒ\}}|SdS(sH Recursively construct the toc tree using _parse_toc(). N( sselfsget_toc_entry_and_indents get_toc_entrystoc_textsgens _parse_tocsnextstocs_(sselfstoc_textstocsgens_((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys parse_tocÃscCs/|iid|iƒ|ii|ƒ|SdS(Ns (sselfsoutswritescolswhat(sselfswhat((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pyswriteËscCs|id7_|SdS(Ni(sselfscol(sself((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys indent_moreÐscCs|id8_|SdS(Ni(sselfscol(sself((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys indent_lessÔscCsì|idƒiƒ|idtƒxž|ipdgD]‰}|i|i|ƒƒ}| o|id|ƒ}n|i |ƒ\}}|i p| o|i ||ƒq8|i ||ƒq8W|iƒidƒt|idƒdS(s1 Main routine of the wiki macro. s
s'

TracNav menu

sTOCs * TOC "%s" is empty!s
stracnav/css/tracnav.cssN(sselfswrites indent_mores TRACNAVHOMEsnamessnames parse_tocsget_tocstocs filter_tocsfoundsfilteredscollapses display_alls indent_lesssadd_stylesheetsreq(sselfsfilteredsnamestocsfound((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pysrunØsc Cs)t}g}x |D]\}}} | tjo4||i jo t }n|i ||tfƒq|i | |dƒ\}}|o t }n|p |tjo]|djo |tjo)|||fg} | i|ƒ| }q|i |||fƒq|i ||gfƒqW||fSdS(Nii(sFalsesfoundsresultstocsnamestitlessubsNonesselfscurpagesTruesappends filter_tocslevelssubfoundssubtocs prependedsextend( sselfstocslevelsnamestitlessubtocssubfoundsresultsfounds prependedssub((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys filter_tocñs&     cCss|i o|io$|id|iii|ƒƒn|idƒiƒ|i |dƒ|i ƒidƒdS(Ns: s ( sselfspreviewsmodifyswritesenvshrefswikisnames indent_moresdisplaystocs indent_less(sselfsnamestoc((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys display_alls $cCsxÿ|D]÷\}}}d|d}|tjo>||ijo d}nd}|i d|||fƒq|i d|ƒi ƒ|tjp|o|i d|ƒn|i d|ƒ|i ƒi d ƒt |ƒd jo|i||dƒqqWdS( Ns style="padding-left: %dem;"is class="active"ss%s s s

%s

s

%s...

s i(stocsnamestitlessubsdepthsli_stylesNonesselfscurpagesclsswrites indent_mores indent_lessslensdisplay(sselfstocsdepthssubstitlesli_stylesclssname((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pysdisplays  (s__name__s __module__s__init__sget_tocs get_toc_entrysget_toc_entry_and_indents _parse_tocs parse_tocswrites indent_mores indent_lesssruns filter_tocs display_allsdisplay(((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys Invocationos          sTracNavcBsBtZeeeƒd„Zd„Zd„Zd„Zd„Z RS(Nccs dVdVdS(NsTracNavsJPNav((sself((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys get_macros(scCs3tƒ}t|i|||ƒiƒ|iƒSdS(N( sStringIOsouts Invocationsselfsenvsreqsargssrunsgetvalue(sselfsreqsnamesargssout((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys render_macro,s cCs'dkl}l}|||ƒƒSdS(N(sgetdocs getmodule(sinspectsgetdocs getmodulesself(sselfsnamesgetdocs getmodule((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pysget_macro_description1scCs'dkl}d|tdƒfgSdS(N(sresource_filenamestracnavshtdocs(s pkg_resourcessresource_filenames__name__(sselfsresource_filename((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pysget_htdocs_dirs5s cCsgSdS(N((sself((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pysget_templates_dirs9s( s__name__s __module__s implementssIWikiMacroProvidersITemplateProviders get_macross render_macrosget_macro_descriptionsget_htdocs_dirssget_templates_dirs(((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pysTracNav$s      (s__doc__s__id__s __revision__sres trac.cores Components implementss trac.wiki.apis WikiSystemsIWikiMacroProviderstrac.web.chromesITemplateProvidersadd_stylesheetstrac.wiki.modelsWikiPagestrac.wiki.formatters FormattersOneLinerFormattersStringIOs TRACNAVHOMEscompilesMsLISTRULEsALLOWED_MACROSs TocFormattersobjects InvocationsTracNav(s implementss __revision__s TocFormattersWikiPagesIWikiMacroProvidersITemplateProvidersadd_stylesheetsStringIOs ComponentsOneLinerFormattersresLISTRULEs__id__sALLOWED_MACROSs InvocationsTracNavs Formatters WikiSystems TRACNAVHOME((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys?8s    %µPKa‚68ª¦¹'N9N9tracnav/tracnav.pyc;ò “5¦Ec@sëdZdZdZdkZdklZlZdklZl Z dk l Z l Z dk lZdklZlZd klZd Zeid eiƒZd gZd efd„ƒYZdefd„ƒYZdefd„ƒYZdS(s = !TracNav: The Navigation Bar for Trac = This macro implements a fully customizable navigation bar for the Trac wiki engine. The contents of the navigation bar is a wiki page itself and can be edited like any other wiki page through the web interface. The navigation bar supports hierarchical ordering of topics. The design of !TracNav mimics the design of the !TracGuideToc that was originally supplied with Trac. The drawback of !TracGuideToc is that it is not customizable without editing its source code and that it does not support hierarchical ordering. == Installation == See http://projects.edgewall.com/trac/wiki/TracPlugins. == Usage == To use !TracNav, create an index page for your site and call the TracNav macro on each page, where the navigation bar should be displayed. The index page is a regular wiki page. The page with the table of contents must include an unordered list of links that should be displayed in the navigation bar. To display the navigation bar on a page, you must call the !TracNav macro on that page an pass the name of your table of contents as argument. == Additional information and a life example == Please visit: http://svn.ipd.uka.de/trac/javaparty/wiki/TracNav. == Author and License == Copyright 2005, 2006 * Bernhard Haumacher (haui at haumacher.de) * Thomas Moschny (moschny at ipd.uni-karlsruhe.de) {{{ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA }}} s3$Id: tracnav.py 3142 2007-01-11 13:03:15Z moschny $s$LastChangedRevision: 3142 $N(s Components implements(s WikiSystemsIWikiMacroProvider(sITemplateProvidersadd_stylesheet(sWikiPage(s FormattersOneLinerFormatter(sStringIOs1http://svn.ipd.uka.de/trac/javaparty/wiki/TracNavs&^(?P[ \t\v]+)\* +(?P.*)$simages TocFormattercBs5tZdZd„Zed„Zd„Zd„ZRS(s] Basically the OneLinerFormatter, but additionally remembers the last wiki link. cCs<t|_tƒ}ti|||ƒ|iƒ|ifSdS(N( sNonesselfslinksStringIOsoutsOneLinerFormattersformatswikitextsgetvalue(sselfswikitextsout((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys format_tocOs  cCs&ti||ƒ||_t|_dS(N(sOneLinerFormatters__init__sselfsenvsreqsNoneslink(sselfsenvsreq((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys__init__Us cCs7|djo ||_nti|||||ƒSdS(Nswiki(s namespacestargetsselfslinksOneLinerFormatters _make_linksmatchslabel(sselfs namespacestargetsmatchslabel((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys _make_link[s  cCsV|idƒiƒ}|djodSn)|tjoti|||ƒSndSdS(Ns macronamesbrs s( s fullmatchsgroupslowersnamesALLOWED_MACROSs Formatters_macro_formattersselfsmatch(sselfsmatchs fullmatchsname((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys_macro_formatteras   (s__name__s __module__s__doc__s format_tocsNones__init__s _make_links_macro_formatter(((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys TocFormatterJs    s InvocationcBsƒtZd„Zd„Zd„Zd„Zdd„Zd„Zd„Zd „Z d „Z d „Z dd „Z d „Z d„ZRS(NcCsÎ||_||_||_d|_|iiddƒ|_|iiddƒ|_|i i dƒ|_ g|_ t |_|oHxE|idƒD]0}|djo t|_q’|i i|ƒq’WndS( Nispreviewsspages WikiStarts WIKI_MODIFYs|s nocollapse(senvsselfsreqsoutscolsargssgetspreviewscurpagespermshas_permissionsmodifysnamessTruescollapsessplitsargsFalsesappend(sselfsenvsreqsargssoutsarg((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys__init__qs        cCsl|io ||ijo|iiiddƒSn5t|iƒi |ƒot |i|ƒi SndSdS(sG Fetch the wiki page containing the toc, if available. stextsN( sselfspreviewsnamescurpagesreqsargssgets WikiSystemsenvshas_pagesWikiPagestext(sselfsname((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pysget_tocˆs ccsst|i|iƒ}xWti|ƒD]F}t |i dƒƒ}|i |i dƒƒ\}}|||fVq%WdS(s; Parse and format the entries in toc_text. sindentsrestN(s TocFormattersselfsenvsreqs formattersLISTRULEsfinditerstoc_textsmatchslensgroupsindents format_tocslabelslink(sselfstoc_textslabelslinksindents formattersmatch((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys get_toc_entry“sccsXxQtoIy|iƒ\}}}Wntj odVdSnX|V||fVqWdS(sÚ Filter for get_toc_entry(). The first call to next() returns the indentation level of the next entry (or -1 if there are no more entries) and the second call returns the entry itself. iÿÿÿÿN(sTruesgensnextsindentslinkslabels StopIteration(sselfsgensindentslabelslink((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pysget_toc_entry_and_indents icCs)g}||joT|i|||dƒ\}}||jo||fSqg|itt|fƒnx»t o³||jo„|i ƒ|i ƒf\\}}}||jo9|i|||dƒ\}}|i|||fƒq |i||tfƒqj||jpt ‚||fSqjWdS(s< Construct the toc tree at the given level. iN(stoclists next_indentslevelsselfs _parse_tocsgenssublistsappendsNonesTruesnextslinkslabelsAssertionError(sselfsgens next_indentslevelstoclistssublistslabelslink((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys _parse_toc¬s"   $ cCs>|i|i|ƒƒ}|i||iƒƒ\}}|SdS(sH Recursively construct the toc tree using _parse_toc(). N( sselfsget_toc_entry_and_indents get_toc_entrystoc_textsgens _parse_tocsnextstocs_(sselfstoc_textstocsgens_((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys parse_tocÃscCs/|iid|iƒ|ii|ƒ|SdS(Ns (sselfsoutswritescolswhat(sselfswhat((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pyswriteËscCs|id7_|SdS(Ni(sselfscol(sself((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys indent_moreÐscCs|id8_|SdS(Ni(sselfscol(sself((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys indent_lessÔscCsì|idƒiƒ|idtƒxž|ipdgD]‰}|i|i|ƒƒ}| o|id|ƒ}n|i |ƒ\}}|i p| o|i ||ƒq8|i ||ƒq8W|iƒidƒt|idƒdS(s1 Main routine of the wiki macro. s
s'

TracNav menu

sTOCs * TOC "%s" is empty!s
stracnav/css/tracnav.cssN(sselfswrites indent_mores TRACNAVHOMEsnamessnames parse_tocsget_tocstocs filter_tocsfoundsfilteredscollapses display_alls indent_lesssadd_stylesheetsreq(sselfsfilteredsnamestocsfound((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pysrunØsc Cs)t}g}x |D]\}}} | tjo4||i jo t }n|i ||tfƒq|i | |dƒ\}}|o t }n|p |tjo]|djo |tjo)|||fg} | i|ƒ| }q|i |||fƒq|i ||gfƒqW||fSdS(Nii(sFalsesfoundsresultstocsnamestitlessubsNonesselfscurpagesTruesappends filter_tocslevelssubfoundssubtocs prependedsextend( sselfstocslevelsnamestitlessubtocssubfoundsresultsfounds prependedssub((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys filter_tocñs&     cCss|i o|io$|id|iii|ƒƒn|idƒiƒ|i |dƒ|i ƒidƒdS(Ns: s
    is
( sselfspreviewsmodifyswritesenvshrefswikisnames indent_moresdisplaystocs indent_less(sselfsnamestoc((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys display_alls $cCsxÿ|D]÷\}}}d|d}|tjo>||ijo d}nd}|i d|||fƒq|i d|ƒi ƒ|tjp|o|i d|ƒn|i d|ƒ|i ƒi d ƒt |ƒd jo|i||dƒqqWdS( Ns style="padding-left: %dem;"is class="active"ss%s s s

%s

s

%s...

s i(stocsnamestitlessubsdepthsli_stylesNonesselfscurpagesclsswrites indent_mores indent_lessslensdisplay(sselfstocsdepthssubstitlesli_stylesclssname((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pysdisplays  (s__name__s __module__s__init__sget_tocs get_toc_entrysget_toc_entry_and_indents _parse_tocs parse_tocswrites indent_mores indent_lesssruns filter_tocs display_allsdisplay(((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys Invocationos          sTracNavcBsBtZeeeƒd„Zd„Zd„Zd„Zd„Z RS(Nccs dVdVdS(NsTracNavsJPNav((sself((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys get_macros(scCs3tƒ}t|i|||ƒiƒ|iƒSdS(N( sStringIOsouts Invocationsselfsenvsreqsargssrunsgetvalue(sselfsreqsnamesargssout((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys render_macro,s cCs'dkl}l}|||ƒƒSdS(N(sgetdocs getmodule(sinspectsgetdocs getmodulesself(sselfsnamesgetdocs getmodule((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pysget_macro_description1scCs'dkl}d|tdƒfgSdS(N(sresource_filenamestracnavshtdocs(s pkg_resourcessresource_filenames__name__(sselfsresource_filename((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pysget_htdocs_dirs5s cCsgSdS(N((sself((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pysget_templates_dirs9s( s__name__s __module__s implementssIWikiMacroProvidersITemplateProviders get_macross render_macrosget_macro_descriptionsget_htdocs_dirssget_templates_dirs(((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pysTracNav$s      (s__doc__s__id__s __revision__sres trac.cores Components implementss trac.wiki.apis WikiSystemsIWikiMacroProviderstrac.web.chromesITemplateProvidersadd_stylesheetstrac.wiki.modelsWikiPagestrac.wiki.formatters FormattersOneLinerFormattersStringIOs TRACNAVHOMEscompilesMsLISTRULEsALLOWED_MACROSs TocFormattersobjects InvocationsTracNav(s implementss __revision__s TocFormattersWikiPagesIWikiMacroProvidersITemplateProvidersadd_stylesheetsStringIOs ComponentsOneLinerFormattersresLISTRULEs__id__sALLOWED_MACROSs InvocationsTracNavs Formatters WikiSystems TRACNAVHOME((s3build/bdist.darwin-8.0.1-x86/egg/tracnav/tracnav.pys?8s    %µPKb‚68ß^W³³tracnav/__init__.pyo;ò õ¢§Ec@s dZdS(s3.92N(s __version__(s __version__((s4build/bdist.darwin-8.0.1-x86/egg/tracnav/__init__.pys?sPKg@+61¥0û**tracnav/tracnav.py# -*- coding: utf-8 -*- """ = !TracNav: The Navigation Bar for Trac = This macro implements a fully customizable navigation bar for the Trac wiki engine. The contents of the navigation bar is a wiki page itself and can be edited like any other wiki page through the web interface. The navigation bar supports hierarchical ordering of topics. The design of !TracNav mimics the design of the !TracGuideToc that was originally supplied with Trac. The drawback of !TracGuideToc is that it is not customizable without editing its source code and that it does not support hierarchical ordering. == Installation == See http://projects.edgewall.com/trac/wiki/TracPlugins. == Usage == To use !TracNav, create an index page for your site and call the TracNav macro on each page, where the navigation bar should be displayed. The index page is a regular wiki page. The page with the table of contents must include an unordered list of links that should be displayed in the navigation bar. To display the navigation bar on a page, you must call the !TracNav macro on that page an pass the name of your table of contents as argument. == Additional information and a life example == Please visit: http://svn.ipd.uka.de/trac/javaparty/wiki/TracNav. == Author and License == Copyright 2005, 2006 * Bernhard Haumacher (haui at haumacher.de) * Thomas Moschny (moschny at ipd.uni-karlsruhe.de) {{{ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA }}} """ __id__ = '$Id: tracnav.py 3142 2007-01-11 13:03:15Z moschny $' __revision__ = '$LastChangedRevision: 3142 $' import re from trac.core import Component, implements from trac.wiki.api import WikiSystem, IWikiMacroProvider from trac.web.chrome import ITemplateProvider, add_stylesheet from trac.wiki.model import WikiPage from trac.wiki.formatter import Formatter, OneLinerFormatter from StringIO import StringIO TRACNAVHOME = "http://svn.ipd.uka.de/trac/javaparty/wiki/TracNav" LISTRULE = re.compile(r"^(?P[ \t\v]+)\* +(?P.*)$", re.M) ALLOWED_MACROS = ["image"] class TocFormatter(OneLinerFormatter): """ Basically the OneLinerFormatter, but additionally remembers the last wiki link. """ def format_toc(self, wikitext): self.link = None out = StringIO() OneLinerFormatter.format(self, wikitext, out) return out.getvalue(), self.link def __init__(self, env, req = None): OneLinerFormatter.__init__(self, env) # OneLinerFormatter sets req to None self.req = req self.link = None def _make_link(self, namespace, target, match, label): if namespace == 'wiki': self.link = target return OneLinerFormatter._make_link( self, namespace, target, match, label) def _macro_formatter(self, match, fullmatch): name = fullmatch.group('macroname').lower() if name == 'br': return ' ' elif name in ALLOWED_MACROS: # leapfrog the OneLinerFormatter return Formatter._macro_formatter(self, match, fullmatch) else: return '' # FIXME: what about _make_relative_link() ? # FIXME: CamelCase links are special and not handled by the Formatter... class Invocation(object): def __init__(self, env, req, args, out): #save for later use self.env = env self.req = req self.out = out self.col = 0 #needed several times self.preview = req.args.get('preview', '') self.curpage = req.args.get('page', 'WikiStart') self.modify = req.perm.has_permission('WIKI_MODIFY') # parse arguments self.names = [] self.collapse = True if args: for arg in args.split('|'): if arg == 'nocollapse': self.collapse = False else: self.names.append(arg) def get_toc(self, name): """ Fetch the wiki page containing the toc, if available. """ if self.preview and name == self.curpage: return self.req.args.get('text', '') elif WikiSystem(self.env).has_page(name): return WikiPage(self.env, name).text else: return '' def get_toc_entry(self, toc_text): """ Parse and format the entries in toc_text. """ formatter = TocFormatter(self.env, self.req) for match in LISTRULE.finditer(toc_text): indent = len(match.group('indent')) label, link = formatter.format_toc(match.group('rest')) yield indent, link, label def get_toc_entry_and_indent(self, gen): """ Filter for get_toc_entry(). The first call to next() returns the indentation level of the next entry (or -1 if there are no more entries) and the second call returns the entry itself. """ while True: try: indent, link, label = gen.next() except StopIteration: yield -1 return yield indent yield link, label def _parse_toc(self, gen, next_indent, level = 0): """ Construct the toc tree at the given level. """ toclist = [] if next_indent > level: sublist, next_indent = self._parse_toc(gen, next_indent, level + 1) if next_indent < level: # level is empty return sublist, next_indent else: # broken indentation structure toclist.append((None, None, sublist)) while True: if next_indent == level: (link, label), next_indent = gen.next(), gen.next() if next_indent > level: sublist, next_indent = self._parse_toc(gen, next_indent, level + 1) toclist.append((link, label, sublist)) else: toclist.append((link, label, None)) else: assert next_indent < level return toclist, next_indent def parse_toc(self, toc_text): """ Recursively construct the toc tree using _parse_toc(). """ gen = self.get_toc_entry_and_indent(self.get_toc_entry(toc_text)) toc, _ = self._parse_toc(gen, gen.next()) return toc def write(self, what): self.out.write(' ' * self.col) self.out.write(what) return self def indent_more(self): self.col += 1 return self def indent_less(self): self.col -= 1 return self def run(self): """ Main routine of the wiki macro. """ # header self.write('
\n').indent_more() self.write('

TracNav menu

\n' % TRACNAVHOME) # add TOCs for name in (self.names or ["TOC"]): toc = self.parse_toc(self.get_toc(name)) if not toc: toc = self.parse_toc(' * TOC "%s" is empty!' % name) found, filtered = self.filter_toc(toc) if (not self.collapse) or (not found): self.display_all(name, toc) else: self.display_all(name, filtered) # footer self.indent_less().write('
\n') # add our stylesheet add_stylesheet(self.req, 'tracnav/css/tracnav.css') def filter_toc(self, toc, level = 0): found = False result = [] for name, title, sub in toc: if sub == None: if name == self.curpage: found = True result.append((name, title, None)) else: subfound, subtoc = self.filter_toc(sub, level + 1) if subfound: found = True if subfound or (name == None): if level == 0 and name != None: prepended = [(name, title, subtoc)] prepended.extend(result) result = prepended else: result.append((name, title, subtoc)) else: result.append((name, title, [])) return found, result def display_all(self, name, toc): if (not self.preview) and (self.modify): self.write('\n' % \ self.env.href.wiki(name)) self.write('
    \n').indent_more() self.display(toc, 0) self.indent_less().write('
\n') def display(self, toc, depth): for name, title, sub in toc: li_style = ' style="padding-left: %dem;"' % (depth + 1) if sub == None: if name == self.curpage: cls = ' class="active"' else: cls = '' self.write('%s\n' % (li_style, cls, title)) else: self.write('\n' % li_style).indent_more() if name == None or sub: self.write('

%s

\n' % title) else: self.write('

%s...

\n' % title) self.indent_less().write('\n') if len(sub) > 0: self.display(sub, depth + 1) class TracNav(Component): implements(IWikiMacroProvider, ITemplateProvider) def get_macros(self): yield 'TracNav' yield 'JPNav' # legacy def render_macro(self, req, name, args): out = StringIO() Invocation(self.env, req, args, out).run() return out.getvalue() def get_macro_description(self, name): from inspect import getdoc, getmodule return getdoc(getmodule(self)) def get_htdocs_dirs(self): from pkg_resources import resource_filename return [('tracnav', resource_filename(__name__, 'htdocs'))] def get_templates_dirs(self): # we don't provide templates return [] PKa‚68ß^W³³tracnav/__init__.pyc;ò õ¢§Ec@s dZdS(s3.92N(s __version__(s __version__((s4build/bdist.darwin-8.0.1-x86/egg/tracnav/__init__.pys?sPK­Bª4ù¿©Î½½tracnav/htdocs/css/tracnav.css/* Styles for TracNav, the Navigation Bar for Trac Copyright 2005, 2006 * Bernhard Haumacher (haui at haumacher.de) * Thomas Moschny (moschny at ipd.uni-karlsruhe.de) $Id: tracnav.css 3095 2006-05-10 12:21:26Z moschny $ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Please visit http://svn.ipd.uka.de/trac/javaparty/wiki/TracNav. */ .wiki-toc.trac-nav h2 { margin-left: 2px; margin-right: 4ex; margin-top: 0; margin-bottom: 5px; padding-top: 0; } @media screen { .wiki-toc.trac-nav h2 { display: none; } } @media print { .wiki-toc.trac-nav { display: none; } } .wiki-toc.trac-nav h4 { margin: 0; padding: 0; } .wiki-toc.trac-nav ul > li:first-child { margin-right: 4ex; } .wiki-toc.trac-nav .edit { float: right; position: absolute; right: 10px; } /* next rule not seen by IE <= IE6 */ .wiki-toc.trac-nav [class~=edit] { float: none; position: static; text-align: right; height: 0; /* simulate float:right; */ top: -3px; /* shift slightly up */ right: 0; } .wiki-toc.trac-nav .edit a { color: blue; border-color: blue; } PKd‚68“×2¤EGG-INFO/zip-safePK]‚68Œ³jÕÕ¤0EGG-INFO/SOURCES.txtPK\‚68ÈDê**¤7EGG-INFO/entry_points.txtPK\‚68“×2¤˜EGG-INFO/dependency_links.txtPK\‚68V1zߤÔEGG-INFO/PKG-INFOPK\‚68*F© ¤ EGG-INFO/top_level.txtPKFP,6œ… ¤\tracnav/__init__.pyPKc‚68ÅߘØ'9'9¤¢tracnav/tracnav.pyoPKa‚68ª¦¹'N9N9¤ú<tracnav/tracnav.pycPKb‚68ß^W³³¤yvtracnav/__init__.pyoPKg@+61¥0û**¤^wtracnav/tracnav.pyPKa‚68ß^W³³¤¡tracnav/__init__.pycPK­Bª4ù¿©Î½½¤t¢tracnav/htdocs/css/tracnav.cssPK im©