Skip to content

Commit

Permalink
Fix problem with unmatched <p> tags around highlighted code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Vlasenko committed Jan 28, 2014
1 parent 6cbc446 commit 631fa49
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class GroovyTemplate implements ResourceTemplate {
scriptObject.run()
String content = writer.toString()
view = new ResourceView()
view.content = content.replaceAll('<p><figure', '<figure').replaceAll('</figure></p>', '</figure>')
view.content = content.replaceAll(/(?s)<p>(<figure.+?<\/figure>)<\/p>/, '$1')
view.full = view.content
view.bytes = view.full.bytes
def renderTime = System.currentTimeMillis() - startRenderTime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ class TextTemplate implements ResourceTemplate {
String content = contents.replaceAll(/```/, {
this.fragments[codeIdx++]
})
view.content = content.replaceAll('<p><figure', '<figure').
replaceAll('</figure></p>', '</figure>')
view.content = content.replaceAll(/(?s)<p>(<figure.+?<\/figure>)<\/p>/, '$1')
view.full = view.content
view.bytes = view.full.bytes

Expand Down

0 comments on commit 631fa49

Please sign in to comment.