MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / split_front_matter

Function split_front_matter

scripts/website/blog_text.py:43–56  ·  view source on GitHub ↗

Split a post into (front_matter, body, body_start_line). front_matter is "" when the post has no leading --- block. body_start_line is the 1-based line in the ORIGINAL file where the body begins, so callers can report findings against true source line numbers.

(text)

Source from the content-addressed store, hash-verified

41
42
43def split_front_matter(text):
44 """Split a post into (front_matter, body, body_start_line).
45
46 front_matter is "" when the post has no leading --- block. body_start_line
47 is the 1-based line in the ORIGINAL file where the body begins, so callers
48 can report findings against true source line numbers.
49 """
50 m = _FRONT_MATTER_RE.match(text)
51 if not m:
52 return "", text, 1
53 front_matter = m.group(0)
54 body = text[m.end():]
55 body_start_line = front_matter.count("\n") + 1
56 return front_matter, body, body_start_line
57
58
59def author_body(body):

Callers 2

read_postFunction · 0.85
body_to_htmlFunction · 0.85

Calls 4

groupMethod · 0.65
endMethod · 0.65
countMethod · 0.65
matchMethod · 0.45

Tested by

no test coverage detected