Skip to content

Commit d05a955

Browse files
committed
Update post-render.py
1 parent 2582dbe commit d05a955

1 file changed

Lines changed: 0 additions & 30 deletions

File tree

docs/scripts/post-render.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -235,36 +235,6 @@ def get_source_link_html(item_name):
235235
usage_row = '<p style="font-size: 12px; color: rgb(170, 170, 170); margin-bottom: -14px;">USAGE</p>\n'
236236
content.insert(sourcecode_line, usage_row)
237237

238-
# Add source links for methods within class pages
239-
# Methods have sections with IDs like "great_docs.GreatDocs.build"
240-
content_str = "".join(content)
241-
242-
# Find all method sections and add source links to their sourceCode blocks
243-
# Pattern: <section id="package.ClassName.method_name"...><h3...>method_name</h3>...<div class="sourceCode"
244-
method_section_pattern = r'(<section[^>]*id="[^"]*\.([^"]+)"[^>]*>.*?<h[34][^>]*>.*?</h[34]>)(.*?)(<div class="sourceCode")'
245-
246-
def add_method_source_link(match):
247-
section_start = match.group(1)
248-
method_name = match.group(2)
249-
between_content = match.group(3)
250-
sourcecode_div = match.group(4)
251-
252-
# Build the full method name (ClassName.method_name)
253-
full_method_name = f"{item_name_from_file}.{method_name}"
254-
method_source_link = get_source_link_html(full_method_name)
255-
256-
if method_source_link:
257-
# Add usage/source row before the sourceCode div
258-
usage_row = f'<div class="usage-source-row" style="display: flex; justify-content: space-between; align-items: baseline; margin-bottom: -14px;"><span style="font-size: 12px; color: rgb(170, 170, 170);">USAGE</span>{method_source_link}</div>\n'
259-
return section_start + between_content + usage_row + sourcecode_div
260-
else:
261-
return match.group(0)
262-
263-
content_str = re.sub(
264-
method_section_pattern, add_method_source_link, content_str, flags=re.DOTALL
265-
)
266-
content = content_str.splitlines(keepends=True)
267-
268238
# Fix return value formatting in individual function pages, removing the `:` before the
269239
# return value and adjusting the style of the parameter annotation separator
270240
content_str = "".join(content)

0 commit comments

Comments
 (0)