Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
1 post
|
Hi,
we're new to Asciidoctor (really new - we've started playing around with it a week ago after I finally convinced those in charge that a GUI text processor is the wrong tool for writing complex technical documentation). Our primary target format is PDF, although I welcome that Asciidoctor will allow us to also produce HTML documentation. The one major feature we need, and which apparently doesn't work out of the box with PDF output, is using custom styles for individual words, instead of * and _. For example, we would like to mark a word as a variable name, and then separately define how variable names should be styled. According to the documentation, that works via role attributes in HTML, but from what I've been able to find out, it doesn't carry over to the PDF output (and at least with asciidoctor-pdf, which we are currently, using, I've confirmed that). After browsing this forum for a while, it seems to be that a clean solution to this would be an inline macro, e.g.: style:myVariableName[variable] I've managed to create a simple inline macro with Java that simply outputs the input text without special processing (or just simple string replacements), but I can't seem to find out how I could further modify the output e.g. by assigning a style to the text (bold and italic would do for starters). Am I on the right track to begin with? Any pointers? Thx, Marian. |
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
2681 posts
|
For inline roles, such as a variable name, I tend to just recommend using a role. [.var]#variable name# Then you can style it using CSS. I've filed an issue to add theming support for this type of element in Asciidoctor PDF (mapping a role to style information like CSS): > I've managed to create a simple inline macro with Java that simply outputs the input text without special processing (or just simple string replacements), but I can't seem to find out how I could further modify the output e.g. by assigning a style to the text (bold and italic would do for starters). If you take this route, you'll want to return an inline node, which then maps to a node type. For instance, to make bold text, you'd use: (create_inline parent, :quoted, text, type: :strong).convert You can see other examples of inline nodes in https://github.com/asciidoctor/asciidoctor/blob/master/lib/asciidoctor/substitutors.rb (search for Inline.new) On the Java side, you'd use the createInline method (see https://oss.sonatype.org/service/local/repositories/releases/archive/org/asciidoctor/asciidoctorj/1.5.3.2/asciidoctorj-1.5.3.2-javadoc.jar/!/index.html). Cheers, -Dan On Mon, Oct 5, 2015 at 9:40 AM, Marian Schedenig [via Asciidoctor :: Discussion] <[hidden email]> wrote: Hi, ... [show rest of quote] Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen |
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
2681 posts
|
In reply to this post by Marian Schedenig
On Wed, Dec 9, 2015 at 3:42 PM, Dan Allen <[hidden email]> wrote: you'll want to return an inline node actually, you'll return a converted inline node (which is a string). In the future, you'll return the node itself. You could just return an HTML string too. |
Free forum by Nabble | Edit this page |