RE: [Rest2web-develop] Feature request: specify header level for rest docs
Brought to you by:
mjfoord
From: Andrew I. <and...@us...> - 2006-02-16 05:02:31
|
I do need it per file, since some files have my macro with the default <h1> and most don't. Keeping the restindex keyword list small is an admirable goal, but since an "initialheaderlevel" keyword can (and should) default to "1", and the user can specify it only when necessary, it doesn't end up polluting the web site's source files unnecessarily. Adding the keyword adds a little more flexibility for the end-user. I just added the code - 4 lines were changed. If you want, I can check that in, save you the work of adding this feature... Andrew > -----Original Message----- > From: res...@li... > [mailto:res...@li...]On Behalf Of > Fuzzyman > Sent: Wednesday, February 15, 2006 3:25 AM > To: res...@li... > Subject: Re: [Rest2web-develop] Feature request: specify header level > for rest docs > > > Andrew Ittner wrote: > > For some of the files in my site I have a macro that returns a > <h1> block. > > The files that are written in rest format automatically start > the headers at > > <h1> and work down. > > > > I want the ability to specify in the restindex at what level the header > > should start. A restindex keyword like "headerlevel=2" would tell the > > parser to start the rest portion of the headers at <h2>, > leaving me free to > > set an <h1> manually. > > > > > I *can* add this. It's yet another restindex option. *sigh* I'd like to > minimize the number of additional restindex keywords, but in this case > there doesn't seem to be a cleaner alternative. As it's likely to need > to be a global setting (not vary through a site), perhaps it could be > added to the config file instead ? I will shortly be adding the > possibility of global settings in the config file for plugins. Would > this work for you Andrew ? > > 3 short term fixes spring to mind, all slightly hackish : > > * ReST puts a class on all headlines it generates. You can just use CSS > to control their appearance. > * You could use a ``{title;Title Text;2}`` macro to do your headings. I > use this because putting proper titles into a ReST document triggers the > creation of ``sections`` which has unfortunate side effects where I want > to control the way paragraphs are in div containers. (ReST doesn't allow > any content between sections.) > * The function to modify to simply hardwire the change is ``html_parts`` > in ``rest2web/restutils.py``. Set the default > ``initial_header_level`` to 2. |