-
Notifications
You must be signed in to change notification settings - Fork 23
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
Adding support for colspan to tables #100
Adding support for colspan to tables #100
Conversation
affeaf4
to
03fcd65
Compare
fca5ef2
to
0367500
Compare
This is still a WIP. I've done a ton of cleanup, and most of the work now will be in
|
04c2c8b
to
291a49d
Compare
291a49d
to
d6fbd2d
Compare
lib/Nodes/Table/TableColumn.php
Outdated
use function trim; | ||
use function utf8_encode; | ||
|
||
class TableColumn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This, along with TableRow
help TableNode
work with meaningful objects, instead of a ton of arrays.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this class final if you can.
} | ||
} | ||
|
||
private function compileSimpleTable() : void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old logic for turning the raw config/lines into a meaningful $this->data
property were completely removed. I couldn't make any sense of them. I've replaced them with 2 entirely separate functions for the "simple table" and the "pretty/grid table". Each of these is super unfancy, because I want them to be readable and because algorithms are hard for me :).
Second row | Other col | Other col | ||
Third row | Other col | Last col | ||
|
||
in file: "(unknown)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File was renamed and made more interesting
6e859f5
to
fbba2f6
Compare
CI is failing on nightly, which is unrelated. This is ready to go :) |
Can you make all new classes final if they are not intended to be extended? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few changes and questions/comments. Looks good. Thanks!
lib/Nodes/Table/TableColumn.php
Outdated
use function trim; | ||
use function utf8_encode; | ||
|
||
class TableColumn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this class final if you can.
This adds several objects, which replace arrays, for more clarity It also introduces features that weren't possible before, like colspans.
fbba2f6
to
457e0fb
Compare
Updates made! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I know the table parsing doesn't support many complex things. But, I've found a few "still-simple" use-cases that aren't parsing correctly yet.
Reference for this stuff: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#grid-tables
Unless I've made a dumb mistake (possible, I've been staring at tables), the actual markup in these tests should be (in spirit) what Sphinx is rendering (minus things we know are different, like classes,
colgroup
, etc).