bpj / pandoc-list-table

Pandoc filter which converts lists-of-lists <--> tables
Other
15 stars 0 forks source link

Preserve attributes #4

Closed not-my-profile closed 2 years ago

not-my-profile commented 2 years ago
::: {.lol2table #some-id .some-class lang=en}

A table of stuff.

-   -   foo
    -   bar
    -   baz
-   -   -   tic
        -   pic
    -   -   tac
        -   pac
    -   -   toc
        -   poc
:::

currently produces <table>...</table>. I would expect it to produce:

<table id="some-id" class="some-class" lang="en">...</table>

(sometimes you want/need to add attributes directly to the table as opposed to a wrapping div)

not-my-profile commented 2 years ago

Closing this, since I no longer need it. (I have since implemented my own lua filter).

bpj commented 2 years ago

As you probably have discovered the formatting of HTML tables is done by Pandoc. This filter just creates a Pandoc table object which it returns to Pandoc.

not-my-profile commented 2 years ago

Yeah ... I meant that the attributes set on the div could be passed onto the generated table.

bpj commented 2 years ago

They can't because Pandoc table objects don't take attributes. The attributes on arbitrary elements in Common Mark are translated into divs and spans in the AST.

not-my-profile commented 2 years ago

Pandoc tables do take attributes.

bpj commented 2 years ago

OK I didn't know that but I wouldn't touch the Table as opposed to SimpleTable object. It's insanely complex for little benefit. What people wanted was colspan and rowspan. That could have been implemented without such a freak object. Moreover an LoL is a perfect fit for a SimpleTable. CSS is no problem since you can always use a child selector.

Den tors 23 dec. 2021 21:18Martin Fischer @.***> skrev:

Pandoc tables do take attributes https://pandoc.org/lua-filters.html#type-table.

— Reply to this email directly, view it on GitHub https://github.com/bpj/pandoc-list-table/issues/4#issuecomment-1000506781, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI3OU2BZG4H3SK4WX7EJALUSN7XBANCNFSM5KO43P7A . You are receiving this because you commented.Message ID: @.***>