-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
DocBook reader: Table width support #6791
Conversation
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 code looks good, just the indentation of the first case statement appears to be off.
I don't know enough about DocBook to comment on the logic.
899d17f
to
5d72047
Compare
Thank you, done. |
c2d9cf5
to
6a3632a
Compare
@@ -960,12 +960,22 @@ parseBlock (Elem e) = | |||
let aligns = case colspecs of | |||
[] -> replicate numrows AlignDefault | |||
cs -> map toAlignment cs | |||
let parseWidth s = safeRead (T.filter (\x -> (x >= '0' && x <= '9') | |||
|| x == '.') s) | |||
let textWidth = case filterChild (named "?dbfo") e of |
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.
What is this ?dbfo
?
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.
It's an XML processing instruction that's used by the docbook stylesheets to specify the table width in proportion to text. The CALS table model (from 1995) never included something width in relation to text - so this is what people came up with it seems.
Edit: Should add that this stuff is really a reverse engineering of how the docbook stylesheets work - dbfo is most often accompanied by dbhtml and sometimes by dbman processing instructions. Documentation of the docbook stylesheet processing instructions can be found here: http://docbook.sourceforge.net/release/xsl/current/doc/pi/pi-fo.html
@@ -960,12 +960,22 @@ parseBlock (Elem e) = | |||
let aligns = case colspecs of | |||
[] -> replicate numrows AlignDefault | |||
cs -> map toAlignment cs | |||
let parseWidth s = safeRead (T.filter (\x -> (x >= '0' && x <= '9') |
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.
Is this field just a decimal number with no units? If so, do we need to filter? If not, are we ignoring the units?
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.
It's percent - but the percent sign may or may not be there from what I've seen. I though this was safest - but there may be better ways.
It would be nice to have a test of some kind. |
def6a29
to
72f9907
Compare
Added a testcase. Hopefully good now. |
Thanks -- I should have mentioned, we typically name the test cases after issues or PRs, so that it's easier to remember/look up what motivated them. Thus 6791.md. |
72f9907
to
e5e53c3
Compare
done. |
Table width in relation to text width is not natively supported by docbook but is by the docbook fo stylesheets through an XML processing instruction, <?dbfo table-width="50%"?> . Implement support for this instruction in the DocBook reader.
e5e53c3
to
c058cb8
Compare
thanks! |
Table width is not natively supported by docbook but is by
. Implement support for this instructionthe docbook fo stylesheets through an XML processing instruction,
in the DocBook reader.