From: Sridhar R. <sri...@gm...> - 2005-02-21 14:53:49
|
I have just started to examine the ReST markup, parser. The publisher generates complete (x)html from the rst markup. I have some questions 1. How to generate HTML without html, head, body tags so that I can ReST for some part of the website (eg. blog posts) 2. How to avoid the class="foo" attributes in generated HTML? I just want the plain HTML without custom css attributes. Say literals should be generated using *just* <pre> but not <div class="literal"><pre>... 3. How to restrict the HTML output in various ways. For eg., if I want to use ReST for blog post comments, <h1> must be avoided PS: I face these problems as I think of using ReST in my blog -- Sridhar Ratna - http://srid.bsdnerds.org |
From: Morten L. J. <mor...@if...> - 2005-02-21 16:00:20
|
Sridhar Ratna wrote: > I have just started to examine the ReST markup, parser. The publisher > generates complete (x)html from the rst markup. I have some questions > > 1. How to generate HTML without html, head, body tags so that I can > ReST for some part of the website (eg. blog posts) Somewhere, possibly in the sandbox, I saw a rst2ht tool, that would generate ht files instead of html. Try it and see if that will do. > 2. How to avoid the class="foo" attributes in generated HTML? I just > want the plain HTML without custom css attributes. Say literals > should be generated using *just* <pre> but not <div > class="literal"><pre>... I think the only way to do this, is to modify the writer... Not sure though. > 3. How to restrict the HTML output in various ways. For eg., if I > want to use ReST for blog post comments, <h1> must be avoided See the help for rst2html.py. --initial-header-level and --no-doc-title seems to be useful. -- Morten |
From: David G. <go...@py...> - 2005-02-21 16:11:22
Attachments:
signature.asc
|
[Sridhar Ratna] > I have just started to examine the ReST markup, parser. The publisher > generates complete (x)html from the rst markup. I have some questions > > 1. How to generate HTML without html, head, body tags so that I can > ReST for some part of the website (eg. blog posts) Use the publish_parts convenience function: http://docutils.sf.net/docs/api/publisher.html > 2. How to avoid the class="foo" attributes in generated HTML? I just > want the plain HTML without custom css attributes. Say literals > should be generated using *just* <pre> but not <div > class="literal"><pre>... This cannot easily be done with the current HTML writer. I have some ideas on how to make a more flexible writer, but little time to implement it. > 3. How to restrict the HTML output in various ways. For eg., if I > want to use ReST for blog post comments, <h1> must be avoided I have nothing to add to Morten's answer for this one. > PS: I face these problems as I think of using ReST in my blog As with most open source projects, Docutils is the sum total of what its developers and users have put into it. If your particular need isn't being met, please consider writing some code or contributing in some other way. -- David Goodger <http://python.net/~goodger> |
From: Felix W. <Fel...@gm...> - 2005-02-21 16:54:14
|
David Goodger wrote: > Sridhar Ratna wrote: > >> 1. How to generate HTML without html, head, body tags so that I can >> ReST for some part of the website (eg. blog posts) > > Use the publish_parts convenience function: > http://docutils.sf.net/docs/api/publisher.html There's still no way of getting the HTML body from the parts (even though using the parts['body'] might be sufficient for use in a blog). >> 2. How to avoid the class="foo" attributes in generated HTML? I just >> want the plain HTML without custom css attributes. Say literals >> should be generated using *just* <pre> but not <div >> class="literal"><pre>... You could use a regex, like ``s/ class="[^"]*"//g``. But why not leave the class attributes in the source? They don't hurt, and together with the Docutils stylesheet, it often looks (visually) better with the styles. > I have some ideas on how to make a more flexible writer, but > little time to implement it. Reminds me that I want to refactor the LaTeX writer to make it more flexible. :) -- When replying to my email address, please ensure that the mail header contains 'Felix Wiemann'. http://www.ososo.de/ |
From: Michael F. <mi...@pc...> - 2005-02-22 08:15:56
|
Sridhar Ratna wrote: >I have just started to examine the ReST markup, parser. The publisher >generates complete (x)html from the rst markup. I have some questions > >1. How to generate HTML without html, head, body tags so that I can >ReST for some part of the website (eg. blog posts) > >2. How to avoid the class="foo" attributes in generated HTML? I just >want the plain HTML without custom css attributes. Say literals >should be generated using *just* <pre> but not <div >class="literal"><pre>... > >3. How to restrict the HTML output in various ways. For eg., if I >want to use ReST for blog post comments, <h1> must be avoided > > > By the way I've hacked firedrop (a blog client by Hans Nowak) to use reST. It uses publish_parts. The trouble is it uses the id references to do links from footnotes etc. When you have multiple entries on the same page, the id references clash. I get round this by generating random strings and change the links using a search and replace - which isn't ideal. reST is so good that it's worth the hassle to get it working though. :-) Regards, Fuzzy http://www.voidspace.org.uk/python/index.shtml >PS: I face these problems as I think of using ReST in my blog > > > |