Status: New
Owner: Zoom.Quiet
Labels: Type-Enhancement Priority-High OpSys-All Component-Scripts Usability

New issue 41 by Zoom.Quiet: [suggest]TOC can click+TOC anchor unique

for blogging,i hacked v2.4, so share at first, i will try
to merge into v2.5:
    + for make TOC can click,and make TOC anchor unique:
        - e.g
        - in this page include several t2t export xhtml body
        - include several TOC guider list
        - with my hacked,every TOC list can click jump to that chapter
        - and every chapter can click back the right entry top
        hacking: appended one global ver as
        XHTML_TOPTOP = ""
        # hacked for generate unique top anchor seed
        def doHeader(headers, config):
            #100419:zoomq for toc fixed in multipages
            global XHTML_TOPTOP
            ret =  string.split(template, '\n')
            #   zoomq:100419 for toc in multi pages
            for i in range(len(ret)):
                if "<h1>" in ret[i]:
                    #print ret[i][4:-5]
                    XHTML_TOPTOP =
                    ret[i] = "<a name='toptop%s'
            #return string.split(template, '\n')
            return ret

        class TitleMaster:
            import base64

            # hacked for generate unique anchor seed for every TOC title
            def _get_tagged_anchor(self):
                if CONF['toc'] and self.level <= CONF['toc-level']:
                self.anchor_count = self.anchor_count + 1
                # zoomq:100414 fixed link as unique str
                unique =
                label = label or '%s%s%s'%(
                        , self.anchor_count
                        , unique[:9]
            # hacked for plugin jump back the top link usage
XHTML_TOPTOP as unique anchor seed
            def get(self):
                global XHTML_TOPTOP
                full_title = "<A href='#toptop%s'> %s </A>"
%(XHTML_TOPTOP, self._get_full_title_text())
            # hacked for generate every TOC title jump into unique anchor
            def dump_marked_toc(self, max_level=99):
                    for level, count_id, txt, label in self.toc:
                        # zoomq:100414 fixed link as unique str
                        tocStr = "%s %s%s"%(count_id,txt, label)
                        uniqueStr =  
                        if level > max_level: continue   # ignore
                        indent = '  '*level
                        id_txt = string.lstrip('%s %s'%(count_id, txt))
                        label = label or self.anchor_prefix+`toc_count`
                        label += uniqueStr[:9]

The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
txt2tags-list mailing list

Reply via email to