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

[WIP] Add colspan/rowspan support #3508

Closed
wants to merge 3 commits into from
Closed

Conversation

roblabla
Copy link
Contributor

@roblabla roblabla commented Mar 14, 2017

Fixes #1024

Dependant on jgm/pandoc-types#29

I needed this for one of my projects, so I went ahead and built it. This adds colspan/rowspan to the AST, and adds support for it in MediaWiki reader/writer.

My next goal is to add support to the markdown grid layout now, similar to reStructuredText's grid layouts.

I'm very new to haskell, so there's probably a better way to do things :).

This is a breaking change.

@jgm
Copy link
Owner

jgm commented Mar 14, 2017

You also need changes to pandoc-types, and one can't see from these PR what changes you made there. That would be interesting to see. It looks like you took a different approach than the proposal in #1024, so it would be good to know more about it as we decide how best to implement row/colspans.

The final decision on the AST may be different from what you're assuming here. Nonetheless, once it is made (and I'd like to do this for pandoc 2.0), I'd really welcome help fixing up parsers to work with it. (And any work you do now on grid tables will be relevant whatever happens with the AST.)

@roblabla
Copy link
Contributor Author

roblabla commented Mar 14, 2017 via email

@jgm
Copy link
Owner

jgm commented Mar 14, 2017

OK, that's an interesting approach, just adding two parameters that define col/rowspans for headers and rows. The advantage is that it makes the changes to the readers and writers more minimal. (To keep current behavior, one merely has to ignore the two extra parameters or pass them default values.) But, without taking that practical consideration into account, it seems less clean than an approach that builds this information into the cells themselves, as in the proposal floated in #1024:

type Rowspan = Int
type Colspan = Int
data Cell = Cell Rowspan Colspan [Block]
data Row = Row [Cell] | Header [[Cell]]
type Caption = [Block]
-- constructor for Table in Block:
   | Table Attr Caption [Alignment] [Maybe Double] [Row]

@roblabla
Copy link
Contributor Author

roblabla commented Mar 14, 2017

So I tried to do something like that at first and more or less failed due to my lack of knowledge in haskell (for instance, I had no idea how to adapt Walkable : https://github.com/jgm/pandoc-types/pull/29/files). Hence why the current approach was taken. This PR is more or less my only contact with haskell ^^'.

I'm also thinking of making an utility function for writers that don't support col/row-span that creates empty table cells instead. This should avoid situations like : http://wiki.vg/Protocol#Window_Property turning into http://prismarinejs.github.io/minecraft-data/?v=1.11.2&d=protocol#toClient_craft_progress_bar

@jgm
Copy link
Owner

jgm commented Mar 15, 2017 via email

@luke-sift
Copy link

I haven't got any experience with Haskell, but would like to add that this feature is very much needed. Thanks for your work on this so far.

@mb21
Copy link
Collaborator

mb21 commented May 5, 2017

@luke-sift see #1024 (comment) for the latest proposal for the AST change this requires...

@Lassulus Lassulus mentioned this pull request Dec 21, 2017
@link2xt link2xt mentioned this pull request Dec 26, 2018
18 tasks
@tarleb
Copy link
Collaborator

tarleb commented Jan 14, 2023

We've since went with a different table structure. I believe MediaWiki support was added in 0b003de, so I'm closing this now.

Nevertheless, thank you for the contribution!

@tarleb tarleb closed this Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for table column spans, table attributes in AST
5 participants