{.quotelead} strings in markdown2html messages
aitor
aitors2005 at gmail.com
Wed Jun 30 05:00:33 UTC 2021
Hi!
On Wed, Jun 30, 2021 at 08:26:56AM +1000, Cameron Simpson wrote:
>
> [....]
> Try hacking the script to change this:
>
> ret.append(f'{{.quotelead}}{cur.strip()}')
> ret.append(f'<p>{{.quotelead}}{cur.strip()}')
>
> That might make for ugly HTML rendering, but would at least the litter
> will be gone.
your response was very insightful, thanks! It turns out that the solution
doesn't quite work, as the '<p>{.quotelead}' gets converted to HTML as
'<p>{.quotelead}', which doesn't match. So I removed the '<p>' part in the
replace statement (line 194), which now reads
ret = html.replace('{.quotelead}', '<p class="quotelead">')
For completion, here is the patch that resulves the issue. If nobody complains,
I'll open an issue in the gilab to fix the bug.
thanks!
diff --git a/contrib/markdown2html b/contrib/markdown2html
index 8b7a3f09..fc2b72d1 100644
--- a/contrib/markdown2html
+++ b/contrib/markdown2html
@@ -191,7 +191,7 @@ def _reformat_quotes(html):
Earlier in the pipeline, we marked email quoting, using markers, which we
now need to turn into HTML classes, so that we can use CSS to style them.
'''
- ret = html.replace('<p>{.quotelead}', '<p class="quotelead">')
+ ret = html.replace('{.quotelead}', '<p class="quotelead">')
ret = re.sub(r'<blockquote>\n((?:<blockquote>\n)*)<p>(?:\{\.quote(\w+)\})',
r'<blockquote class="quote \g<2>">\n\g<1><p>', ret, flags=re.MULTILINE)
return ret
More information about the Mutt-users
mailing list