I've managed to get a result by adding a custom role :highlight: with
the following (hackey) code:
from docutils import nodes
class highlight( nodes.Inline, nodes.TextElement ): pass
roles.register_generic_role('highlight', highlight )
import docutils.writers.html4css1
def visit_highlight(self, node):
self.body.append( self.starttag(node, 'span', '', CLASS="highlight") )
def depart_highlight(self, node):
self.body.append('</span>')
docutils.writers.html4css1.HTMLTranslator.visit_highlight = visit_highlight
docutils.writers.html4css1.HTMLTranslator.depart_highlight = depart_highlight
However when I use it in the following case:
:highlight:`some text with further **emphasis**`
It renders out the asterisks instead of further processing it to <strong> tags.
I'm not sure if it is possible to have to process the text of the role?
Michael
On Tue, Jan 13, 2009 at 11:36 AM, Michael Jones <[email protected]> wrote:
> Hi,
>
> I'd like my final html output to have highlighting of the form:
>
> <span class="highlight">this is my text</span>
>
> So I can add a some styling for the highlight class, I've been looking
> into custom roles and nodes and the like but I can't figure it out.
> Any tips would be very welcome. Happy to code if necessary.
>
> Michael
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sphinx-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sphinx-dev?hl=en
-~----------~----~----~----~------~----~------~--~---