Embed asciidoc into Haml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Embed asciidoc into Haml

fleurystephane
Hello!

I'd like to insert asciidoc into haml file, and more exactly give awestruct object value to asciidoc file.

.For example
---
.span6
  :asciidoc
    :basurl: #{site.base_url}
---

But, I get an error  :
asciidoctor: WARNING: include file has illegal reference to ancestor of jail, auto-recovering
ERROR: Failed to render: /sav/syntheseBatchs.adoc
StandardError: ERROR: Failed to render: /_layouts/base.html.haml at line 17
Haml::Error: Filter "asciidoc" is not defined.
C:/Progra~1/Developpements/jruby-bin-1.7.4/jruby-1.7.4/lib/ruby/gems/shared/gems/haml-4.0.3/lib/haml/compiler.rb:270:in `compile_filter'


How adding asciidoc filter in haml ?

Thanks
Stéphane
Reply | Threaded
Open this post in threaded view
|

Re: Embed asciidoc into Haml

LightGuardjp
Which version of haml, and do you have the haml-compat gem if you're using haml4?

Most of the filters for other gems are in the compat gem. I believe there's one for Asciidoctor is there, but I'm not 100% sure. 

I know you can do this in slim without any extra gems. 

Sent from my iPhone

On Oct 3, 2013, at 7:43, "fleurystephane [via Asciidoctor :: Discussion]" <[hidden email]> wrote:

Hello!

I'd like to insert asciidoc into haml file, and more exactly give awestruct object value to asciidoc file.

.For example
---
.span6
  :asciidoc
    :basurl: #{site.base_url}
---

But, I get an error  :
asciidoctor: WARNING: include file has illegal reference to ancestor of jail, auto-recovering
ERROR: Failed to render: /sav/syntheseBatchs.adoc
StandardError: ERROR: Failed to render: /_layouts/base.html.haml at line 17
Haml::Error: Filter "asciidoc" is not defined.
C:/Progra~1/Developpements/jruby-bin-1.7.4/jruby-1.7.4/lib/ruby/gems/shared/gems/haml-4.0.3/lib/haml/compiler.rb:270:in `compile_filter'


How adding asciidoc filter in haml ?

Thanks
Stéphane


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Embed-asciidoc-into-Haml-tp683.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: Embed asciidoc into Haml

fleurystephane
Thanks for your answer.

But I use haml4.0.3 (in my gem list)
What is haml-compat ? (not found in gems repository)
Reply | Threaded
Open this post in threaded view
|

Re: Embed asciidoc into Haml

LightGuardjp
Sorry, my bad, it's haml-contrib and it isn't in there: https://github.com/haml/haml-contrib/pull/4. You'd have to do the same thing Dan did in that pull request in your awestruct code. You could create a ruby file with the lines in https://github.com/mojavelinux/haml-contrib/blob/edd0cc1dc32fc05972052380bd6cb5197c0f2dbf/lib/haml/filters/asciidoc.rb and require that file at the top of the _ext/pipeline.rb.


On Thu, Oct 3, 2013 at 1:42 PM, fleurystephane [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Thanks for your answer.

But I use haml4.0.3 (in my gem list)
What is haml-compat ? (not found in gems repository)


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Embed-asciidoc-into-Haml-tp683p687.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Embed asciidoc into Haml

fleurystephane
Thanks again!

Sorry, but I'm a newbie with Ruby and I'm not able to do what you advice me.

Do I have to download zip haml-contrib-asciidoc-filter from github in my ...jruby-1.7.4\lib\ruby\gems\shared\gems directory ?
And where do I save the asciidoc.rb and how to require it ?

My pipeline.rb with the required file...? :
------------
require 'bootstrap-sass'
require 'asciidoc'

Awestruct::Extensions::Pipeline.new do
  # extension Awestruct::Extensions::Posts.new '/news'
  # extension Awestruct::Extensions::Indexifier.new
  # Indexifier *must* come before Atomizer
  # extension Awestruct::Extensions::Atomizer.new :posts, '/feed.atom'
end
-----------

Thank you for helping me
Stéphane
Reply | Threaded
Open this post in threaded view
|

Re: Embed asciidoc into Haml

mojavelinux
Administrator
In reply to this post by LightGuardjp
Jason nailed it. Haml is migrating filters for markup languages like Textile, AsciiDoc and Markdown to a separate gem, ambiguously named haml-contrib.

I'm a bit frustrated with the Haml project. I first submitted a pull request for an AsciiDoc filter at the beginning of the year. That pull request was rejected with a request to resubmit the change to the haml-contrib project. I appealed for them to reconsider since adding an extra dependency introduces unnecessary complexity. I got no response to my post [1]. After I while, I accepted it was a hopeless argument and sent a pull request to haml-contrib as requested [2]. That pull request has been sitting there for over 3 months. There's no indication from the developers when its going to be merged.

If we don't see any life from the Haml project, I think we should consider putting the filter into Awestruct so that it can be activated with a simple 'require' statement in _ext/pipeline.rb.

If you are open to alternatives, this is one of several reasons why I strongly recommend Slim over Haml. Slim accepted the AsciiDoc filter almost immediately and you can start using it immediately. Slim is also much more concise than Haml. He're an example:

[source,slim]
----
.span6
  asciidoc:
    I'm writin' me some *AsciiDoc*!
----

NOTE: The colon goes at the end of the filter name in Slim.

You can also render inline AsciiDoc in either Haml or Slim as so:

[source,slim]
----
.span6
  p Here's a paragraph with #{Asciidoctor.render '*strong*', :doctype => :inline} text.
----

Hope that helps!

-Dan




On Thu, Oct 3, 2013 at 4:00 PM, LightGuardjp [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Sorry, my bad, it's haml-contrib and it isn't in there: https://github.com/haml/haml-contrib/pull/4. You'd have to do the same thing Dan did in that pull request in your awestruct code. You could create a ruby file with the lines in https://github.com/mojavelinux/haml-contrib/blob/edd0cc1dc32fc05972052380bd6cb5197c0f2dbf/lib/haml/filters/asciidoc.rb and require that file at the top of the _ext/pipeline.rb.


On Thu, Oct 3, 2013 at 1:42 PM, fleurystephane [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Thanks for your answer.

But I use haml4.0.3 (in my gem list)
What is haml-compat ? (not found in gems repository)


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Embed-asciidoc-into-Haml-tp683p687.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Embed-asciidoc-into-Haml-tp683p688.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Embed asciidoc into Haml

mojavelinux
Administrator
In reply to this post by fleurystephane
Stéphane,

I'll send instructions shortly.

-Dan


On Fri, Oct 4, 2013 at 1:06 AM, fleurystephane [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Thanks again!

Sorry, but I'm a newbie with Ruby and I'm not able to do what you advice me.

Do I have to download zip haml-contrib-asciidoc-filter from github in my ...jruby-1.7.4\lib\ruby\gems\shared\gems directory ?
And where do I save the asciidoc.rb and how to require it ?

My pipeline.rb with the required file...? :
------------
require 'bootstrap-sass'
require 'asciidoc'

Awestruct::Extensions::Pipeline.new do
  # extension Awestruct::Extensions::Posts.new '/news'
  # extension Awestruct::Extensions::Indexifier.new
  # Indexifier *must* come before Atomizer
  # extension Awestruct::Extensions::Atomizer.new :posts, '/feed.atom'
end
-----------

Thank you for helping me
Stéphane


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Embed-asciidoc-into-Haml-tp683p690.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Embed asciidoc into Haml

mojavelinux
Administrator
In reply to this post by fleurystephane
Here are the instructions for registering the AsciiDoc filter in Haml.


-Dan


On Fri, Oct 4, 2013 at 1:15 AM, Dan Allen <[hidden email]> wrote:
Stéphane,

I'll send instructions shortly.

-Dan


On Fri, Oct 4, 2013 at 1:06 AM, fleurystephane [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Thanks again!

Sorry, but I'm a newbie with Ruby and I'm not able to do what you advice me.

Do I have to download zip haml-contrib-asciidoc-filter from github in my ...jruby-1.7.4\lib\ruby\gems\shared\gems directory ?
And where do I save the asciidoc.rb and how to require it ?

My pipeline.rb with the required file...? :
------------
require 'bootstrap-sass'
require 'asciidoc'

Awestruct::Extensions::Pipeline.new do
  # extension Awestruct::Extensions::Posts.new '/news'
  # extension Awestruct::Extensions::Indexifier.new
  # Indexifier *must* come before Atomizer
  # extension Awestruct::Extensions::Atomizer.new :posts, '/feed.atom'
end
-----------

Thank you for helping me
Stéphane


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Embed-asciidoc-into-Haml-tp683p690.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML






--
Reply | Threaded
Open this post in threaded view
|

Re: Embed asciidoc into Haml

fleurystephane
Excellent!!
It works great!

Thank you for helping!

Stéphane