Repository navigation
Flexible declaration styling - #9023
Conversation
2aa6d5f to
7bb2473
Compare
4bfefc5 to
b16cb6c
Compare
|
I think it is now in a potentially mergeable state, ready to review. |
6fd299d to
ed700ea
Compare
|
LGTM with nits! |
Thanks! It should be ready for a second round now. As a general point: what is your opinion on how to use |
Ideally, all writers should support all of the new nodes. But it increases the maintenance cost of the 3rd party builders. So I'm afraid that the warnings kill their deprecation because of the lack of maintenance. So -0 for emitting warnings. |
Good point, as noted in the review comment, I'll ensure that at least the writers bundled with Sphinx only needs the fallback for the |
|
Yes. I'll review this again tomorrow (or the next day). After that, let's merge this into 4.0.x branch. |
|
LGTM again. +1 for merging if fallback-transform supports the |
|
Thanks for the reviews! I'll rebase to 4.0.x and merge. |
Use the new node for cpp:expr
Add test objects so all builders gets exposed to the new nodes. Make the fallback node post-transform change desc_inline as well. Make the html4, latex, and text writers handle desc_inline.
08ad74a to
cb21eb2
Compare
Feature or Bugfix
Purpose
Attempt to resolve a foundational chunk of #4289, building on #7145, #6990, #4390.
Examples of difference in HTML rendering
Current: https://jakobandersen.github.io/ex_sphinx_decl_styling/master/
With this: https://jakobandersen.github.io/ex_sphinx_decl_styling/with_9023/
For seeing the differences for the Python domain (change to monospace font) see e.g.,
extdev/appapi.html.For the difference in styling with colouring in the C++ domain see e.g.,
usage/restructuredtext/domains.html#_CPPv46MyList.Additional example of C++ differences
Current:


With this PR:
Details
addnodes.desc_sig_element,and document them as being the leaf-nodes of signatures.
That is, they only contain text, no other nodes.
desc,desc_signature,desc_signature_line, anddesc_contentas the nodes that form the top levels of object descriptions.
desc_nodes as being high-level structuring nodes for signatures.desc_nodes.nodes.Textnodes.basictheme to group by this node classification.addnodesfrom the HTML and HTML5 writers.desc_inlinenode for signature fragments in text.This is not for xrefs, but for roles like
cpp:exprwhich contain arbitrary expressions or types.desc_signatureanddesc_inline.Both get
sigthe domain name, and in additionsig-objectandsig-inlinerespectively.While
desccontains the domain, this also has arbitrary descriptions as decendants,so you can have a
py:functionwith a description that contains acpp:expr.If you want to style, e.g., keywords differently in the two languages, you can now select
.sig.py .kand.sig.cpp .kwithout them overlapping.desc_nameanddesc_addnamefrom using acodetag to aspan,and instead make all
.siguse monospace as font-family consistently.Next steps, perhaps for future PRs
Only the basic theme has been changed. The rest should be checked.(done)desc_inlineis quick copy paste. The compiled PDF looks fine to me, but please check, e.g., with something like:cpp:expr:`a + b`desc_nodes perhaps should be looked at:desc_type,desc_returns,desc_parameterlist,desc_parameter,desc_optional, anddesc_annotation.I suggest doing this in a separate PR.
Convert the C domain to use the new nodes.(done)