From 59778f787711ee159dba0448f0792de13cf42642 Mon Sep 17 00:00:00 2001 From: ShaneQful Date: Thu, 12 Nov 2015 23:34:03 +0000 Subject: [PATCH] First pass at filters and scraper for dojo --- lib/docs/filters/dojo/clean_html.rb | 11 + lib/docs/filters/dojo/entries.rb | 14 ++ lib/docs/scrapers/dojo.rb | 316 ++++++++++++++++++++++++++++ 3 files changed, 341 insertions(+) create mode 100644 lib/docs/filters/dojo/clean_html.rb create mode 100644 lib/docs/filters/dojo/entries.rb create mode 100644 lib/docs/scrapers/dojo.rb diff --git a/lib/docs/filters/dojo/clean_html.rb b/lib/docs/filters/dojo/clean_html.rb new file mode 100644 index 0000000000..2e6e0111a5 --- /dev/null +++ b/lib/docs/filters/dojo/clean_html.rb @@ -0,0 +1,11 @@ +module Docs + class Dojo + class CleanHtmlFilter < Filter + def call + # TODO: Probably needs a little more cleanup but should do for the moment + css('script').remove + doc + end + end + end +end diff --git a/lib/docs/filters/dojo/entries.rb b/lib/docs/filters/dojo/entries.rb new file mode 100644 index 0000000000..1c50799d61 --- /dev/null +++ b/lib/docs/filters/dojo/entries.rb @@ -0,0 +1,14 @@ +module Docs + class Dojo + class EntriesFilter < Docs::EntriesFilter + def get_name + at_css('h1').content + end + + def get_type + name + end + # TODO:Figure out how to solve the internal links issue later + end + end +end \ No newline at end of file diff --git a/lib/docs/scrapers/dojo.rb b/lib/docs/scrapers/dojo.rb new file mode 100644 index 0000000000..b2af9962e4 --- /dev/null +++ b/lib/docs/scrapers/dojo.rb @@ -0,0 +1,316 @@ +module Docs + class Dojo < UrlScraper + self.name = 'Dojo' + self.slug = 'dojo' + self.type = 'dojo' + self.version = '1.10' + self.base_url = 'http://dojotoolkit.org/api/1.10/' #tree.json + self.initial_paths = %w( + dojo/AdapterRegistry + dojo/aspect + dojo/back + dojo/_base/array + dojo/_base/browser + dojo/_base/Color + dojo/_base/Color.named + dojo/_base/config + dojo/_base/config.modulePaths + dojo/_base/connect + dojo/_base/declare + dojo/_base/declare.__DeclareCreatedObject + dojo/_base/Deferred + dojo/_base/event + dojo/_base/fx + dojo/_base/html + dojo/_base/json + dojo/_base/kernel + dojo/_base/kernel.back + dojo/_base/kernel.cldr + dojo/_base/kernel.colors + dojo/_base/kernel.config + dojo/_base/kernel.contentHandlers + dojo/_base/kernel._contentHandlers + dojo/_base/kernel.currency + dojo/_base/kernel.data + dojo/_base/kernel.date + dojo/_base/kernel.dijit + dojo/_base/kernel.dnd + dojo/_base/kernel.doc + dojo/_base/kernel.dojox + dojo/_base/kernel.fx + dojo/_base/kernel.gears + dojo/_base/kernel.global + dojo/_base/kernel._hasResource + dojo/_base/kernel.html + dojo/_base/kernel.i18n + dojo/_base/kernel.io + dojo/_base/kernel.__IoArgs + dojo/_base/kernel.__IoCallbackArgs + dojo/_base/kernel.__IoPublish + dojo/_base/kernel.keys + dojo/_base/kernel.mouseButtons + dojo/_base/kernel._nodeDataCache + dojo/_base/kernel.number + dojo/_base/kernel.regexp + dojo/_base/kernel.rpc + dojo/_base/kernel.scopeMap + dojo/_base/kernel.Stateful + dojo/_base/kernel.store + dojo/_base/kernel.string + dojo/_base/kernel.tests + dojo/_base/kernel.touch + dojo/_base/kernel.version + dojo/_base/kernel.window + dojo/_base/kernel.__XhrArgs + dojo/_base/lang + dojo/_base/loader + dojo/_base/NodeList + dojo/_base/query + dojo/_base/sniff + dojo/_base/unload + dojo/_base/url + dojo/_base/url.authority + dojo/_base/url.fragment + dojo/_base/url.password + dojo/_base/url.port + dojo/_base/url.query + dojo/_base/url.scheme + dojo/_base/url.user + dojo/_base/window + dojo/_base/window.doc + dojo/_base/window.global + dojo/_base/xhr + dojo/_base/xhr.contentHandlers + dojo/behavior + dojo/cache + dojo/cldr/monetary + dojo/cldr/supplemental + dojo/colors + dojo/cookie + dojo/currency + dojo/currency.__FormatOptions + dojo/currency.__ParseOptions + dojo/data/api/Identity + dojo/data/api/Item + dojo/data/api/Notification + dojo/data/api/Read + dojo/data/api/Request + dojo/data/api/Write + dojo/data/ItemFileReadStore + dojo/data/ItemFileWriteStore + dojo/data/ObjectStore + dojo/data/util/filter + dojo/data/util/simpleFetch + dojo/data/util/sorter + dojo/date + dojo/date/locale + dojo/date/locale.__FormatOptions + dojo/date/stamp + dojo/debounce + dojo/Deferred + dojo/DeferredList + dojo/dnd/autoscroll + dojo/dnd/autoscroll._validNodes + dojo/dnd/autoscroll._validOverflow + dojo/dnd/AutoSource + dojo/dnd/Avatar + dojo/dnd/common + dojo/dnd/common._defaultCreatorNodes + dojo/dnd/common._empty + dojo/dnd/Container + dojo/dnd/Container.__ContainerArgs + dojo/dnd/Manager + dojo/dnd/move + dojo/dnd/Moveable + dojo/dnd/Moveable.__MoveableArgs + dojo/dnd/move.boxConstrainedMoveable + dojo/dnd/move.constrainedMoveable + dojo/dnd/move.parentConstrainedMoveable + dojo/dnd/Mover + dojo/dnd/Selector + dojo/dnd/Source + dojo/dnd/Target + dojo/dnd/TimedMoveable + dojo/dom + dojo/dom-attr + dojo/dom-class + dojo/dom-construct + dojo/dom-form + dojo/dom-geometry + dojo/dom-prop + dojo/dom-prop.names + dojo/domReady + dojo/dom-style + dojo/errors/CancelError + dojo/errors/create + dojo/errors/RequestError + dojo/errors/RequestTimeoutError + dojo/Evented + dojo/_firebug/firebug + dojo/fx + dojo/fx/easing + dojo/fx.easing + dojo/fx/Toggler + dojo/fx.Toggler + dojo/gears + dojo/gears.available + dojo/has + dojo/hash + dojo/hccss + dojo/html + dojo/html._ContentSetter + dojo/i18n + dojo/i18n.cache + dojo/io/iframe + dojo/io-query + dojo/io/script + dojo/json + dojo/keys + dojo/loadInit + dojo/main + dojo/main.back + dojo/main.cldr + dojo/main.colors + dojo/main.config + dojo/main.contentHandlers + dojo/main._contentHandlers + dojo/main.currency + dojo/main.data + dojo/main.date + dojo/main.dijit + dojo/main.dnd + dojo/main.doc + dojo/main.dojox + dojo/main.fx + dojo/main.gears + dojo/main.global + dojo/main._hasResource + dojo/main.html + dojo/main.i18n + dojo/main.io + dojo/main.__IoArgs + dojo/main.__IoCallbackArgs + dojo/main.__IoPublish + dojo/main.keys + dojo/main.mouseButtons + dojo/main._nodeDataCache + dojo/main.number + dojo/main.regexp + dojo/main.rpc + dojo/main.scopeMap + dojo/main.Stateful + dojo/main.store + dojo/main.string + dojo/main.tests + dojo/main.touch + dojo/main.version + dojo/main.window + dojo/main.__XhrArgs + dojo/mouse + dojo/node + dojo/NodeList + dojo/NodeList-data + dojo/NodeList-dom + dojo/NodeList-fx + dojo/NodeList-html + dojo/NodeList-manipulate + dojo/NodeList._nodeDataCache + dojo/NodeList-traverse + dojo/number + dojo/number.__FormatAbsoluteOptions + dojo/number.__FormatOptions + dojo/number.__IntegerRegexpFlags + dojo/number.__ParseOptions + dojo/number.__RealNumberRegexpFlags + dojo/number.__RegexpOptions + dojo/on + dojo/on/asyncEventListener + dojo/on/debounce + dojo/on/throttle + dojo/parser + dojo/promise/all + dojo/promise/first + dojo/promise/instrumentation + dojo/promise/Promise + dojo/promise/tracer + dojo/query + dojo/ready + dojo/regexp + dojo/request + dojo/request.__BaseOptions + dojo/request/default + dojo/request/handlers + dojo/request/iframe + dojo/request/iframe.__BaseOptions + dojo/request/iframe.__MethodOptions + dojo/request/iframe.__Options + dojo/request.__MethodOptions + dojo/request/node + dojo/request/node.__BaseOptions + dojo/request/node.__MethodOptions + dojo/request/node.__Options + dojo/request/notify + dojo/request.__Options + dojo/request.__Promise + dojo/request/registry + dojo/request/script + dojo/request/script.__BaseOptions + dojo/request/script.__MethodOptions + dojo/request/script.__Options + dojo/request/util + dojo/request/watch + dojo/request/xhr + dojo/request/xhr.__BaseOptions + dojo/request/xhr.__MethodOptions + dojo/request/xhr.__Options + dojo/require + dojo/robot + dojo/robot._runsemaphore + dojo/robotx + dojo/robotx._runsemaphore + dojo/router + dojo/router/RouterBase + dojo/rpc/JsonpService + dojo/rpc/JsonService + dojo/rpc/RpcService + dojo/selector/acme + dojo/selector/lite + dojo/selector/_loader + dojo/sniff + dojo/Stateful + dojo/store/api/Store + dojo/store/api/Store.PutDirectives + dojo/store/api/Store.QueryOptions + dojo/store/api/Store.QueryResults + dojo/store/api/Store.SortInformation + dojo/store/api/Store.Transaction + dojo/store/Cache + dojo/store/DataStore + dojo/store/JsonRest + dojo/store/Memory + dojo/store/Observable + dojo/store/util/QueryResults + dojo/store/util/SimpleQueryEngine + dojo/string + dojo/text + dojo/throttle + dojo/topic + dojo/touch + dojo/uacss + dojo/when + dojo/window) + self.links = { + home: 'http://dojotoolkit.org', + code: 'https://github.com/dojo/dojo' + } + + html_filters.push 'dojo/clean_html', 'dojo/entries' + + options[:skip_links] = true + + options[:attribution] = <<-HTML + The Dojo Toolkit is Copyright © 2005–2013
+ Dual licensed under BSD 3-Clause and AFL. + HTML + end +end