diff --git a/Gemfile b/Gemfile index 394fdd83..e930dc7c 100644 --- a/Gemfile +++ b/Gemfile @@ -18,7 +18,6 @@ gem 'slim', require: false gem 'liquid', require: false gem 'less', '~> 2.3.0', require: false gem 'stylus', require: false -gem 'asciidoctor', require: false platforms :ruby do gem 'therubyracer' diff --git a/middleman-core/features/asciidoc.feature b/middleman-core/features/asciidoc.feature deleted file mode 100644 index 14bca69e..00000000 --- a/middleman-core/features/asciidoc.feature +++ /dev/null @@ -1,155 +0,0 @@ -Feature: AsciiDoc Support - In order to test included AsciiDoc support - - Scenario: Rendering html - Given the Server is running at "asciidoc-app" - When I go to "/hello.html" - Then I should see: - """ -
-

Hello, AsciiDoc! - Middleman, I am in you.

-
- """ - - Scenario: Rendering html with default layout - Given a fixture app "asciidoc-app" - And a file named "config.rb" with: - """ - set :layout, :default - """ - Given the Server is running at "asciidoc-app" - When I go to "/hello.html" - Then I should see: - """ - - - - Fallback - - -
-

Hello, AsciiDoc! - Middleman, I am in you.

-
- - - """ - - Scenario: Rendering html with explicit layout - Given the Server is running at "asciidoc-app" - When I go to "/hello-with-layout.html" - Then I should see: - """ - - - - Fallback - - -
-

Hello, AsciiDoc!

-
- - - """ - - Scenario: Rendering html with no layout - Given the Server is running at "asciidoc-app" - When I go to "/hello-no-layout.html" - Then I should see: - """ -
-

Hello, AsciiDoc!

-
- """ - - Scenario: Rendering html using title from document - Given the Server is running at "asciidoc-app" - When I go to "/hello-with-title.html" - Then I should see: - """ - - - - Page Title - - -

Page Title

-
-
-
-

Hello, AsciiDoc!

-
-
-
- - - """ - - Scenario: Rendering html with title and layout from front matter - Given the Server is running at "asciidoc-app" - When I go to "/hello-with-front-matter.html" - Then I should see: - """ - - - - Page Title - - -
-

Hello, AsciiDoc!

-
- - - """ - - Scenario: Including a file relative to source root - Given the Server is running at "asciidoc-app" - When I go to "/master.html" - Then I should see: - """ -
-
-
I'm included content.
-
- """ - - Scenario: Linking to an image - Given the Server is running at "asciidoc-app" - When I go to "/gallery.html" - Then I should see: - """ -
-
- tiger -
- """ - - Scenario: Configuring custom AsciiDoc attributes - Given a fixture app "asciidoc-app" - And a file named "config.rb" with: - """ - set :asciidoc_attributes, %w(foo=bar) - """ - Given the Server is running at "asciidoc-app" - When I go to "/custom-attribute.html" - Then I should see "bar" - - Scenario: Highlighting source code - Given a fixture app "asciidoc-app" - And a file named "config.rb" with: - """ - set :asciidoc_attributes, %w(source-highlighter=html-pipeline) - """ - Given the Server is running at "asciidoc-app" - When I go to "/code.html" - Then I should see: - """ -
-
-
puts "Is this mic on?"
-
-
- """ diff --git a/middleman-core/fixtures/asciidoc-app/config.rb b/middleman-core/fixtures/asciidoc-app/config.rb deleted file mode 100644 index e69de29b..00000000 diff --git a/middleman-core/fixtures/asciidoc-app/source/_include.adoc b/middleman-core/fixtures/asciidoc-app/source/_include.adoc deleted file mode 100644 index b0cdec38..00000000 --- a/middleman-core/fixtures/asciidoc-app/source/_include.adoc +++ /dev/null @@ -1 +0,0 @@ -I'm included content. diff --git a/middleman-core/fixtures/asciidoc-app/source/code.html.adoc b/middleman-core/fixtures/asciidoc-app/source/code.html.adoc deleted file mode 100644 index e0d6a519..00000000 --- a/middleman-core/fixtures/asciidoc-app/source/code.html.adoc +++ /dev/null @@ -1,3 +0,0 @@ -```ruby -puts "Is this mic on?" -``` diff --git a/middleman-core/fixtures/asciidoc-app/source/custom-attribute.html.adoc b/middleman-core/fixtures/asciidoc-app/source/custom-attribute.html.adoc deleted file mode 100644 index b4eb729d..00000000 --- a/middleman-core/fixtures/asciidoc-app/source/custom-attribute.html.adoc +++ /dev/null @@ -1,3 +0,0 @@ -++++ -{foo} -++++ diff --git a/middleman-core/fixtures/asciidoc-app/source/gallery.html.adoc b/middleman-core/fixtures/asciidoc-app/source/gallery.html.adoc deleted file mode 100644 index 4a9f37f1..00000000 --- a/middleman-core/fixtures/asciidoc-app/source/gallery.html.adoc +++ /dev/null @@ -1 +0,0 @@ -image::tiger.gif[] diff --git a/middleman-core/fixtures/asciidoc-app/source/hello-no-layout.html.adoc b/middleman-core/fixtures/asciidoc-app/source/hello-no-layout.html.adoc deleted file mode 100644 index 8156a16f..00000000 --- a/middleman-core/fixtures/asciidoc-app/source/hello-no-layout.html.adoc +++ /dev/null @@ -1,2 +0,0 @@ -:page-layout: false -Hello, AsciiDoc! diff --git a/middleman-core/fixtures/asciidoc-app/source/hello-with-front-matter.html.adoc b/middleman-core/fixtures/asciidoc-app/source/hello-with-front-matter.html.adoc deleted file mode 100644 index 5e1f91a3..00000000 --- a/middleman-core/fixtures/asciidoc-app/source/hello-with-front-matter.html.adoc +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Page Title -layout: default ---- -Hello, AsciiDoc! diff --git a/middleman-core/fixtures/asciidoc-app/source/hello-with-layout.html.adoc b/middleman-core/fixtures/asciidoc-app/source/hello-with-layout.html.adoc deleted file mode 100644 index 763ba8c1..00000000 --- a/middleman-core/fixtures/asciidoc-app/source/hello-with-layout.html.adoc +++ /dev/null @@ -1,2 +0,0 @@ -:page-layout: default -Hello, AsciiDoc! diff --git a/middleman-core/fixtures/asciidoc-app/source/hello-with-title.html.adoc b/middleman-core/fixtures/asciidoc-app/source/hello-with-title.html.adoc deleted file mode 100644 index e2c7673b..00000000 --- a/middleman-core/fixtures/asciidoc-app/source/hello-with-title.html.adoc +++ /dev/null @@ -1,4 +0,0 @@ -= Page Title -:page-layout: default - -Hello, AsciiDoc! diff --git a/middleman-core/fixtures/asciidoc-app/source/hello.html.adoc b/middleman-core/fixtures/asciidoc-app/source/hello.html.adoc deleted file mode 100755 index 6c1ab072..00000000 --- a/middleman-core/fixtures/asciidoc-app/source/hello.html.adoc +++ /dev/null @@ -1,4 +0,0 @@ -Hello, AsciiDoc! -ifdef::env-middleman[] -Middleman, I am in you. -endif::env-middleman[] diff --git a/middleman-core/fixtures/asciidoc-app/source/images/tiger.gif b/middleman-core/fixtures/asciidoc-app/source/images/tiger.gif deleted file mode 100755 index 2498f1aa..00000000 Binary files a/middleman-core/fixtures/asciidoc-app/source/images/tiger.gif and /dev/null differ diff --git a/middleman-core/fixtures/asciidoc-app/source/layouts/default.erb b/middleman-core/fixtures/asciidoc-app/source/layouts/default.erb deleted file mode 100644 index 01d1c485..00000000 --- a/middleman-core/fixtures/asciidoc-app/source/layouts/default.erb +++ /dev/null @@ -1,9 +0,0 @@ - - - -<%= current_resource.data.title || asciidoc[:title] || 'Fallback' %> - - -<%= yield %> - - diff --git a/middleman-core/fixtures/asciidoc-app/source/master.html.adoc b/middleman-core/fixtures/asciidoc-app/source/master.html.adoc deleted file mode 100644 index 1b789b44..00000000 --- a/middleman-core/fixtures/asciidoc-app/source/master.html.adoc +++ /dev/null @@ -1,3 +0,0 @@ -.... -include::_include.adoc[] -.... diff --git a/middleman-core/lib/middleman-core/core_extensions/rendering.rb b/middleman-core/lib/middleman-core/core_extensions/rendering.rb index a77f853f..c61f2f2d 100644 --- a/middleman-core/lib/middleman-core/core_extensions/rendering.rb +++ b/middleman-core/lib/middleman-core/core_extensions/rendering.rb @@ -48,13 +48,6 @@ module Middleman require 'middleman-core/renderers/markdown' app.send :include, Middleman::Renderers::Markdown - # AsciiDoc Support - begin - require 'middleman-core/renderers/asciidoc' - app.send :include, Middleman::Renderers::AsciiDoc - rescue LoadError - end - # Liquid Support begin require 'middleman-core/renderers/liquid' diff --git a/middleman-core/lib/middleman-core/renderers/asciidoc.rb b/middleman-core/lib/middleman-core/renderers/asciidoc.rb deleted file mode 100644 index 877d4f8f..00000000 --- a/middleman-core/lib/middleman-core/renderers/asciidoc.rb +++ /dev/null @@ -1,56 +0,0 @@ -require 'asciidoctor' - -module Middleman - module Renderers - module AsciiDoc - class << self - - def registered(app) - app.config.define_setting :asciidoc, { - :safe => :safe, - :backend => :html5, - :attributes => %W(showtitle env=middleman env-middleman middleman-version=#{::Middleman::VERSION}) - }, 'AsciiDoc engine options (Hash)' - app.config.define_setting :asciidoc_attributes, [], 'AsciiDoc custom attributes (Array)' - - app.after_configuration do - # QUESTION should base_dir be equal to docdir instead? - config[:asciidoc][:base_dir] = source_dir - config[:asciidoc][:attributes].concat(config[:asciidoc_attributes] || []) - config[:asciidoc][:attributes] << %(imagesdir=#{File.join((config[:http_prefix] || '/').chomp('/'), config[:images_dir])}) - sitemap.provides_metadata(/\.adoc$/) do |path| - # read the AsciiDoc header only to set page options and data - # header values can be accessed via app.data.page. in the layout - doc = Asciidoctor.load_file path, :safe => :safe, :parse_header_only => true - - opts = {} - if doc.attr? 'page-layout' - case (layout = (doc.attr 'page-layout')) - when '', 'false' - opts[:layout] = false - else - opts[:layout] = layout - end - end - opts[:layout_engine] = (doc.attr 'page-layout-engine') if (doc.attr? 'page-layout-engine') - # TODO override attributes to set docfile, docdir, docname, etc - # alternative is to set :renderer_options, which get merged into options by the rendering extension - #opts[:attributes] = config[:asciidoc][:attributes].dup - #opts[:attributes].concat %W(docfile=#{path} docdir=#{File.dirname path} docname=#{(File.basename path).sub(/\.adoc$/, '')}) - - page = {} - page[:title] = doc.doctitle - page[:date] = (doc.attr 'date') unless (doc.attr 'date').nil? - # TODO grab all the author information - page[:author] = (doc.attr 'author') unless (doc.attr 'author').nil? - - { :options => opts, :locals => { :asciidoc => page } } - end - end - end - - alias :included :registered - end - end - end -end