@@ -19,7 +19,9 @@ def find_settings(source_path):
1919 Return:
2020 settings (dict): Django settings indexed by name.
2121 """
22- return find_annotations (source_path , SETTING_ANNOTATIONS_CONFIG_PATH , ".. setting_name:" )
22+ return find_annotations (
23+ source_path , SETTING_ANNOTATIONS_CONFIG_PATH , ".. setting_name:"
24+ )
2325
2426
2527class Settings (SphinxDirective ):
@@ -72,7 +74,9 @@ def iter_nodes(self):
7274 source_path = os .path .join (self .env .config .settings_source_path , folder_path )
7375 settings = find_settings (source_path )
7476 # folder_path can point to a file or directory
75- root_folder = folder_path if os .path .isdir (source_path ) else os .path .dirname (folder_path )
77+ root_folder = (
78+ folder_path if os .path .isdir (source_path ) else os .path .dirname (folder_path )
79+ )
7680 for setting_name in sorted (settings ):
7781 setting = settings [setting_name ]
7882 # setting["filename"] is relative to the root_path
@@ -82,8 +86,10 @@ def iter_nodes(self):
8286 text = quote_value (setting_default_value )
8387 )
8488 setting_section = nodes .section ("" , ids = [f"setting-{ setting_name } " ])
85- setting_section += nodes .title (text = setting_name )
86- setting_section += nodes .paragraph ("" , "Default: " , setting_default_node )
89+ setting_section += nodes .title (text = setting_name , ids = [f"title-{ setting_name } " ])
90+ setting_section += nodes .paragraph (
91+ "" , "Default: " , setting_default_node , ids = [f"default-{ setting_name } " ]
92+ )
8793 setting_section += nodes .paragraph (
8894 "" ,
8995 "Source: " ,
@@ -98,13 +104,17 @@ def iter_nodes(self):
98104 setting ["line_number" ],
99105 ),
100106 ),
107+ ids = [f"source-{ setting_name } " ],
101108 )
102109 setting_section += nodes .paragraph (
103- text = setting .get (".. setting_description:" , "" )
110+ text = setting .get (".. setting_description:" , "" ),
111+ ids = [f"description-{ setting_name } " ],
104112 )
105113 if setting .get (".. setting_warning:" ) not in (None , "None" , "n/a" , "N/A" ):
106114 setting_section += nodes .warning (
107- "" , nodes .paragraph ("" , setting [".. setting_warning:" ])
115+ "" ,
116+ nodes .paragraph ("" , setting [".. setting_warning:" ]),
117+ ids = [f"warning-{ setting_name } " ],
108118 )
109119 yield setting_section
110120
@@ -114,7 +124,9 @@ def setup(app):
114124 Declare the Sphinx extension.
115125 """
116126 app .add_config_value (
117- "settings_source_path" , os .path .abspath (".." ), "env" ,
127+ "settings_source_path" ,
128+ os .path .abspath (".." ),
129+ "env" ,
118130 )
119131 app .add_config_value ("settings_repo_url" , "" , "env" )
120132 app .add_config_value ("settings_repo_version" , "master" , "env" )
0 commit comments