MCPcopy Create free account
hub / github.com/Freedium-cfd/web / parse_paragraph_text

Method parse_paragraph_text

medium-parser/medium_parser/core.py:228–248  ·  view source on GitHub ↗
(
            text: str, markups: list, is_code: bool = False
        )

Source from the content-addressed store, hash-verified

226 current_pos = 0
227
228 def parse_paragraph_text(
229 text: str, markups: list, is_code: bool = False
230 ) -> RLStringHelper:
231 # Hotfix, workaround for code block
232 has_code_block = any(markup["type"] == "CODE" for markup in markups)
233 if is_code or has_code_block:
234 quote_html_type = ["minimal"]
235 # quote_html_type = None
236 else:
237 quote_html_type = ["full"]
238 text_formater = RLStringHelper(text, quote_html_type=quote_html_type)
239
240 parsed_markups = parse_markups(markups)
241 fixed_markups = split_overlapping_ranges(parsed_markups)
242
243 for markup in fixed_markups:
244 text_formater.set_template(
245 markup["start"], markup["end"], markup["template"]
246 )
247
248 return text_formater
249
250 while len(paragraphs) > current_pos:
251 paragraph = paragraphs[current_pos]

Callers

nothing calls this directly

Calls 4

set_templateMethod · 0.95
RLStringHelperClass · 0.90
split_overlapping_rangesFunction · 0.90
parse_markupsFunction · 0.85

Tested by

no test coverage detected