-
Notifications
You must be signed in to change notification settings - Fork 50
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
Add table formatting for constant lists #90
Add table formatting for constant lists #90
Conversation
There is language data in |
Seems doing |
6d607b6
to
eef450b
Compare
That was it, thanks! I've added three additional commits:
With this PR, Phd will generate tables out 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.
Haven't tried this locally yet, but this looks good :) would probably also allow use to automatically generate links for <constant>
tags when all of the roles are set and so there is a way to index the constant definitions :)
I've pinged translators so they can have a look at the lang data.
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 had a look at it locally, and looks good :)
I do wonder maybe if we should move the type information into another term
tag for it to be rendered as a column too, but that's going to require modifying a lot of doc pages :/
I was thinking about that too and a separate column could look better for types. Some constant list tables also have a notes column (mostly used as a changelog for individual constants) which I think is mostly a waste of valuable screen space. But as long as the constants are grouped in some logical manner, a separate column for types should be fine. Unless we do this: :-)
|
I think having the changelog (for addition/removal) can just be in the description. A whole column for it is wasteful IMHO. Also I realised, considering the rendering only works when the markup is changed to add the role attribute, changing the markup at the same time to move the type info into a |
Great, I was thinking the same. :-)
I'll try to check most extensions in the next few days to see what kind of workload it would be to get all constants on the constants pages and convert them to the three column |
Another thing that just occurred to me is that it would be great if we could search for specific constants using the manual's search function and it would take us straight to the constant. Also related to search but not to constants, it'd be great if searching for any of the reserved words (e.g. |
I've just realized that there is an issue with both using XInclude and linkable constants. For constants to be linkable each of them needs to have a Is there any other way to the constant lists like XInclude is doing or is there another way to link to individual constants? Or is there a way for XInclude's |
Yeah, having the search work would be great. My understanding is that the search DB is generated during the indexing phase (the first run of PhD) which is a special "renderer". I suppose it would be easy to add the reserved keywords to it, either by using an XML PI or just hard coding them in the constructor of the indexing render 🤔 Not sure about XInclude, I asked @nielsdos about it and he'll reply to me (or here) when he has time :) |
I'll have a better look at home, but from https://www.w3.org/TR/xinclude-11/#attribute-copying I read:
|
But looks like libxml2 implements the 2003 spec of XInclude, not the newer XInclude version 1.1 that introduced the set-xml-id attribute. In that case I don't see a workaround except applying custom processing or XSLT. Or if you can solve it by including the children instead of the |
Thanks for checking on this. It would have been great to use XSLT's I think I'll delete the ids for now and will come back to this when working on adding a link to each constant (like how functions are linked) and making them searchable. |
@Girgias please don't add the I was originally thinking about refactoring the Is there a test suite for Phd somewhere I could test my changes on? I've found a handful of tests in the Phd directory but there seems to be way more functionality to Phd than this. |
I wasn't planning on adding it yet, as I'm leaving it to be your project in some way. I saw you found the test suite already, which IIRC uses the php-src run-tests.php script |
@Girgias This is an attempt to implement formatting constant lists as tables. While most of it works fine, the
format_variablelist()
function has an issue I'm hoping you might be able to help me with. Namely that I'm inserting a header row as a string here which includes the hardcoded stringsConstants
andDescription
. Is there a way to access the language specific strings of the appropriate entities (&Constants;
and&Description;
).