Skip to content

Commit a811107

Browse files
committed
Update migration script to convert autorule
1 parent a562ec8 commit a811107

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [unreleased]
44

5+
## [1.1.1]
6+
7+
- Updated migration script to convert `autorule`.
8+
59
## [1.1.0]
610

711
- Added `syntax:autorule`.
@@ -39,7 +43,8 @@
3943

4044
- Initial release.
4145

42-
[unreleased]: https://github.com/sphinx-contrib/syntax/compare/v1.1.0...HEAD
46+
[unreleased]: https://github.com/sphinx-contrib/syntax/compare/v1.1.1...HEAD
47+
[1.1.1]: https://github.com/sphinx-contrib/syntax/compare/v1.1.0...v1.1.1
4348
[1.1.0]: https://github.com/sphinx-contrib/syntax/compare/v1.0.1-post1...v1.1.0
4449
[1.0.1-post1]: https://github.com/sphinx-contrib/syntax/compare/v1.0.1...v1.0.1-post1
4550
[1.0.1]: https://github.com/sphinx-contrib/syntax/compare/v1.0.0-post1...v1.0.1

sphinx_syntax/ext/antlr4/sphinx_a4doc_convert.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,13 @@ def main():
8989
flags=re.MULTILINE,
9090
)
9191
text = re.sub(
92-
r"^([ ]*)\.\.[ ]+a4:(autogrammar|grammar|rule)::",
92+
r"^([ ]*)\.\.[ ]+a4:autorule::[ ]*(\S*?)(\.g4)?[ ]",
93+
r"\1.. syntax:autorule:: \2.g4 ",
94+
text,
95+
flags=re.MULTILINE,
96+
)
97+
text = re.sub(
98+
r"^([ ]*)\.\.[ ]+a4:(autogrammar|grammar|autorule|rule)::",
9399
r"\1.. syntax:\2::",
94100
text,
95101
flags=re.MULTILINE,
@@ -177,7 +183,7 @@ def main():
177183
)
178184
fulldiff += diff
179185

180-
for directive in ["a4:autorule", "docstring-marker", "members-marker"]:
186+
for directive in ["docstring-marker", "members-marker"]:
181187
if f".. {directive}::" in text:
182188
print(
183189
colorize(

0 commit comments

Comments
 (0)