diff --git a/lib/docs/filters/factorio/clean_html.rb b/lib/docs/filters/factorio/clean_html.rb
new file mode 100644
index 0000000000..0831d66de2
--- /dev/null
+++ b/lib/docs/filters/factorio/clean_html.rb
@@ -0,0 +1,70 @@
+module Docs
+ class Factorio
+ class CleanHtmlFilter < Filter
+ def call
+ # css('*[layout]').remove_attr('layout')
+ # css('*[layout-xs]').remove_attr('layout-xs')
+ # css('*[flex]').remove_attr('flex')
+ # css('*[flex-xs]').remove_attr('flex-xs')
+ # css('*[ng-class]').remove_attr('ng-class')
+ # css('*[align]').remove_attr('align')
+ # css('h1, h2, h3').remove_attr('class')
+
+ last_nav = css('.navigation-bar a').last
+ class_page = class_page = (not last_nav.nil? and last_nav.content == 'Classes' or slug.end_with? 'Common')
+ at_css('h1')['data-type'] = last_nav.content if not last_nav.nil?
+ css('.navigation-bar').remove
+
+ if slug.end_with? 'Classes'
+ # Remove from classes overview the repeated class overviews
+ css('.brief-listing .brief-listing').remove
+ elsif class_page
+ # We are in a class page
+ element = at_css('.element')
+
+ at_css('h1')['id'] = element['id']
+ element.remove_attribute 'id'
+ element.remove_class 'element'
+ element.children.before "
Members:
"+at_css('.brief-listing .brief-listing table').to_html
+
+ at_css('.brief-listing .brief-listing').remove
+ else
+ # Pages like Concepts
+
+ css('.brief-listing .brief-listing').each do |node|
+ struct = node.children[0]
+ name = node.at_css('.type-name')
+ table = node.at_css('table')
+
+ node.inner_html = ""
+ node << ''+struct.content+'
'
+ node.children[0] << name
+ node << table.to_html
+ end
+ end
+
+
+ css('.element-header').each do |node|
+ node.name = 'h3'
+ end
+
+
+ css('.detail-header').each do |node|
+ node.name = 'h4'
+ end
+
+ css('.example-header').each do |node|
+ node.name = 'h4'
+ end
+
+ css('.example').each do |node|
+ node.css('.block').each do |code|
+ code.name = 'pre'
+ code['data-language'] = 'lua'
+ end
+ end
+ doc
+ end
+ end
+ end
+end
diff --git a/lib/docs/filters/factorio/entries.rb b/lib/docs/filters/factorio/entries.rb
new file mode 100644
index 0000000000..efed09653c
--- /dev/null
+++ b/lib/docs/filters/factorio/entries.rb
@@ -0,0 +1,63 @@
+module Docs
+ class Factorio
+ class EntriesFilter < Docs::EntriesFilter
+ def get_name
+ name = at_css('h1').content
+ end
+
+ def get_type
+ type = 'Overview'
+ type = 'Classes' if at_css('h1')['data-type'] == 'Classes' or slug.end_with? 'Common'
+
+ type
+ end
+
+ # INDEX = Set.new
+
+ # def include_default_entry?
+ # false
+ # # INDEX.add?([name, type].join(';')) ? true : false # ¯\_(ツ)_/¯
+ # end
+
+ def additional_entries
+ return [] if root_page?
+
+ class_page = (at_css('h1')['data-type'] == 'Classes' or slug.end_with? 'Common')
+ @name = get_name
+
+ if class_page
+ type = 'Methods'
+ else
+ type = @name
+ end
+
+
+ if type == 'Events'
+ # Buggy page?
+ css('.element .element').map do |node|
+ [node['id'], node['id'], type]
+ end
+ else
+ css('.element').each_with_object [] do |node, entries|
+ elem_name = node.at_css('.element-name')
+ if class_page and not elem_name.nil?
+ name = @name + '.' + elem_name
+ else
+ name = node['id']
+ end
+ entries << [name, node['id'], type] if node['id'] != @name
+ end
+ end
+ end
+
+ private
+
+ # def mod
+ # return @mod if defined?(@mod)
+ # @mod = slug[/api\/([\w\-\.]+)\//, 1]
+ # @mod.remove! 'angular2.' if @mod
+ # @mod
+ # end
+ end
+ end
+end
diff --git a/lib/docs/scrapers/factorio.rb b/lib/docs/scrapers/factorio.rb
new file mode 100644
index 0000000000..fe079c5daf
--- /dev/null
+++ b/lib/docs/scrapers/factorio.rb
@@ -0,0 +1,31 @@
+
+module Docs
+ class Factorio < UrlScraper
+ self.name = 'Factorio'
+ self.type = 'simple'
+ self.links = {
+ home: 'https://factorio.com',
+ code: 'https://lua-api.factorio.com'
+ }
+
+ self.release = 'latest'
+ self.base_url = 'https://lua-api.factorio.com/' + self.release + '/'
+
+ html_filters.push 'factorio/clean_html', 'factorio/entries'
+
+ # options[:trailing_slash] = false
+ # options[:container] = 'body'
+ # options[:skip] = %w(guides development tutorial versions all)
+ # options[:skip_patterns] = [/\/history\z/]
+ # options[:replace_paths] = {
+ # 'api/web-view-tag' => 'api/webview-tag'
+ # }
+
+ options[:max_image_size] = 256_000
+
+ options[:attribution] = <<-HTML
+ Copyright © 2015–2019 Wube Software - all rights reserved.
+ HTML
+
+ end
+end