Modify

Opened 5 years ago

Closed 5 years ago

#4317 closed defect (fixed)

IncludeSourcePartial does not handle case where one line is returned

Reported by: chrisheller Owned by: chrisheller
Priority: low Component: IncludeSourcePartialPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

In ticket:4315 there was an issue with line separators that caused the included source to end up as one line. That broke the macro because it assumed that the mimeview render() method would always return a Genshi object that could have generate() called on it.

The line separator issue has been fixed, but I'm not sure of the best answer for the case where the included source ends up being just one line anyways.

The render() docstring says it "Can return the generated XHTML text as a single string", so it seems something like this is the best course of action.

  • includesource/IncludeSource.py

     
    143143        mv = Mimeview(self.env) 
    144144        src = mv.render(formatter.context, mimetype, src, file_name, url, ['givenlineno']) 
    145145 
     146        if not hasattr(src, 'generate'):    # got XHTML string back 
     147            from genshi.input import XML    # so we convert it to use 
     148            src = XML(src)                  # with Transformers below 
     149             
    146150        # the _render_source method will always set the CSS class 
    147151        # of the annotator to it's name; there isn't an easy way 
    148152        # to override that. We could create our own CSS class for 

If there are any Genshi experts that would like to comment, feel free to do so. Otherwise I'll commit this change after a bit more testing.

Attachments (0)

Change History (1)

comment:1 Changed 5 years ago by chrisheller

  • Resolution set to fixed
  • Status changed from new to closed

Added extra check for this condition in changeset:5438

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from chrisheller. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.