-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Fixed #34140 -- Reformatted code blocks in docs with blacken-docs. #16609
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
Conversation
bd88c7d
to
6df4f41
Compare
Will the Let me know if you need help with that? |
7fb4a24
to
cfefcc6
Compare
Yes, it's on my TO-DO list, and yes, I need help 🚑 😉 |
This is what I've come up with so far. I'm assuming the error code doesn't matter ( diff --git a/docs/make.bat b/docs/make.bat
index 4743692ca3..1de9089b35 100644
--- a/docs/make.bat
+++ b/docs/make.bat
@@ -35,6 +35,7 @@ if "%1" == "help" (
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
echo. spelling to check for typos in documentation
+ echo. black to apply the black formatting to code blocks in documentation
goto end
)
@@ -196,4 +197,11 @@ spelling/output.txt.
goto end
)
+if "%1" == "black" (
+ mkdir %BUILDDIR%
+ for /f "usebackq tokens=*" %%i in (`dir *.txt /s /b ^| findstr /v /c:"_build" /c:"_theme"`) do (
+ blacken-docs --rst-literal-block %%i
+ )
+ echo "Code blocks reformatted"
+)
+ Running blacken-docs it creates one diff to this PR: diff --git a/docs/ref/contrib/postgres/search.txt b/docs/ref/contrib/postgres/search.txt
index 699f81bd11..4f481e56a2 100644
--- a/docs/ref/contrib/postgres/search.txt
+++ b/docs/ref/contrib/postgres/search.txt
@@ -343,9 +343,7 @@ Usage example:
>>> Author.objects.create(name="Katy Stevens")
>>> Author.objects.create(name="Stephen Keats")
>>> test = "Katie Stephens"
- >>> Author.objects.annotate(
- ... similarity=TrigramSimilarity("name", test),
- ... ).filter(
+ >>> Author.objects.annotate(similarity=TrigramSimilarity("name", test),).filter(
... similarity__gt=0.3
... ).order_by("-similarity")
[<Author: Katy Stevens>, <Author: Stephen Keats>]
@@ -366,9 +364,7 @@ Usage example:
>>> Author.objects.create(name="Katy Stevens")
>>> Author.objects.create(name="Stephen Keats")
>>> test = "Kat"
- >>> Author.objects.annotate(
- ... similarity=TrigramWordSimilarity(test, "name"),
- ... ).filter(
+ >>> Author.objects.annotate(similarity=TrigramWordSimilarity(test, "name"),).filter(
... similarity__gt=0.3
... ).order_by("-similarity")
[<Author: Katy Stevens>]
@@ -401,9 +397,7 @@ Usage example:
>>> Author.objects.create(name="Katy Stevens")
>>> Author.objects.create(name="Stephen Keats")
>>> test = "Katie Stephens"
- >>> Author.objects.annotate(
- ... distance=TrigramDistance("name", test),
- ... ).filter(
+ >>> Author.objects.annotate(distance=TrigramDistance("name", test),).filter(
... distance__lte=0.7
... ).order_by("distance")
[<Author: Katy Stevens>, <Author: Stephen Keats>]
@@ -424,9 +418,7 @@ Usage example:
>>> Author.objects.create(name="Katy Stevens")
>>> Author.objects.create(name="Stephen Keats")
>>> test = "Kat"
- >>> Author.objects.annotate(
- ... distance=TrigramWordDistance(test, "name"),
- ... ).filter(
+ >>> Author.objects.annotate(distance=TrigramWordDistance(test, "name"),).filter(
... distance__lte=0.7
... ).order_by("distance")
[<Author: Katy Stevens>]
|
7d081d2
to
d2cd91b
Compare
Thanks, added! Does it save the return code of
It seems that you don't use the newest |
No. This calls blacken-docs for every file. So only saves it for the final file. I'm not sure how to pass in a list of files on windows.
Ahh OK. Quite possibly. |
I think it's fine, we don't use it in CI so we don't need to capture the return code. I removed |
d73fa08
to
5b420b4
Compare
Just a quick confirm that the |
5b420b4
to
68c9e63
Compare
I reviewed the 'makefile' commit and LGTM |
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.
68c9e63
to
724f726
Compare
@carltongibson @pauloxnet Thanks 👍 |
…justed docs. This adds: - GitHub actions, - tox configuration, - pre-commit hook, and - makefile rules to run blacken-docs linter. Co-authored-by: David Smith <[email protected]>
724f726
to
14459f8
Compare
I found two small issues when reviewing changes made by |
black
rule tomake.bat