MCPcopy Create free account
hub / github.com/idank/explainshell / _is_section_header

Function _is_section_header

explainshell/roff_utils.py:55–64  ·  view source on GitHub ↗

Check if a roff line is a section header (.SH or .Sh) matching name.

(line: str, name: str)

Source from the content-addressed store, hash-verified

53
54
55def _is_section_header(line: str, name: str) -> bool:
56 """Check if a roff line is a section header (.SH or .Sh) matching name."""
57 stripped = line.strip()
58 # man(7): .SH NAME / .SH "NAME"; mdoc(7): .Sh NAME
59 for macro in (".SH", ".Sh"):
60 if stripped.startswith(macro):
61 rest = stripped[len(macro) :].strip().strip('"').strip()
62 if rest.upper() == name.upper():
63 return True
64 return False
65
66
67def _is_any_section_header(line: str) -> bool:

Callers 1

_extract_sectionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected