Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for walking table components in Lua filters #9877

Open
jeffvalk opened this issue Jun 13, 2024 · 4 comments
Open

Support for walking table components in Lua filters #9877

jeffvalk opened this issue Jun 13, 2024 · 4 comments

Comments

@jeffvalk
Copy link

Currently, components of tables (Cell, Row, TableBody, etc) cannot be used in element filters. The distinction between a typed Pandoc object and an "element component" isn't entirely clear from the Lua filter manual, so I was initially confused when filter functions for Cell did not run.

Making table components behave consistently with other elements was mentioned in #7718 (comment). This would be an excellent enhancement. Almost all current "element components" relate to tables. It would be great to have these be first-class citizens in the object model.

@jgm
Copy link
Owner

jgm commented Jun 13, 2024

@tarleb thoughts?

@tarleb
Copy link
Collaborator

tarleb commented Jun 14, 2024

One unclear point: how do we include that in the classical filters, where element processing is grouped by type (Inline -> Block -> Meta -> Pandoc). Maybe insert an "other" type somewhere in there.

@jeffvalk
Copy link
Author

The super simple take is that Table is a block element, so its structural components are too.

With a bit more nuance: if the primary difference between blocks and inlines is that inlines can only contain other inline content, whereas blocks can contain either block or inline content (as the API doc implies), then:

  • Cell, Row, TableHead, TableBody, and TableFoot would be block elements
  • Caption would be an inline element
  • ColSpec doesn't fit in neatly, but describes the table so should probably run with it (as a block element)

An "other" type is certainly possible. Would it offer any benefit?

@tarleb
Copy link
Collaborator

tarleb commented Sep 4, 2024

I took a stab at that but was dissatisfied with the added complexity when doing this in Haskell. But I wrote a Lua library that can do that (and a few other things): jog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants