Revision: 6230 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6230&view=rev Author: jdh2358 Date: 2008-10-16 20:52:08 +0000 (Thu, 16 Oct 2008)
Log Message: ----------- finished the first cut at the examples for search support Modified Paths: -------------- trunk/matplotlib/doc/_templates/indexsidebar.html trunk/matplotlib/doc/_templates/layout.html trunk/matplotlib/doc/examples/gen_rst.py trunk/matplotlib/doc/make.py Modified: trunk/matplotlib/doc/_templates/indexsidebar.html =================================================================== --- trunk/matplotlib/doc/_templates/indexsidebar.html 2008-10-16 19:50:05 UTC (rev 6229) +++ trunk/matplotlib/doc/_templates/indexsidebar.html 2008-10-16 20:52:08 UTC (rev 6230) @@ -12,10 +12,16 @@ </p> <h3>Need help?</h3> -<p>Check the <a href="{{ pathto('users/index') }}">user</a> guide, the <a -href="{{ pathto('faq/index') }}">faq</a>, the <a href="{{ -pathto('api/index') }}"}>api</a> docs, <a href=http://www.nabble.com/matplotlib---users-f2906.html>archives</a>, and join the matplotlib mailing <a -href="http://sourceforge.net/mail/?group_id=80706">lists</a> +<p>Check the <a href="{{ pathto('users/index') }}">user</a> guide, +the <a href="{{ pathto('faq/index') }}">faq</a>, the <a href="{{ +pathto('api/index') }}"}>api</a> docs, +<a href=http://www.nabble.com/matplotlib---users-f2906.html>archives</a>, +and join the matplotlib +mailing <a href="http://sourceforge.net/mail/?group_id=80706">lists</a>. +The <a href="{{ pathto('search') }}">search</a>| </li> tool +searches all of the documentation, including full text search of +almost 300 complete examples which exercise almost every corner of +matplotlib. <p>You can file bugs, patches and feature requests on the sourceforge <a href="http://sourceforge.net/tracker2/?group_id=80706">tracker</a>, but it is a good idea to ping us on the mailing list too.</p> @@ -24,7 +30,7 @@ <a href="{{ pathto('users/screenshots') }}"><img align=center src="{{ pathto('_static/logo_sidebar.png', 1) }} "border="0"></a> -<a href="{{ pathto('users/screenshots') }}">screenshots</a> and <a href=examples>examples</a> +<a href="{{ pathto('users/screenshots') }}">screenshots</a> and <a href=examples/index.html>examples</a> <h3>Other stuff</h3> Modified: trunk/matplotlib/doc/_templates/layout.html =================================================================== --- trunk/matplotlib/doc/_templates/layout.html 2008-10-16 19:50:05 UTC (rev 6229) +++ trunk/matplotlib/doc/_templates/layout.html 2008-10-16 20:52:08 UTC (rev 6230) @@ -1,7 +1,8 @@ {% extends "!layout.html" %} {% block rootrellink %} - <li><a href="{{ pathto('index') }}">matplotlib home </a> | </li> + <li><a href="{{ pathto('index') }}">matplotlib home</a>| </li> + <li><a href="{{ pathto('search') }}">search</a>| </li> <li><a href="{{ pathto('contents') }}">documentation </a> »</li> {% endblock %} Modified: trunk/matplotlib/doc/examples/gen_rst.py =================================================================== --- trunk/matplotlib/doc/examples/gen_rst.py 2008-10-16 19:50:05 UTC (rev 6229) +++ trunk/matplotlib/doc/examples/gen_rst.py 2008-10-16 20:52:08 UTC (rev 6230) @@ -14,14 +14,13 @@ datad = {} for root, subFolders, files in os.walk(rootdir): for fname in files: - if ( fname.startswith('.') or fname.startswith('#') or + if ( fname.startswith('.') or fname.startswith('#') or fname.startswith('_') or fname.find('.svn')>=0 or not fname.endswith('.py') ): continue fullpath = os.path.join(root,fname) contents = file(fullpath).read() # indent - contents = '\n'.join([' %s'%row.rstrip() for row in contents.split('\n')]) relpath = os.path.split(root)[-1] datad.setdefault(relpath, []).append((fname, contents)) @@ -47,32 +46,77 @@ """) for subdir in subdirs: + if not os.path.exists(subdir): + os.makedirs(subdir) + + static_dir = os.path.join('..', '_static', 'examples') + if not os.path.exists(static_dir): + os.makedirs(static_dir) + + static_dir = os.path.join(static_dir, subdir) + if not os.path.exists(static_dir): + os.makedirs(static_dir) + + + subdirIndexFile = os.path.join(subdir, 'index.rst') + fhsubdirIndex = file(subdirIndexFile, 'w') + fhindex.write(' %s\n'%subdirIndexFile) + + + fhsubdirIndex.write("""\ +.. _%s-examples-index: + + +############################################## +%s Examples +############################################## + +.. htmlonly:: + + :Release: |version| + :Date: |today| + +.. toctree:: + :maxdepth: 1 + +"""%(subdir, subdir)) + print subdir - outfile = '%s.rst'%subdir - fh = file(outfile, 'w') - fhindex.write(' %s\n'%outfile) + + data = datad[subdir] + data.sort() + for fname, contents in data: - fh.write('.. _%s-examples:\n\n'%subdir) - title = '%s examples'%subdir + static_file = os.path.join(static_dir, fname) + fhstatic = file(static_file, 'w') + fhstatic.write(contents) + fhstatic.close() - fh.write('*'*len(title) + '\n') - fh.write(title + '\n') - fh.write('*'*len(title) + '\n\n') - - for fname, contents in datad[subdir]: - print ' ', fname basename, ext = os.path.splitext(fname) - fh.write('.. _%s-example:\n\n'%basename) - title = '%s example'%basename + rstfile = '%s.rst'%basename + outfile = os.path.join(subdir, rstfile) + fhsubdirIndex.write(' %s\n'%rstfile) + fh = file(outfile, 'w') + fh.write('.. _%s-%s:\n\n'%(subdir, basename)) + title = '%s example code: %s'%(subdir, fname) fh.write(title + '\n') fh.write('='*len(title) + '\n\n') - fh.write(fname + '::\n\n') + + + print ' %s'%fname + + linkname = os.path.join('..', '..', '_static', 'examples', subdir, fname) + fh.write('%s (`link to source <%s>`_)::\n\n'%(fname, linkname)) + + # indent the contents + contents = '\n'.join([' %s'%row.rstrip() for row in contents.split('\n')]) + fh.write(contents) fh.write('\n\n') - fh.close() + fh.close() + fhsubdirIndex.close() - fhindex.close() Modified: trunk/matplotlib/doc/make.py =================================================================== --- trunk/matplotlib/doc/make.py 2008-10-16 19:50:05 UTC (rev 6229) +++ trunk/matplotlib/doc/make.py 2008-10-16 20:52:08 UTC (rev 6230) @@ -17,7 +17,8 @@ def sf(): 'push a copy to the sf site' os.system('cd build/html; rsync -avz . jdh2358,[EMAIL PROTECTED]:/home/groups/m/ma/matplotlib/htdocs/ -essh') - os.system('cd ~/mpl/examples; svn-clean; cd ..; rsync -avz examples jdh2358,[EMAIL PROTECTED]:/home/groups/m/ma/matplotlib/htdocs/ -essh --cvs-exclude --delete') + # we are now doing this in the doc/examples build + #os.system('cd ~/mpl/examples; svn-clean; cd ..; rsync -avz examples jdh2358,[EMAIL PROTECTED]:/home/groups/m/ma/matplotlib/htdocs/ -essh --cvs-exclude --delete') def sfpdf(): 'push a copy to the sf site' @@ -28,6 +29,11 @@ def html(): check_build() + # build the literal include examples for searchable examples + os.system('cd examples; python gen_rst.py') + + + #figs() if os.system('sphinx-build -b html -d build/doctrees . build/html'): raise SystemExit("Building HTML failed.") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins