Search code examples
asciidoc

Reuse table parameters


in my document I have 2 different kinds of tables. Each of these is formated differently.

[frame="none", grid = "none", stripes=none]
[frame="topbot", grid = "rows", options="header"]

Width und cols I want to define for each table individually. Is there a way to define there format beforehand and just refer to this definitions?


Solution

  • Yes, you can use an attribute to define table parameters:

    = Document
    
    Lorem ipsum...
    
    :table1: frame="none", grid = "none", stripes=none
    :table2: frame="topbot", grid = "rows", options="header"
    
    [{table1}, cols="a,a"]
    |===
    | A
    | B
    
    | A
    | B
    
    | A
    | B
    |===
    
    [{table2}, cols="a,a,a"]
    |===
    | A
    | B
    | C
    
    | A
    | B
    | C
    
    | A
    | B
    | C
    |===
    

    That should look like: enter image description here