From: Marcello P. <mar...@pe...> - 2010-12-16 21:38:14
|
This is one extension we implemented at Project Gutenberg. Rationale: In some books emphasis is not rendered as italics, eg. in old German books emphasis is rendered as g e s p e r r t. We want to be able to redefine the role :emphasis: so as to render in gesperrt. Like this:: .. role:: emphasis(emphasis) :class: gesperrt But in the current implementation the custom role above works only if we write :emphasis:`this`. That is awkward. We want to be able to still write *this* and have the custom role to take effect. Implementation: We explored this by providing our own Inliner and overriding the inline_obj method. (Proof of concept code is available.) This takes care of emphasis, strong and literal, but doesn't work with all inlined elements. Also, if you override the default role, you have to redeclare it to clear the role cache. I think this functionality should go into the core and the parser should go through the role system for all inlined elements. Comments? -- Marcello Perathoner web...@gu... |