Modify

Opened 7 years ago

Last modified 7 years ago

#1712 new defect

source:trunk/path/to/somewhere links do not become links in the pdf

Reported by: blyth@… Owned by: chenca
Priority: normal Component: Trac2LatexPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.10

Description

the subject says it all, almost ...
it would be great if all the TracLinks were propagated as links into the pdf, especially :

source:trunk/path/to/somewhere

trying to visit TracLinks with ?format=tex to see what is supported gives an error :

LATEX PARSER ERROR: 'charmap' codec can't encode character u'u2014' in position 157: character maps to

Attachments (0)

Change History (1)

comment:1 Changed 7 years ago by anonymous


I made the links work to some extent by, a small change in trac2latex.py ... I hope this might help you with a cleaner solution

def _make_link(self, ns, target, match, label):
        # first check for an alias defined in trac.ini
        ns = self.env.config.get('intertrac', ns) or ns
        if ns in self.wiki.link_resolvers:
        #  
        # SCB pragmatic approach ... do a match on the "a" tag to get the href 
        #
        #   
        #   scbrez=self.scb_atagre.match(atag)
        #   if scbrez:
        #       return r"%s %s " % ( scbrez.group(1) , scbrez.group(2) )
        #   else:
            atag_element = self.wiki.link_resolvers[ns](self, ns, target, escape(label, False))
            atag_text = r"%s" % atag_element
            atag_bits = split(atag_text,"\"")
            return self._make_hf_ext_link( atag_bits[3] , label )
        elif target.startswith('//') or ns == "mailto":
            return self._make_ext_link(ns+':'+target, label)
        else:
            return self._make_intertrac_link(ns, target, label) or \
                   self._make_interwiki_link(ns, target, label) or \
                   match

    def _make_hf_ext_link(self, url, text, title=''):
        text = self._latexescape_comments(text, None)
        url = self._latexescape_comments(url, None)
        if text == url:
            return r"\hfurl{%s}" % url
        else:
            return r"\hfhref{%s}{%s}" % (url, text)

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.