Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ultraq committed Aug 22, 2021
1 parent 14caa34 commit 4db2aa5
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -64,12 +64,14 @@ class HtmlHeadDecorator implements Decorator {
}

// Replace <title>s in the result with a proper merge of the source and target <title> elements
def indexOfTitle = resultHeadModel.findIndexOf { event -> event.isOpeningElementOf('title') }
def isTitle = { event -> event.isOpeningElementOf('title') }

def indexOfTitle = resultHeadModel.findIndexOf(isTitle)
if (indexOfTitle != -1) {
resultHeadModel.removeAllModels { event -> !event.whitespace && event.isOpeningElementOf('title') }
resultHeadModel.removeAllModels(isTitle)
def resultTitle = new HtmlTitleDecorator(context).decorate(
targetHeadModel?.findModel { event -> event.isOpeningElementOf('title') },
sourceHeadModel?.findModel { event -> event.isOpeningElementOf('title') }
targetHeadModel?.findModel(isTitle),
sourceHeadModel?.findModel(isTitle)
)
resultHeadModel.insertModelWithWhitespace(indexOfTitle, resultTitle, modelFactory)
}
Expand Down

0 comments on commit 4db2aa5

Please sign in to comment.