Changeset 4725


Ignore:
Timestamp:
Nov 3, 2008, 4:34:34 PM (12 years ago)
Author:
Catalin BALAN
Message:

SectionEditPlugin: - Fixed paragraph title in edit mode.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sectioneditplugin/0.11/tracsectionedit/web_ui.py

    r4724 r4725  
    3939                if len(section_text) > 0 and section_text[-1] != '\n':
    4040                    section_text += '\n'
     41                if len(req.args['section_pre']) > 0 and req.args['section_pre'][-1] != '\n':
     42                    section_text = '\n' + section_text
    4143                req.args['section_text'] = req.args.get('text')
    4244                req.args['text'] = "%s%s%s"%(req.args.get('section_pre'),
     
    5254    # ITemplateStreamFilter methods
    5355    def filter_stream(self, req, method, filename, stream, data):
    54         if filename == 'wiki_edit.html' and 'section' in req.args:
     56        if filename == 'wiki_edit.html' and 'section' in req.args and 'merge' not in req.args:
    5557            if 'section_text' in req.args:
    5658                section_pre, section_text, section_post = req.args.get('section_pre'), req.args.get('section_text'), req.args.get('section_post')
    5759            else:
    5860                section_pre, section_text, section_post = self._split_page_text(data['page'].text, req.args['section'])
     61                section_text = ''.join(section_text)
    5962           
    6063            section_element = html.input(type='hidden', name='section', id='section', value=req.args.get('section'))
     
    6366           
    6467            section_html = html(section_element, pre_element, post_element)
    65             stream = stream | Transformer('//textarea[@name="text"]').empty().append(''.join(section_text)).before(section_html)
    66             stream = stream | Transformer('//div[@id="content"]//h1').append("/%s (section %s)"%(section_text[0].strip('= '), req.args['section']))
     68            stream = stream | Transformer('//textarea[@name="text"]').empty().append(section_text).before(section_html)
     69            stream = stream | Transformer('//div[@id="content"]//h1').append("/%s (section %s)"%(section_text[:section_text.find('\n')].strip(" = \r\n"), req.args['section']))
    6770        return stream
    6871
Note: See TracChangeset for help on using the changeset viewer.