@@ -105,10 +105,6 @@ def make_ref_link(ref_id: str, name: str | None = None) -> str:
105
105
r .split ("/" )[- 1 ] for r in refs if r .startswith ("plugins/" )
106
106
)
107
107
return [
108
- # Fix nested bullet points indent: use 2 spaces consistently
109
- (r"(?<=\n) {3,4}(?=\*)" , " " ),
110
- # Fix nested text indent: use 4 spaces consistently
111
- (r"(?<=\n) {5,6}(?=[\w:`])" , " " ),
112
108
# Replace Sphinx :ref: and :doc: directives by documentation URLs
113
109
# :ref:`/plugins/autobpm` -> [AutoBPM Plugin](DOCS/plugins/autobpm.html)
114
110
(
@@ -124,9 +120,6 @@ def make_ref_link(ref_id: str, name: str | None = None) -> str:
124
120
# Convert plugin references to documentation URLs
125
121
# `fetchart` plugin -> [fetchart](DOCS/plugins/fetchart.html)
126
122
(rf"`+({ plugins } )`+" , lambda m : make_ref_link (f"plugins/{ m [1 ]} " )),
127
- # Add additional backticks around existing backticked text to ensure it
128
- # is rendered as inline code in Markdown
129
- (r"(?<=[\s])(`[^`]+`)(?!_)" , r"`\1`" ),
130
123
# Convert bug references to GitHub issue links
131
124
(r":bug:`(\d+)`" , r":bug: (#\1)" ),
132
125
# Convert user references to GitHub @mentions
@@ -135,13 +128,12 @@ def make_ref_link(ref_id: str, name: str | None = None) -> str:
135
128
136
129
137
130
MD_REPLACEMENTS : list [Replacement ] = [
138
- (r"<span[^>]+>([^<]+)</span>" , r"_\1" ), # remove a couple of wild span refs
139
131
(r"^(\w[^\n]{,80}):(?=\n\n[^ ])" , r"### \1" ), # format section headers
140
132
(r"^(\w[^\n]{81,}):(?=\n\n[^ ])" , r"**\1**" ), # and bolden too long ones
141
133
(r"### [^\n]+\n+(?=### )" , "" ), # remove empty sections
142
134
]
143
135
order_bullet_points = partial (
144
- re .compile ("(\n - .*?(?=\n (?! *- )|$))" , flags = re .DOTALL ).sub ,
136
+ re .compile ("(\n - .*?(?=\n (?! *(-|\d\.) )|$))" , flags = re .DOTALL ).sub ,
145
137
lambda m : "\n - " .join (sorted (m .group ().split ("\n - " ))),
146
138
)
147
139
@@ -230,6 +222,7 @@ def rst2md(text: str) -> str:
230
222
231
223
232
224
def get_changelog_contents () -> str | None :
225
+ return CHANGELOG .read_text ()
233
226
if m := RST_LATEST_CHANGES .search (CHANGELOG .read_text ()):
234
227
return m .group (1 )
235
228
@@ -241,6 +234,8 @@ def changelog_as_markdown(rst: str) -> str:
241
234
for pattern , repl in create_rst_replacements ():
242
235
rst = re .sub (pattern , repl , rst , flags = re .M | re .DOTALL )
243
236
237
+ Path ("new_new_changelog.rst" ).write_text (rst )
238
+
244
239
md = rst2md (rst )
245
240
246
241
for pattern , repl in MD_REPLACEMENTS :
0 commit comments