On Sat, Jul 11, 2015 at 10:54 AM, russurquhart1 <[email protected]>
wrote:
> Hi Dan,
>
> On Saturday, July 11, 2015 at 12:03:29 AM UTC-5, Dan Allen wrote:
>>
>>
>>
>> Something like:
>>
>> * shared item
>> * [if-windows]#do for Windows#
>> * shared item
>>
>> or
>>
>> * shared item
>> * {empty}
>> +
>> [.if-windows]
>> --
>> do for Windows
>> --
>> * shared item
>>
>
> that kind of works, but not really in the way i was wanting. I was wanting
> the role to be set for the listitem element. This sets it for the phrase
> within the simpara element:
>
> <listitem>
> <simpara><phrase role="windows">Windows only item</phrase></simpara>
> </listitem>
>
Yep, that's what I meant about doing some XSL magic in the postprocessing.
You'd look for a single phrase child element with the role "if-..." and
then filter out the whole listitem. It's not ideal, just an idea.
>
>
> I was wanting to do something like the following be generated:
>
> <listitem role="windows">
> <simpara>Windows only item</simpara>
> </listitem>
>
That's not how the *default* output works atm. I agree that it would be
nice if a role could be applied per list item. This was missed in the
original design of AsciiDoc and perhaps something for UniDoc (AsciiDoc 2).
>
> I also looked at the .slim files for the docbook generation, is it because
> certain items have a role attribute explicitly checked and used that
> determines whether an element or not can have a role value set for it?
>
You can absolutely apply this logic yourself in the slim template. Here's a
rough sketch of how you might do that in this case:
Let's assume you have the following input:
* item
* [if-windows]#Windows only item#
* item
In the slim template you might do something like:
- items.each do |item|
- text = item.text
- if text.start_with?('[if-windows]#') && text.end_with?('#')
role = 'windows'
text = text.sub '[if-windows] ', ''
- else
role = nil
li class=role
p=text
- if item.blocks?
=item.content
Like I said, that's just a rough idea, but hopefully it gets you started.
Obviously, you'll want to use regexp to support any "if" condition.
>
>>
>>> as well as setting a role for a given row of a table?
>>
>>
>> You cannot apply attributes to rows in AsciiDoc. This is a harder problem
>> to solve. You'll likely need to use an AsciiDoc table cell and apply a role
>> to the block-level content in that cell. Again, another solution is to
>> simply repeat the whole table for each condition just like with lists.
>>
>
> For simple tables this is ok. However, in some of our documents it is not
> uncommon for a table to go across tens to a hundred pages in length.
> Repeating the table would probably not be good solution.
>
Adding a role to a table row is another missed requirement in AsciiDoc.
However, we can see that there's actually pretty clear room for it already.
|===
|Column A |Column B
[.row-role-a]
| A1
| B1
[.row-role-b]
| A2
| B2
|===
I'd certainly consider implementing this in Asciidoctor if you'd like to
file an issue. Until then, unfortunately, there isn't much of a workaround
that I can think of.
Cheers,
-Dan
--
Dan Allen | http://google.com/profiles/dan.j.allen
--
You received this message because you are subscribed to the Google Groups
"asciidoc" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/asciidoc.
For more options, visit https://groups.google.com/d/optout.