Class: RhetButler::Stasis::HTMLTransform
Constant Summary
collapse
- NAV_AND_EMBED =
%w[
//a/@href
//applet/@codebase
//area/@href
//base/@href
//body/@background
//frame/@longdesc
//frame/@src
//iframe/@longdesc
//iframe/@src
//img/@longdesc
//img/@src
//input/@src
//link/@href
//object/@codebase
//object/@data
//script/@src
//audio/@src
//command/@icon
//embed/@src
//html/@manifest
//source/@src
//video/@poster
//video/@src
]
Instance Attribute Summary
#document, #queue, #target_path
Instance Method Summary
collapse
#document_source, #get_link_translation, #process, register, #save_document
Instance Method Details
#parse_document ⇒ Object
34
35
36
|
# File 'lib/rhet-butler/stasis/html-transform.rb', line 34
def parse_document
@parsed = Nokogiri::HTML(document.body)
end
|
#render_document ⇒ Object
46
47
48
|
# File 'lib/rhet-butler/stasis/html-transform.rb', line 46
def render_document
@parsed.to_html
end
|
#translate_links ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/rhet-butler/stasis/html-transform.rb', line 38
def translate_links
NAV_AND_EMBED.each do |xpath|
@parsed.xpath(xpath).each do |attr|
attr.value = get_link_translation(attr.value)
end
end
end
|