We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 5626b5b + b35b900 commit 549817eCopy full SHA for 549817e
3 files changed
ChangeLog.md
@@ -12,6 +12,8 @@
12
([#26](https://github.com/davep/rogallo/pull/26))
13
- Improved the detection of headings.
14
([#29](https://github.com/davep/rogallo/pull/29))
15
+- Improved the detection of quotes.
16
+ ([#31](https://github.com/davep/rogallo/pull/31))
17
18
## v0.1.0
19
src/rogallo/gemtext/parser.py
@@ -100,6 +100,8 @@ def uri(self) -> str:
100
"""Marker for a level 2 heading in Gemtext."""
101
_H3: Final[str] = "###"
102
"""Marker for a level 3 heading in Gemtext."""
103
+_QUOTE: Final[str] = ">"
104
+"""Marker for a quote in Gemtext."""
105
106
107
##############################################################################
@@ -133,8 +135,8 @@ def _parse(self) -> Iterator[Line]:
133
135
elif line.startswith(_LINK):
134
136
parts = line.removeprefix(_LINK).strip().split(maxsplit=1)
137
yield Link(parts[0], parts[1] if len(parts) > 1 else "")
- elif line.startswith("> "):
- yield Quote(line.removeprefix("> ").strip())
138
+ elif line.startswith(_QUOTE):
139
+ yield Quote(line.removeprefix(_QUOTE).strip())
140
elif line.startswith(_H3):
141
yield Heading(line.removeprefix(_H3).strip(), 3)
142
elif line.startswith(_H2):
tests/unit/test_gemtext.py
@@ -39,8 +39,6 @@ def test_str_gemtext() -> None:
39
("\nSecond line.", ""),
40
(" \nSecond line.", " "),
41
(" > Not a quote", " > Not a quote"),
42
- (">Not a quote", ">Not a quote"),
43
- (">> Not a quote", ">> Not a quote"),
44
(" # Not a header", " # Not a header"),
45
("*Not a list item", "*Not a list item"),
46
("** Not a list item", "** Not a list item"),
@@ -93,6 +91,7 @@ def test_parse_header(gemtext: str, expected_level: int, expected_content: str)
93
91
[
94
92
("> This is a quote.", "This is a quote."),
95
+ (">> This is a quote.", "> This is a quote."),
96
("> > This is a quote.", "> This is a quote."),
97
("> This is a quote.\n> Second line.", "This is a quote."),
98
("> \nSecond line.", ""),
0 commit comments