Repository navigation
fix(tagging): split frontmatter with the same fence rule the index uses - #75
Open
Abhishek-B-R wants to merge 1 commit into
Open
Abhishek-B-R wants to merge 1 commit into
Abhishek-B-R wants to merge 1 commit into
Conversation
Topic rewrites found the frontmatter block with a literal "---\n" / "\n---" search, while the index parses pages with python-frontmatter, which accepts any run of three or more dashes with trailing whitespace. When the two disagreed, tag/untag saw no frontmatter and prepended a new block, leaving the old one in the body, and topic rename/delete read no topics from the page and skipped it: - an empty block (---/---) was never recognised, because the closer search started past it - a fence with trailing spaces was skipped, so tagging left the page with two frontmatter blocks and the index lost its title Split line by line on the shared fence rule instead, and take the line ending from the opening fence.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
split_frontmatternow splits line by line on the same fence rule python-frontmatter uses (-{3,}plus optional trailing whitespace), and takes the line ending from the opening fence.tests/test_tagging.py.Why
tag/untag and topic rename find frontmatter with a literal
---\nopener and a\n---search that starts after it, but the index parses pages with python-frontmatter. when the two disagree, the rewrite prepends a second block and leaves the old one in the body.repro: a page that starts
---\n---\n# Note, thencodealmanac tag note concepts. the file ends up as---\ntopics:\n- concepts\n---\n---\n---\n# Note. same thing when the opening fence has trailing spaces.topics rename/deletealso skip those pages since they read no topics.Verification
Docs and wiki
.almanac/wiki updated if an implementation decision, workflow, invariant, or gotcha changed.both new tests fail on main and pass here.
Notes for reviewers
a page whose first line is a
----thematic break is now read as a frontmatter opener by the rewriter. that is what the index already does, so the two stay consistent.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.