Class: PageHub::Markdown::Embedder::PageHubProcessor

Inherits:
Processor
  • Object
show all
Defined in:
lib/pagehub-markdown/processors/embedder.rb

Overview

Extracts content from PageHub shared documents

Bound keys:

Instance Method Summary collapse

Methods inherited from Processor

#applies_to?, #stamp

Constructor Details

#initializePageHubProcessor

Returns a new instance of PageHubProcessor.



197
198
199
# File 'lib/pagehub-markdown/processors/embedder.rb', line 197

def initialize()
  super(["pagehub", /pagehub.org/])
end

Instance Method Details

#process(content, uri, args = "") ⇒ Object



201
202
203
204
205
206
207
208
# File 'lib/pagehub-markdown/processors/embedder.rb', line 201

def process(content, uri, args = "")
  html_doc = Nokogiri::HTML(content) do |config| config.noerror end
  node = html_doc.xpath("//div[@id='content']").first
  node.xpath('div[@id="breadcrumbs"]').remove
  node.xpath('div[@id="bottom"]').remove
  stamp(node, uri, 'pagehub')
  node
end