WP: Footnote renumbering for WordPress.com posts

Preamble

Idea for a PERL script to automatically renumber footnote references that take the form:

This is because a tuple is required8:

or in HTML:

<sup><a href="https://stackoverflow.com/a/66372700/4424636">8</a></sup>

These footnote references have to be entered by hand. If a new footnote reference is added (inserted) before a series of other footnotes then the successive footnote references require renumbering. Renumbering by hand is a major chore.

The script was actually written in Python, using BeautifulSoup.

Code available on Gitlab:

Continue reading WP: Footnote renumbering for WordPress.com posts

Reading WordPress pages in Perl

Preamble

I wanted to add some functionality to the WordPress to table of contents Perl script to grab the HTML code of the WordPress page, rather than require the user to manually copy the HTML from the Text tab of the WordPress editor.

However, whilst researching how to add this functionality, I found that a simple get(), using LWP::Simple, doesn’t work when trying to retrieve WordPress pages, and empty string is returned:

Use of uninitialized value $page in print at ./GetPage.pl line 13.

Continue reading Reading WordPress pages in Perl

Create an external “links” section for WordPress.com posts

Preamble

Following on from my partial success (issues due to the automatic HTML formatting of WordPress are causing the lack of total success) of the table of contents (ToC) creator, see Create table of contents for WordPress.com posts. I then thought that it would be useful to have a script that pulls out all of the (external) links referenced and places them under the heading of “Links”…

Continue reading Create an external “links” section for WordPress.com posts

Create table of contents for WordPress.com posts

Preamble

Whilst writing particularly long posts I realised that a table of contents (ToC) would be most useful, based on the headings in the post.

It wouldn’t be that hard to do, in Perl.

Code on GitLab.

Continue reading Create table of contents for WordPress.com posts

Managing media by file size

Preamble

I’ve reached my limit in media (3 GB), of my free WordPress.com plan’s allocation. So, I thought I’d try to view all of my media by file size, in order to remove any over sized files (I know that there are some large PDFs running around in the library, somewhere).

However, WordPress.com doesn’t seem to have that functionality (although the real WP does)…

Continue reading Managing media by file size

Stopping the Block Editor

Preamble

If you use the classic WP Dashboard, and then you click the “Classic Editor” link on a post that was once edited, or created, using the horrific Block Editor, you will be presented with a dialog notifying you of such and offering you the choice of the Block Editor or the Classic Editor:

Annoying Block Editor prompt dialog

This dialog quickly becomes infuriating. Like really infuriating. It is not only displayed the first time you re-open a post for editing in the classic editor, but also each time you make an edit in the classic editor and hit the update button, it will also show up.

To stop this behaviour, you need to strip out all of the custom HTML block markers, that are hidden in the post.

Continue reading Stopping the Block Editor