diff --git a/lib/docs/filters/phalcon/clean_html.rb b/lib/docs/filters/phalcon/clean_html.rb new file mode 100644 index 00000000..9ec58102 --- /dev/null +++ b/lib/docs/filters/phalcon/clean_html.rb @@ -0,0 +1,14 @@ +module Docs + class Phalcon + class CleanHtmlFilter < Filter + def call + @doc = at_css('.body') + + # Remove unnecessary things + css('.headerlink', '#what-is-phalcon', '#other-formats', '#welcome h1', '#welcome p', '#table-of-contents h2').remove + + doc + end + end + end +end diff --git a/lib/docs/filters/phalcon/entries.rb b/lib/docs/filters/phalcon/entries.rb new file mode 100644 index 00000000..9793f97a --- /dev/null +++ b/lib/docs/filters/phalcon/entries.rb @@ -0,0 +1,20 @@ +module Docs + class Phalcon + class EntriesFilter < Docs::EntriesFilter + def get_name + node = css('h1').first + name = node.content.strip + node.remove + name + end + + def get_type + if slug.start_with?('reference') + 'Reference' + else + 'API' + end + end + end + end +end diff --git a/lib/docs/scrapers/phalcon.rb b/lib/docs/scrapers/phalcon.rb new file mode 100644 index 00000000..ff79cf3e --- /dev/null +++ b/lib/docs/scrapers/phalcon.rb @@ -0,0 +1,23 @@ +module Docs + class Phalcon < UrlScraper + self.name = 'Phalcon' + self.slug = 'phalcon' + self.type = 'phalcon' + self.base_url = 'https://docs.phalconphp.com/en/latest/' + self.root_path = 'index.html' + self.links = { + home: 'https://phalconphp.com/', + code: 'https://github.com/phalcon/cphalcon/' + } + + html_filters.push 'phalcon/clean_html', 'phalcon/entries', 'title' + + options[:root_title] = 'Phalcon' + options[:only_patterns] = [/reference\//, /api\//] + + options[:attribution] = <<-HTML + © 2012–2015 the Phalcon Team
+ Licensed under the Creative Commons Attribution License 3.0. + HTML + end +end diff --git a/public/icons/docs/phalcon/16.png b/public/icons/docs/phalcon/16.png new file mode 100644 index 00000000..ef92e6ba Binary files /dev/null and b/public/icons/docs/phalcon/16.png differ diff --git a/public/icons/docs/phalcon/16@2x.png b/public/icons/docs/phalcon/16@2x.png new file mode 100644 index 00000000..6356d3ad Binary files /dev/null and b/public/icons/docs/phalcon/16@2x.png differ diff --git a/public/icons/docs/phalcon/SOURCE b/public/icons/docs/phalcon/SOURCE new file mode 100644 index 00000000..4676d6ce --- /dev/null +++ b/public/icons/docs/phalcon/SOURCE @@ -0,0 +1 @@ +https://github.com/phalcon/website/blob/master/public/img/phalcon-22.png