+ """
+
+ Scenario: Linking to an image
+ Given the Server is running at "asciidoc-app"
+ When I go to "/gallery.html"
+ Then I should see:
+ """
+
+
+
+
+ """
+
+ 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
new file mode 100644
index 00000000..e69de29b
diff --git a/middleman-core/fixtures/asciidoc-app/source/_include.adoc b/middleman-core/fixtures/asciidoc-app/source/_include.adoc
new file mode 100644
index 00000000..b0cdec38
--- /dev/null
+++ b/middleman-core/fixtures/asciidoc-app/source/_include.adoc
@@ -0,0 +1 @@
+I'm included content.
diff --git a/middleman-core/fixtures/asciidoc-app/source/code.adoc b/middleman-core/fixtures/asciidoc-app/source/code.adoc
new file mode 100644
index 00000000..e0d6a519
--- /dev/null
+++ b/middleman-core/fixtures/asciidoc-app/source/code.adoc
@@ -0,0 +1,3 @@
+```ruby
+puts "Is this mic on?"
+```
diff --git a/middleman-core/fixtures/asciidoc-app/source/custom-attribute.adoc b/middleman-core/fixtures/asciidoc-app/source/custom-attribute.adoc
new file mode 100644
index 00000000..b4eb729d
--- /dev/null
+++ b/middleman-core/fixtures/asciidoc-app/source/custom-attribute.adoc
@@ -0,0 +1,3 @@
+++++
+{foo}
+++++
diff --git a/middleman-core/fixtures/asciidoc-app/source/gallery.adoc b/middleman-core/fixtures/asciidoc-app/source/gallery.adoc
new file mode 100644
index 00000000..4a9f37f1
--- /dev/null
+++ b/middleman-core/fixtures/asciidoc-app/source/gallery.adoc
@@ -0,0 +1 @@
+image::tiger.gif[]
diff --git a/middleman-core/fixtures/asciidoc-app/source/hello-no-layout.adoc b/middleman-core/fixtures/asciidoc-app/source/hello-no-layout.adoc
new file mode 100644
index 00000000..8156a16f
--- /dev/null
+++ b/middleman-core/fixtures/asciidoc-app/source/hello-no-layout.adoc
@@ -0,0 +1,2 @@
+:page-layout: false
+Hello, AsciiDoc!
diff --git a/middleman-core/fixtures/asciidoc-app/source/hello-with-front-matter.adoc b/middleman-core/fixtures/asciidoc-app/source/hello-with-front-matter.adoc
new file mode 100644
index 00000000..5e1f91a3
--- /dev/null
+++ b/middleman-core/fixtures/asciidoc-app/source/hello-with-front-matter.adoc
@@ -0,0 +1,5 @@
+---
+title: Page Title
+layout: default
+---
+Hello, AsciiDoc!
diff --git a/middleman-core/fixtures/asciidoc-app/source/hello-with-layout.adoc b/middleman-core/fixtures/asciidoc-app/source/hello-with-layout.adoc
new file mode 100644
index 00000000..763ba8c1
--- /dev/null
+++ b/middleman-core/fixtures/asciidoc-app/source/hello-with-layout.adoc
@@ -0,0 +1,2 @@
+:page-layout: default
+Hello, AsciiDoc!
diff --git a/middleman-core/fixtures/asciidoc-app/source/hello-with-title.adoc b/middleman-core/fixtures/asciidoc-app/source/hello-with-title.adoc
new file mode 100644
index 00000000..e2c7673b
--- /dev/null
+++ b/middleman-core/fixtures/asciidoc-app/source/hello-with-title.adoc
@@ -0,0 +1,4 @@
+= Page Title
+:page-layout: default
+
+Hello, AsciiDoc!
diff --git a/middleman-core/fixtures/asciidoc-app/source/hello.adoc b/middleman-core/fixtures/asciidoc-app/source/hello.adoc
new file mode 100755
index 00000000..6c1ab072
--- /dev/null
+++ b/middleman-core/fixtures/asciidoc-app/source/hello.adoc
@@ -0,0 +1,4 @@
+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
new file mode 100755
index 00000000..2498f1aa
Binary files /dev/null and b/middleman-core/fixtures/asciidoc-app/source/images/tiger.gif differ
diff --git a/middleman-core/fixtures/asciidoc-app/source/layouts/default.erb b/middleman-core/fixtures/asciidoc-app/source/layouts/default.erb
new file mode 100644
index 00000000..ec05c79c
--- /dev/null
+++ b/middleman-core/fixtures/asciidoc-app/source/layouts/default.erb
@@ -0,0 +1,10 @@
+
+
+
+
<%= data.page.title || 'Fallback' %>
+
+
+<%= yield %>
+
+
+
diff --git a/middleman-core/fixtures/asciidoc-app/source/master.adoc b/middleman-core/fixtures/asciidoc-app/source/master.adoc
new file mode 100644
index 00000000..1b789b44
--- /dev/null
+++ b/middleman-core/fixtures/asciidoc-app/source/master.adoc
@@ -0,0 +1,3 @@
+....
+include::_include.adoc[]
+....
diff --git a/middleman-core/lib/middleman-core/renderers/asciidoc.rb b/middleman-core/lib/middleman-core/renderers/asciidoc.rb
index 611b05ab..6e89df16 100644
--- a/middleman-core/lib/middleman-core/renderers/asciidoc.rb
+++ b/middleman-core/lib/middleman-core/renderers/asciidoc.rb
@@ -18,16 +18,23 @@ module Middleman
app.after_configuration do
# QUESTION should base_dir be equal to docdir instead?
- config[:asciidoc][:base_dir] = File.expand_path config[:source]
- config[:asciidoc][:attributes].concat (config[:asciidoc_attributes] || [])
- config[:asciidoc][:attributes] << %(imagesdir=#{File.join (config[:http_prefix] || '/').chomp('/'), config[:images_dir]})
+ 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 = {}
- opts[:layout] = (doc.attr 'page-layout') if (doc.attr? 'page-layout')
+ 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