Making a custom para style work in HTML

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

Making a custom para style work in HTML

wolandscat

Asciidoctor 1.5.2 [http://asciidoctor.org]
Runtime Environment (ruby 2.0.0p576 (2014-09-19) [x86_64-cygwin]) (lc:UTF-8 fs:Windows-1252 in:- ex:UTF-8)

I've scanned a lot of documentation on this question, but what the asciidoctor processor does doesn't seem to quite match what I read....

What I want is to have a paragraph style 'rule', that will be indented and blue (or think up any typical visual/font mods).

So in the Asciidoc source I have:

[.rule]
*VTVSID* value-set id defined sss ddd fff.

I had thought it should just be [rule] but that doesn't work.

What I expected to get was 'class=rule' in the generated <p> tag. What I get is this:

<div class="paragraph rule"><p>....</p></div>

I created a custom css and added the following to it:

div.paragraph.rule {text-indent:1.25em;color:blue;font-family:"Open Sans"}

This does do something in the HTML output, but it's not quite right.

Questions:
* why is the generated class name "paragraph rule" and not just "rule"?
* I would normally expect to just define p.rule {} in the CSS - I picked up the div.paragraph.rule thing from the asciidoctor documentation.
* why is the class put on an enclosing <div>, not just on the <p>?
* I also want to generate PDF - is the [.rule] directive in the adoc source correct for that as well?

Sorry if this is too basic. I don't normally hack CSS source and am very new to Asciidoctor.
 
Reply | Threaded
Open this post in threaded view
|

Re: Making a custom para style work in HTML

mojavelinux
Administrator
For now, you'll have to define your CSS rule as:

.paragraph.rule > p {
  text-indent: 1.25em;
  color: blue;
  font-family: "Open Sans";
}

(an alternative is to modify the templates for the HTML backend so that Asciidoctor only emits a <p> element).

Asciidoctor outputs paragraphs using this structure to accommodate a paragraph style (and, historically, to be consistent with AsciiDoc Python output). There's an open issue to simplify it.


Cheers,

-Dan

On Fri, Jun 19, 2015 at 4:42 AM, wolandscat [via Asciidoctor :: Discussion] <[hidden email]> wrote:

Asciidoctor 1.5.2 [http://asciidoctor.org]
Runtime Environment (ruby 2.0.0p576 (2014-09-19) [x86_64-cygwin]) (lc:UTF-8 fs:Windows-1252 in:- ex:UTF-8)

I've scanned a lot of documentation on this question, but what the asciidoctor processor does doesn't seem to quite match what I read....

What I want is to have a paragraph style 'rule', that will be indented and blue (or think up any typical visual/font mods).

So in the Asciidoc source I have:

[.rule]
*VTVSID* value-set id defined sss ddd fff.

I had thought it should just be [rule] but that doesn't work.

What I expected to get was 'class=rule' in the generated <p> tag. What I get is this:

<div class="paragraph rule"><p>....</p></div>

I created a custom css and added the following to it:

div.paragraph.rule {text-indent:1.25em;color:blue;font-family:"Open Sans"}

This does do something in the HTML output, but it's not quite right.

Questions:
* why is the generated class name "paragraph rule" and not just "rule"?
* I would normally expect to just define p.rule {} in the CSS - I picked up the div.paragraph.rule thing from the asciidoctor documentation.
* why is the class put on an enclosing <div>, not just on the <p>?
* I also want to generate PDF - is the [.rule] directive in the adoc source correct for that as well?

Sorry if this is too basic. I don't normally hack CSS source and am very new to Asciidoctor.
 


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Making-a-custom-para-style-work-in-HTML-tp3416.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--