@@ -61,7 +61,7 @@ def generate_page_sections(page_title, body, fjson_storage_path):
61
61
for head_level in range (1 , 7 ):
62
62
tags = body .css (f'.section > h{ head_level } ' )
63
63
for tag in tags :
64
- title = tag . text (). replace ( '¶' , '' ). strip ( )
64
+ title = _parse_title ( tag )
65
65
66
66
div = tag .parent
67
67
section_id = div .attributes .get ('id' , '' )
@@ -196,21 +196,29 @@ def _get_text_for_domain_data(desc):
196
196
return docstrings
197
197
198
198
199
- def parse_content (content , remove_first_line = False ):
199
+ def parse_content (content ):
200
200
"""Removes new line characters and ¶."""
201
201
content = content .replace ('¶' , '' ).strip ()
202
202
content = content .split ('\n ' )
203
203
204
- # removing the starting text of each
205
- if remove_first_line and len (content ) > 1 :
206
- content = content [1 :]
207
-
208
204
# Convert all new lines to " "
209
205
content = (text .strip () for text in content )
210
206
content = ' ' .join (text for text in content if text )
211
207
return content
212
208
213
209
210
+ def _parse_title (tag ):
211
+ """
212
+ Parses a Sphinx title tag.
213
+
214
+ - Removes the permalink value
215
+ """
216
+ nodes_to_be_removed = tag .css ('a.headerlink' )
217
+ for node in nodes_to_be_removed :
218
+ node .decompose ()
219
+ return tag .text ().strip ()
220
+
221
+
214
222
def process_mkdocs_index_file (json_storage_path , page ):
215
223
"""Reads the json index file and parses it into a structured dict."""
216
224
log .debug ('Processing JSON index file: %s' , json_storage_path )
0 commit comments