Unordered list in a table cell with Asciidoc - asciidoc

I am trying to have a (simple) unordered list in a table cell in an Asciidoc document. I use asciidoctor.
I tried the following:
|===
| One | Two
| Foo
|
- Bar
- Baz
|===
But this results in the last cell having simply the text - Bar - Baz as a simple string, no list formatting. I would like it to be formatted as a list, on two lines, with a bullet on each line. Any idea?

The default style of a table cell accepts only inline markup. To insert block elements you could change the cell style to "AsciiDoc". See this document for details.
For example:
|===
| One | Two
| Foo
a|
- Bar
- Baz
|===
Word of caution: The contents of the cell is treated as a separate AsciiDoc document, so certain markup (such as footnotes) behave badly as they no longer belong to the main document.

Related

Change text size of table in Asciidoc

How to change the font size of a specific table in Asciidoc (PDF)?
I already tried a custom role:
role:
small:
font-size: 10
Table:
[.small]
[options="header"]
|===
|Vielfachheit |Feldname |Beschreibung |XML-Tag
|1 |Einzelsicht | |view (Tag)
|===
But it didn't change anything.
EDIT:
Looks like this isn't possible according to a similar question: Is there any way to change the text size (font size) of specific blocks when you using asciidoc?
Your solution does work when converting to html but not when converting to pdf. It is currently not possible to set a custom roles to a table with with PDF styling, see https://docs.asciidoctor.org/pdf-converter/latest/theme/custom-role/
Custom roles only apply to paragraphs and inline phrases.
The solution you have is to set the role directly to the text:
[options="header"]
|===
|[.small]#Vielfachheit# |Feldname |Beschreibung |XML-Tag
|1 |[.small]#Einzelsicht# | |view (Tag)
|===
Obvisouly the readability is not good but it does work and you do that for only a few cells this might be ok.
Note: I do not know why you want to change the font size for one single table but if you want to highlight it differently than the rest you could also put it inside an example block or a sidebar

Can I change the styling of the code box in a markdown file with scss?

I am trying to find out if I can effect the code box inside of a mark down document with scss?
I am working on a jekyll project and I am using markdown for my posts. Id like to edit the styling of the code box inside of the .md but cant seem to figure it out.
Is this possible?
Found the answer Here
Kramdown treats each new line as a row and doesn't render Markdown bullet lists inside table cells, and instead of rendering HTML, it is escaped and outputted as a single line of text.
You can tell Kramdown to leave the HTML alone and output as is, with the nomarkdown extension. Just wrap the HTML code with {::nomarkdown} ... {:/}
| Name | Value |
|------|-----------------------------------------|
| one | {::nomarkdown}<i>foo</i>{:/} |
| two | {::nomarkdown}<ul><li>bar</li></ul>{:/} |

How to use multi specifiers to format column in asciidoc

In AsciiDoc manual 23.2. Column Formatting, it says:
To apply a specifier to a column, you must set the cols attribute and assign it a value. A column specifier can contain any of the following components:
multiplier
align
width
style
Each component is optional.
But I didn't find an example that uses multi specifiers.
For example, I want to use both width and style specifiers in the below table.
[cols="h,a,a",options="header"]
|===
| | compare times | move times
| 1 | n-1 | 2n-2
| 2 | (n-1)(n+4)/4 | (n-1)(n+8)/4
| 3 | (n-1)(n+2)/2 | (n-1)(n+4)/2
|===
Since the first column contains few text, so I want to add the attribute [cols="1,4,4"] to it.
I don't know how to implement that, could somebody help me?
The section of the Asciidoctor documentation that you linked to does include multiple examples of composite column formatting specifiers, including relative widths, centering, left/right alignment, vertical alignment, and styles.
For your table, your cols specification should be:
[cols="1h,4a,4a", options="header"]

How to create numbered lists in (#) style with Sphinx

The RST documentation quoted by Sphinx as "The authoritative reStructuredText User Documentation" (see here) shows several styles for the formatting of numbered lists, among them the parenthesized style (see here):
(1) foo
(2) bla
However, Sphinx generates a style with dots from such RST source:
1. foo
2. bla
The Sphinx documentation only shows that dotted style (see here).
My question is: Is there any way to make Sphinx create the parenthesized style for the numbers?
* This is a bulleted list.
* It has two items, the second
item uses two lines.
1. This is a numbered list.
2. It has two items too.
#. This is a numbered list.
#. It has two items too.
See reStructuredText Primer in Sphinx documentation site.

MarionetteJS - Multiple nested side by side views

I am looking at the example here http://davidsulc.github.io/backbone.marionette-nested-views/ it shows how you can create a list a superheroes and for each hero have an inner list of villains.
How would one extend this to not only list villains for each hero, but also their top three favorite colors? for example.
So I could have something like
Batman
-----------------------------------
Bane | Black
Ra's Al Ghul | Blue
The Joker | Orange
The Riddler |
===================================
Spiderman
-----------------------------------
Green Goblin | Red
Venom | Green
| Violet
===================================
Wonder Woman
-----------------------------------
Ares | Silver
Doctor Psycho | Purple
Silver Swan | White
===================================
In the composite view it is as if I need two sets of itemviews and itemcomtainers, something like
HeroView = Backbone.Marionette.CompositeView.extend({
template: "#accordion-group-template",
className: "accordion-group",
itemView: VillainView,
itemViewContainer: "#villainUL",
itemView2: FavoriteColorView,
itemViewContainer2: "#colorUL",
...
But of course such a thing doesn't exist.
Edit: this http://jsfiddle.net/derickbailey/AdWjU/ will probably serve as a solution, but I will have to wait until the morning to adapt it.
First of all, hopefully you're aware of the blog post I wrote to go with the code: http://davidsulc.com/blog/2013/02/03/tutorial-nested-views-using-backbone-marionettes-compositeview/
Bad news: I think you'll actually need more work to achieve what you want...
The jsFiddle you linked (http://jsfiddle.net/derickbailey/AdWjU/) displays a list of element that are sub-elements. What you want to do is display two separate lists!
Here's what I'd try: you need to replace the VillainView (which is an ItemView) with a layout which we'll call HeroInfo, in this layout you need to declare 2 regions (one for the villain list, the other for the colors). This new layout also won't be rendered within a ul so you can remove the itemViewContainer from the view definition and the template.
Note you might not be able to specify the layout regions as an object (you can't use ids in the template since they'll be repeated, and you might not yet have access to this.$el). If that's the case, you need to initialize them with something like this:
initialize: function(){
// assuming you have an element with class "js-villain-region" in your layout template
this.addRegion("villainRegion", this.$el.find(".js-villain-region").first());
}
Next, you need to define a VillainView and a ColorView (both are collection views) to be displayed in the layout's regions on the "show" event (see example code using a layout here: https://github.com/davidsulc/marionette-gentle-introduction/blob/master/assets/js/apps/contacts/list/list_controller.js#L43
I hope this helps to set you on the right path!
Also, as a side note: this seems to be more challenging than it looks at first glance. If you're doing this as a learning experience, don't get discouraged: you're attempting a challenging, complex view implementation, which will be tricky when first getting into Marionette.

Resources