hyperlinks
extract_tag_section(html:str, tag:str)
CertainTagFinder
Extracts the HTML section corresponding to a given tag (e.g., 'TODO').Parameters:
html
(str): The HTML content as a string.tag
(str): The tag to extract (e.g., 'TODO').
Returns:
str
: The HTML string of the section corresponding to the tag, orTodo:
Finish the implementation to extract the section based on the tag.
Add hyperlink to functions
Extend it to bug fix and HACK
Labels:
src_PyThon_Docy_hyperlinks_extract_tag_section
create_todo_html(tag:dict, rel_path:str)
create_todo_html
Generates HTML for a list of TODOs, each linked to its function.Parameters:
tag
(dict): A dictionary where keys are function names and values are TODO content.rel_path
(str): The relative path to the HTML file for linking.
Returns:
str
: HTML string containing the TODO sections.Examples:
>>> todo = {'calculate_area': 'Fix the calculation for negative radius', 'greet': 'Add support for multiple languages'}
>>> rel_path = 'docs/functions.html'
>>> create_todo_html(todo, rel_path)
Labels:
src_PyThon_Docy_hyperlinks_create_todo_html
create_Blue_tags(tag:str, tags:list)
create_Blue_tags
Generates HTML for a list of tags, each linked to its function.Parameters:
tag
(str): The tag type (e.g., 'TODO', 'BUG', 'HACK').tags
(list): A list of tuples where each tuple contains the item name and its relative path.
Returns:
str
: HTML string containing the tag sections.Labels:
src_PyThon_Docy_hyperlinks_create_Blue_tags
fileNameExtractor(processed_files:list[dict], source_dirs:dict)
fileNameExtractor
Builds a mapping from file names to their corresponding HTML paths, grouped by language. This is later used by to hyperlink file name mentions in HTML content.Parameters:
processed_files
(list[dict]): List of processed file metadata, where each itemsource_dirs
(dict): Dictionary mapping language codes to their source directories.
Returns:
dict
: A nested dictionary structured as {lang: {file_name: html_path}}.Labels:
src_PyThon_Docy_hyperlinks_fileNameExtractor
replace_file_names_in_html(html_content:str, file_name_to_html_path:dict, current_html_path:str)
replace_file_names_in_html
Replaces plain file name mentions in HTML content with relative hyperlinks to their corresponding HTML pages, except in code blocks or existing anchor tags.Parameters:
html_content
(str): The raw HTML content as a string.file_name_to_html_path
(dict): Dictionary mapping file names to their target HTML paths.current_html_path
(str): Path to the HTML file being processed (used for relative linking).
Returns:
str
: Modified HTML content with appropriate tags added.Labels:
src_PyThon_Docy_hyperlinks_replace_file_names_in_html
process_html_for_labels(html_content:str)
Process HTML content to replace \Label tags with HTML anchors and collect all labels. This function scans the HTML for `\Label: ` patterns, replaces each with an HTML anchor (for linking), and returns the modified HTML content along with a list of the extracted labels.
Parameters:
html_content
(str): Raw HTML string containing \Label tags.
Returns:
- labels (list[str])
: List of extracted label names.Labels:
src_PyThon_Docy_hyperlinks_process_html_for_labels
process_html_for_labels_replace(processed_files:list[dict], label_to_file:dict)
Replace \Ref tags in HTML files with hyperlinks to corresponding label anchors. For each HTML file in `processed_files`, this function reads the file, finds all `\Ref: ` tags, and replaces them with HTML links pointing to the file and anchor associated with that label (if available in `label_to_file`).
Parameters:
processed_files
(list[dict]): List of processed file metadata dictionaries,label_to_file
(dict): A mapping from label names to the HTML file path
Labels:
src_PyThon_Docy_hyperlinks_process_html_for_labels_replace