-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fix code-diff #14971
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
Fix code-diff #14971
Conversation
@@ -55,17 +55,18 @@ changes can be made to any Symfony 3.4 or higher app: | |||
#. Update ``.gitignore``: | |||
|
|||
.. code-block:: diff | |||
:dedent: 0 |
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 it possible to set this in the config without the need to change all examples?
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.
In fact we don't care about this flag, it just helps Sphinx to get the indentation.
Here are 2 identical exemples
.. code-block:: diff
+ added
not changed
.. code-block:: diff
added
+ not changed
In the first one, Sphinx is able to get that indentation of the bloc is 4
. But in the second, is it 6
like suggested by the first line? or 4
?
So we need something to help Sphinx to figure out the indentation of the bloc.
I would need Sphinx locally to test if this is really needed, maybe you can help me with that?
This is really nice! We should merge this in 4.4 first. Then, I'm not sure about the "upmerging" process: merge 4.4 in 5.2 and then try to fix conflicts? or merge 4.4 in 5.2, ignore all changes and then re-run the command in 5.2? That's why I'm not confident about merging this myself. Any volunteer? Thanks! |
beware, the CSS of the website have to be changed after this patch (today, it looks OK, because And if we fix the CSS, all previous versions will be affected. :( I can handle the merge, but don't have write permission on the repo. We also have to find a solution for this #14971 (comment) |
So you created a script that does this automatically (except from the 2 you mentioned)? If that's the case, I can manage the upmerge if you provide the script (no need to fix conflicts). About the comment, as said in the issue, a real diff (and the diff's in the Fast Track book) start with this:
I guess if we replace the file comment with this, it's all fixed. Imho, we can even just let the file comment start at indent = 0 (same column as + / -), as they aren't valid diff files anyway. |
@wouterj thank you. The script is linked in the description of this PR. Adding a |
Sorry, I somehow missed the gist. We can automate it I think (we only need to run this script once, so no need to check if a diff is already patched previously): https://gist.github.com/wouterj/6bf693f097ed523a51e9ca6e7dc98c11 This script produces changes like this e.g.: --- a/configuration/dot-env-changes.rst
+++ b/configuration/dot-env-changes.rst
@@ -61,15 +61,15 @@ changes can be made to any Symfony 3.4 or higher app:
.. code-block:: diff
# .gitignore
- # ...
+ # ...
- ###> symfony/framework-bundle ###
+ ###> symfony/framework-bundle ###
- /.env
+ /.env.local
+ /.env.local.php
+ /.env.*.local
- # ...
+ # ... (a diff diff 🤯 ) This isn't a valid patch file, but we're missing the During the merge, I plan to discard the changes of the merge, run the tool again and commit merge. As it's all automated, there is no need to make a more detailed merge. What do you think? |
So we ignore the first meaningful line of the diff which should be a comment to the file. Sounds like a plan 👍 |
Alright, I was very unsure on updating this PR. So I've started a new one with your script based on 4.4: #15009 . Please let me know if you agree with the changes there. We can take merging, up merging and fixing the CSS from there. Thanks for building the script! |
Fixes #14472
To fix the code, I used an home made script https://gist.github.com/jderusse/a2f9275239f3b9204583fea52b314dc0 (I put in the
_build
directory and called `php ./_build/fix.php).Note: I had to manually patch the
setup/flex.rst
andquick_tour/flex_recipes.rst
because were malformated.I know this is the wrong branch and this should be applied to previous versions. Please tell me ho you want to proceed.