JBehave
  1. JBehave
  2. JBEHAVE-813

html template report contains encoded html tags

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.6.8
    • Fix Version/s: 3.6.9, 3.7
    • Component/s: Core
    • Labels:
      None
    • Number of attachments :
      0

      Description

      the template html report contains a few encoded html tags where the actual tag would be correct (span for parameters), this is probably due to the changes for JBEHAVE-802.

        Activity

        Mauro Talevi made changes -
        Field Original Value New Value
        Fix Version/s 3.6.9 [ 18650 ]
        Hide
        Alexander Lehmann added a comment -

        e.g. if you have a story

        Then I say 'something other'
        

        then the resulting html should be

        <div class="step successful">Then I say '<span class="step parameter">something other</span>' </div>
        

        but is

        <div class="step successful">Then I say '&lt;span class=&quot;step parameter&quot;&gt;something other&lt;/span&gt;' </div>
        
        Show
        Alexander Lehmann added a comment - e.g. if you have a story Then I say 'something other' then the resulting html should be <div class= "step successful" >Then I say '<span class= "step parameter" >something other</span>' </div> but is <div class= "step successful" >Then I say '&lt;span class=&quot;step parameter&quot;&gt;something other&lt;/span&gt;' </div>
        Hide
        Mauro Talevi added a comment -

        What's happening is a double escaping. The StepOutput has a getParameterisedStep(String pattern) method that should be solely responsible for the escaping, rather than the Freemarker template macro (?html or ?xml).

        We need to add a method getParametrisedSteps(Escape escape, String pattern) using the enum Escape

        { HTML, XML, NULL }

        to determine which escaping needs to be done in the Java method implementation using the StringEscapeUtils.

        Show
        Mauro Talevi added a comment - What's happening is a double escaping. The StepOutput has a getParameterisedStep(String pattern) method that should be solely responsible for the escaping, rather than the Freemarker template macro (?html or ?xml). We need to add a method getParametrisedSteps(Escape escape, String pattern) using the enum Escape { HTML, XML, NULL } to determine which escaping needs to be done in the Java method implementation using the StringEscapeUtils.
        Hide
        Alexander Lehmann added a comment -

        https://github.com/alexlehm/jbehave-core/commit/9ec9dd36467d1fff3986358e808380198c014044

        JBEHAVE-813: html template report contains encoded html tags

        correctly encode step pattern and parameters but not the html/xml tags that are inserted into the text in the report
        (changes for the actual fix and added a few lines to the TemplateOutputBehavious as well as to the PrintStreamOutputBehaviour, this does the encoding correctly however)
        To distinguish between XML and HTML I had to introduce an enum that is accessible from the freemarker template, which is kind of complicated.

        (the commit also contains the changes for JBEHAVE-815, due to the necessary changes in the unit text result files it didn't make munch sense to put this in two commits)

        Show
        Alexander Lehmann added a comment - https://github.com/alexlehm/jbehave-core/commit/9ec9dd36467d1fff3986358e808380198c014044 JBEHAVE-813 : html template report contains encoded html tags correctly encode step pattern and parameters but not the html/xml tags that are inserted into the text in the report (changes for the actual fix and added a few lines to the TemplateOutputBehavious as well as to the PrintStreamOutputBehaviour, this does the encoding correctly however) To distinguish between XML and HTML I had to introduce an enum that is accessible from the freemarker template, which is kind of complicated. (the commit also contains the changes for JBEHAVE-815 , due to the necessary changes in the unit text result files it didn't make munch sense to put this in two commits)
        Hide
        Alexander Lehmann added a comment -

        sorry, left a debug statement in, please merge this commit as well

        https://github.com/alexlehm/jbehave-core/commit/aef1a65d552ffcc5b76f775f965d40a43c8ace86

        Show
        Alexander Lehmann added a comment - sorry, left a debug statement in, please merge this commit as well https://github.com/alexlehm/jbehave-core/commit/aef1a65d552ffcc5b76f775f965d40a43c8ace86
        Mauro Talevi made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Mauro Talevi made changes -
        Fix Version/s 3.7 [ 18390 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Alexander Lehmann
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: