MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / demarkup

Function demarkup

src/textcode/markup.py:250–263  ·  view source on GitHub ↗

Return an iterator of unicode text lines for the file at `location` lightly stripping markup if the file is some kind of markup, such as HTML, XML, PHP, etc. The whitespaces are collapsed to one space. Use the ``stripper`` callable, one of demarkup_text or strip_markup_text.

(location, stripper=demarkup_text)

Source from the content-addressed store, hash-verified

248
249
250def demarkup(location, stripper=demarkup_text):
251 """
252 Return an iterator of unicode text lines for the file at `location` lightly
253 stripping markup if the file is some kind of markup, such as HTML, XML, PHP,
254 etc. The whitespaces are collapsed to one space.
255
256 Use the ``stripper`` callable, one of demarkup_text or strip_markup_text.
257 """
258 from textcode.analysis import unicode_text_lines
259
260 for line in unicode_text_lines(location):
261 if TRACE:
262 logger_debug(f"demarkup: {line} : demarked: {demarkup(line)}")
263 yield stripper(line)
264
265
266# ## Old style stripper

Callers

nothing calls this directly

Calls 2

unicode_text_linesFunction · 0.90
logger_debugFunction · 0.70

Tested by

no test coverage detected