I use something similar to this on my blog to parse rST.
from docutils.parsers.rst import Directive, directives class ScriptBlock(Directive): """ Usage: .. script:: <link_to_image> """ required_arguments = 1 optional_arguments = 2 has_content = False CODE = '\ <code class="javascript">{0}</code>\ ' def run(self): """ Required by the Directive interface. Create docutils nodes """ # get the file path file_path = self.arguments[0] script_contents = open(file_path).read() return [nodes.raw('', self.CODE.format( script_contents, ), format='html')] directives.register_directive('image-link', ImageLinkBlock) -- Dhruv Baldawa (http://www.dhruvb.com) On Thu, Jun 13, 2013 at 8:57 AM, Gopalakrishnan Subramani < gopalakrishnan.subram...@gmail.com> wrote: > Just found that, Javascript has got toString() to display the function > source code, that does portion of what is expected, I think, it is similar > to Python inspect. I will update my findings here. > > > > On Wed, Jun 12, 2013 at 10:12 PM, Harish Vishwanath < > harish.shas...@gmail.com> wrote: > > > I remember reading this blog about how pydanny wrote the book - two > scoops > > of django. > > http://pydanny.com/tools-we-used-to-write-2scoops.html. May be you will > > find some tools that they used to be helpful. > > > > Regards, > > Harish > > > > > > On Thu, Jun 13, 2013 at 8:24 AM, Noufal Ibrahim <nou...@nibrahim.net.in > > >wrote: > > > > > Anand Chitipothu <anandol...@gmail.com> writes: > > > > > > > > > [...] > > > > > > > I think the best way to do it is by separating extracting code from > > > > including code. You can write a script to preprocess the source files > > and > > > > extracts each function and writes into a different files. Once you > have > > > > solved that problem, then all you have to do just include one file in > > > your > > > > markdown. > > > > > > Dexy[1] allows you to do this. It's a little hairy to setup but quite > > > flexible once you do so. > > > > > > [...] > > > > > > > > > Footnotes: > > > [1] http://dexy.it/ > > > > > > -- > > > Cordially, > > > Noufal > > > http://nibrahim.net.in > > > _______________________________________________ > > > BangPypers mailing list > > > BangPypers@python.org > > > http://mail.python.org/mailman/listinfo/bangpypers > > > > > _______________________________________________ > > BangPypers mailing list > > BangPypers@python.org > > http://mail.python.org/mailman/listinfo/bangpypers > > > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers > _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers