From: Felix W. <Fel...@gm...> - 2005-06-28 17:11:52
|
go...@us... wrote: > Log: Added ``_stylesheet_required`` internal setting, [...] > > Modified: trunk/docutils/docs/user/config.txt > =================================================================== > +_`_stylesheet_required` > + Used to disable stylesheet checking in writers that use > + stylesheets. For programmatic use only. That's unnecessary. The other change (transforms.html.StylesheetCheck) is fine, but adding _stylesheet_required is not solving any problem. When the programmer wants to express "no stylesheet is needed", he can just write {'stylesheet': ''}. No need for _stylesheet_required. However, existing application which use Docutils programmatically still break this way. While users operating Docutils from the command-line can easily provide a stylesheet when the warning occurs, this may not be easily possible for applications which use Docutils programmatically. To retain compatibility, it is thus necessary to deactivate the warning in programmatic mode. What's wrong with adding a _programmatic setting (which is automatically activated in process_programmatic_settings) and querying this setting in the warning code ("if not _programmatic then warn")? I suggest that _stylesheet_required be removed and _programmatic be added. -- For private mail please ensure that the header contains 'Felix Wiemann'. "the number of contributors [...] is strongly and inversely correlated with the number of hoops each project makes a contributing user go through." -- ESR |
From: David G. <go...@py...> - 2005-06-29 20:32:11
Attachments:
signature.asc
|
> go...@us... wrote: >> Log: Added ``_stylesheet_required`` internal setting, [...] >> >> Modified: trunk/docutils/docs/user/config.txt >> =================================================================== >> +_`_stylesheet_required` >> + Used to disable stylesheet checking in writers that use >> + stylesheets. For programmatic use only. [Felix Wiemann] > That's unnecessary. The other change > (transforms.html.StylesheetCheck) is fine, but adding > _stylesheet_required is not solving any problem. I beg to differ. It concisely and directly solves the problem given. > When the programmer wants to express "no stylesheet is needed", he can > just write {'stylesheet': ''}. No, that's an ugly kludge of a work-around. Since the default for embed_stylesheet is now True, setting providing an empty string for stylesheet would just exacerbate the problem. Note that transforms.html.StylesheetCheck does not check if the stylesheet ``is None``, it checks the boolean value; so an empty string also counts as False. > However, existing application which use Docutils programmatically > still break this way. While users operating Docutils from the > command-line can easily provide a stylesheet when the warning > occurs, this may not be easily possible for applications which use > Docutils programmatically. Any application of Docutils that desires such behavior can simply specify {'_stylesheet_required': 0}. It's direct, to the point, > To retain compatibility, it is thus necessary to deactivate the > warning in programmatic mode. What's wrong with adding a > _programmatic setting (which is automatically activated in > process_programmatic_settings) and querying this setting in the > warning code ("if not _programmatic then warn")? What's wrong is that _programmatic would be too broad a setting. Programmatic use does not always imply that no stylesheet is required. And the requirement (or lack) of a stylesheet does not always imply a particular style of use; there may be command-line based front-ends that do not require (or do not use) a stylesheet. > I suggest that _stylesheet_required be removed and _programmatic be > added. -1, for the reasons above. -- David Goodger <http://python.net/~goodger> |
From: Felix W. <Fel...@gm...> - 2005-06-30 17:56:41
|
David Goodger wrote: > Felix Wiemann wrote: > >> adding _stylesheet_required is not solving any problem. > > I beg to differ. It concisely and directly solves the problem given. OK, then let's use it. I deactivated _stylesheet_required for programmatic use, so the compatibility problems should be solved now. This looks better than putting default.css next to html4css1.py because the user may want to upload the CSS file, and having to dig out a file from the source tree feels wrong. So I think the current solution is fine. >> When the programmer wants to express "no stylesheet is needed", he >> can just write {'stylesheet': ''}. > > No, that's an ugly kludge of a work-around. Since the default for > embed_stylesheet is now True, setting providing an empty string for > stylesheet would just exacerbate the problem. No; an empty stylesheet URI or path means "no stylesheet"; the HTML writer won't try to embed a stylesheet with the name "". (That's also documented in docs/user/config.txt: "Pass an empty string to deactivate stylesheet inclusion.") > Note that transforms.html.StylesheetCheck does not check if the > stylesheet ``is None``, it checks the boolean value; so an empty > string also counts as False. For programmatic use, you might argue that passing {'_stylesheet_required': 0} is the correct way. However, if I type "rst2html.py --stylesheet=" on the command line I explicitly say that I don't want a stylesheet, and I expect the writer to behave that way. Anything else would just be bad UI design. So I changed that. >> What's wrong with adding a _programmatic setting [...] and querying >> this setting in the warning code ("if not _programmatic then warn")? > > What's wrong is that _programmatic would be too broad a setting. > Programmatic use does not always imply that no stylesheet is required. Valid point. -- For private mail please ensure that the header contains 'Felix Wiemann'. "the number of contributors [...] is strongly and inversely correlated with the number of hoops each project makes a contributing user go through." -- ESR |