17
17
import string
18
18
from typing import Callable , List , Optional , Pattern , Tuple , Set
19
19
from dataclasses import dataclass
20
- import os
21
20
import logging
22
21
23
22
from pkg_resources import get_distribution
24
- from recommonmark .parser import CommonMarkParser
25
23
26
24
logging .basicConfig (format = "%(levelname)s: %(message)s" , level = logging .INFO )
27
25
28
26
LOG = logging .getLogger (__name__ )
29
27
30
- # Get a relative path so logs printing out SRC isn't too long.
31
- CURRENT_DIR = Path (__file__ ).parent .relative_to (os .getcwd ())
28
+ CURRENT_DIR = Path (__file__ ).parent
32
29
README = CURRENT_DIR / ".." / "README.md"
33
30
REFERENCE_DIR = CURRENT_DIR / "reference"
34
31
STATIC_DIR = CURRENT_DIR / "_static"
@@ -200,7 +197,7 @@ def process_sections(
200
197
# -- Project information -----------------------------------------------------
201
198
202
199
project = "Black"
203
- copyright = "2018 , Łukasz Langa and contributors to Black"
200
+ copyright = "2020 , Łukasz Langa and contributors to Black"
204
201
author = "Łukasz Langa and contributors to Black"
205
202
206
203
# Autopopulate version
@@ -213,36 +210,54 @@ def process_sections(
213
210
214
211
custom_sections = [
215
212
DocSection ("the_black_code_style" , CURRENT_DIR / "the_black_code_style.md" ,),
216
- DocSection ("pragmatism" , CURRENT_DIR / "the_black_code_style.md" ,),
217
213
DocSection ("editor_integration" , CURRENT_DIR / "editor_integration.md" ),
218
214
DocSection ("blackd" , CURRENT_DIR / "blackd.md" ),
219
215
DocSection ("black_primer" , CURRENT_DIR / "black_primer.md" ),
220
216
DocSection ("contributing_to_black" , CURRENT_DIR / ".." / "CONTRIBUTING.md" ),
221
217
DocSection ("change_log" , CURRENT_DIR / ".." / "CHANGES.md" ),
222
218
]
223
219
220
+ # Sphinx complains when there is a source file that isn't referenced in any of the docs.
221
+ # Since some sections autogenerated from the README are unused warnings will appear.
222
+ #
223
+ # Sections must be listed to what their name is when passed through make_filename().
224
+ blocklisted_sections_from_readme = {
225
+ "license" ,
226
+ "pragmatism" ,
227
+ "testimonials" ,
228
+ "used_by" ,
229
+ }
224
230
225
231
make_pypi_svg (release )
226
232
readme_sections = get_sections_from_readme ()
233
+ readme_sections = [
234
+ x for x in readme_sections if x .name not in blocklisted_sections_from_readme
235
+ ]
236
+
227
237
process_sections (custom_sections , readme_sections )
228
238
229
239
230
240
# -- General configuration ---------------------------------------------------
231
241
232
242
# If your documentation needs a minimal Sphinx version, state it here.
233
- #
234
- # needs_sphinx = '1.0'
243
+ needs_sphinx = "3.0"
235
244
236
245
# Add any Sphinx extension module names here, as strings. They can be
237
246
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
238
247
# ones.
239
- extensions = ["sphinx.ext.autodoc" , "sphinx.ext.intersphinx" , "sphinx.ext.napoleon" ]
248
+ extensions = [
249
+ "sphinx.ext.autodoc" ,
250
+ "sphinx.ext.intersphinx" ,
251
+ "sphinx.ext.napoleon" ,
252
+ "recommonmark" ,
253
+ ]
254
+
255
+ # If you need extensions of a certain version or higher, list them here.
256
+ needs_extensions = {"recommonmark" : "0.5" }
240
257
241
258
# Add any paths that contain templates here, relative to this directory.
242
259
templates_path = ["_templates" ]
243
260
244
- source_parsers = {".md" : CommonMarkParser }
245
-
246
261
# The suffix(es) of source filenames.
247
262
# You can specify multiple suffix as a list of string:
248
263
source_suffix = [".rst" , ".md" ]
0 commit comments