Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
I have a fork of the Project Gutenberg copy of Rime of the Ancient Mariner.
The format is a simple text file of the poem. I've been looking around at markup formats, and I really like asciidoc. So I'm porting *Rime* to asciidoc. With a couple of hours of doc reading, I was able to make a really great looking rendered html copy of the poem. The source is on github automatically rendered into also pretty nice looking html. I'm looking for some advice about how to correctly tag for verse in asciidoc. The book is broken into 7 sections with `== PART THE NTH`. Then I wrap the internal text with: [verse] ____ ... text ____ Does this sound like the right semantic markup? Separate question, how should I extend verse block rendering to: - wrap each line with a span.line - wrap each paragraph break with p.stanza My understanding is I should probably make a new backend (template?) like this erb html verse parser from asciidoctor-backends? --Seth |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
I prefer this solution:
[verse] -- <TEXT OF POEM> -- Of course if there is a complicated format, this won't work. But the idea is to define [verse] so that "inside" it you do not have to do anything. See, for example, http://www.noteshare.io/notebook/90/?note=592 |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
Any of these are equally correct: [source,asciidoc] ---- [verse] ____ <TEXT OF POEM> ____ ---- [source,asciidoc] ---- [verse] "" <TEXT OF POEM> "" ---- or [source,asciidoc] ---- [verse] -- <TEXT OF POEM> -- ---- As you suggested, the most convenient way to custom the output is to supply a custom template. I much prefer haml or slim over erb because it's more human readable. Here's an example of how you would accomplish your two goals. First, create the file verse.html.slim: .verse.html.slim [source,slim] ---- .verseblock id=@id class=role - if title? .title=title pre.content =content.gsub(/^.+$/, '<span>\0</span>').gsub(/(.+?)(?:\n\n|\Z)/m, %(\n<p class="stanza">\\1</p>)) - attribution = (attr? :attribution) ? (attr :attribution) : nil - citetitle = (attr? :citetitle) ? (attr :citetitle) : nil - if attribution || citetitle .attribution - if citetitle cite=citetitle - if attribution - if citetitle br | — #{attribution} ---- The key line is the one containing the gsub calls. The first gsub wraps a <span> around any non-blank line. The second gsub wraps a <p class="stanza"> around contiguous lines (i.e., lines in a single stanza). Put the file verse.html.slim in a folder named templates (or whatever you want to call it), then invoke Asciidoctor as: $ asciidoctor -T templates rime.adoc Make sure you the slim, tilt and, optionally, thread_safe gems: $ gem install slim tilt thread_safe Good luck! -Dan On Fri, Sep 19, 2014 at 10:25 PM, jxxcarlson [via Asciidoctor :: Discussion] <[hidden email]> wrote: I prefer this solution: ... [show rest of quote] Dan Allen | http://google.com/profiles/dan.j.allen |
Free forum by Nabble | Edit this page |