Skip to content

Commit 0290c0d

Browse files
authored
Merge pull request #83771 from aireilly/clean-out-single-line-comments
Clean out single-line xrefs that are commented in build_for_portal
2 parents cc346f8 + ba0169f commit 0290c0d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

build_for_portal.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
IFDEF_RE = re.compile(r"^if(n?)def::(.*?)\[\]", re.M)
4242
ENDIF_RE = re.compile(r"^endif::(.*?)\[\]\r?\n", re.M)
4343
COMMENT_CONTENT_RE = re.compile(r"^^////$.*?^////$", re.M | re.DOTALL)
44+
COMMENTED_XREF_RE = re.compile(r"^//.*xref:.*$")
4445
TAG_CONTENT_RE = re.compile(
4546
r"//\s+tag::(.*?)\[\].*?// end::(.*?)\[\]", re.M | re.DOTALL
4647
)
@@ -656,6 +657,9 @@ def scrub_file(info, book_src_dir, src_file, tag=None, cwd=None):
656657
if line.strip() == "" and not content_found:
657658
continue
658659

660+
# Replace lines containing commented xrefs
661+
line = COMMENTED_XREF_RE.sub("// Removed commented line that contains an xref", line)
662+
659663
# Check if the line should be included in the output
660664
if include_line(line):
661665
content_found = True

0 commit comments

Comments
 (0)