Skip to content

Commit

Permalink
DEVELOPER-915 only take Nokogiri output if changes were made
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuir committed Sep 25, 2014
1 parent cad3560 commit 47288d5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions _ext/jboss_developer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ def activate registry
# Public: Awestruct Transformer that adds the "external-link" class to
# external HTML links.
class LinkTransformer
def transform site, page, input
def transform site, page, content
if page.output_extension == ".html"
doc = Nokogiri::HTML(input)
doc = Nokogiri::HTML(content)
altered = false
doc.css('a').each do |a|
url = a['href']
if (external?(url, site.base_url) && !(has_non_text_child? a))
Expand All @@ -76,12 +77,12 @@ def transform site, page, input
end

a['class'] = classes.uniq.join ' '
altered = true
end
end
doc.to_html
else
input
content = doc.to_html if altered
end
content
end

private
Expand Down

0 comments on commit 47288d5

Please sign in to comment.