lqez / pelican-embed-tweet

Embedding tweets into your Pelican blog posts.
MIT License
15 stars 10 forks source link

The 't@' suffix does not work on RST articles (only on markdown) #5

Open ikding opened 4 years ago

ikding commented 4 years ago

Possibly related to #4 - I've noticed that this plug in works fine on a markdown article (.md) but did not work for a restructured text (.rst) format. After some digging, I believe the reason is that the t@ prefix is causing the rst format of pelican to parse it as an email address, therefore causing the plug to fail.

In the absence of the embed-tweet plugin, here is how markdown pelican turned a sentence of t@moskov/status/1303835719157182465 into html:

<p>t#moskov/status/1303835719157182465</p>

And here is how the rst pelican turned the same sentence into html:

<p><a class="reference external" href="mailto:t&#64;moskov/status/1303835719157182465">t&#64;moskov/status/1303835719157182465</a></p>

The markdown-turned html can be substituted by this plugin into a proper embedded tweet, whereas the rst-turned html can't (because RST pelican interpreted it as an email address).

My fix was to change the t@ prefix to something that RST will not interpret as email, like t#: https://github.com/ikding/website/commit/7395b040cc746f1e9dffc6e3645ad6a594ddc5ff And after this change, this plug-in would work on RST articles in pelican correctly.

lqez commented 4 years ago

@ikding, thanks for your investigation. Could you make a pull request of that?