Files @ r8:e1662057b783
Branch filter:

Location: public/ws-vacation/doc/ws_docutils/raw_role_r2p.py

ws
Added tag v0.3 for changeset fad285782be8
# -*- coding: utf-8 -*-

#$HeadURL: https://rst2pdf.googlecode.com/svn/tags/0.16/rst2pdf/genpdftext.py $
#$LastChangedDate: 2010-10-06 17:17:48 -0300 (Wed, 06 Oct 2010) $
#$LastChangedRevision: 2393 $

# See LICENSE.txt for licensing terms

import os
from xml.sax.saxutils import escape
from rst2pdf.log import log, nodeid
from rst2pdf.basenodehandler import NodeHandler
import docutils.nodes
from urlparse import urljoin, urlparse
from reportlab.lib.units import cm
from rst2pdf.opt_imports import Paragraph

from rst2pdf.image import MyImage, missing
import ws_docutils.span

class HandleRaw(NodeHandler, docutils.nodes.raw):
    def get_text(self, client, node, replaceEnt):
        text = ''
        if 'pdf' in node.get('format', '').split():
            docutils.nodes.raw.output_format = 'pdf'
            text = node.astext()
            if replaceEnt:
                text = escape(text)
        return text