WordPress Chapters
- Copy chapter wikitext from MediaWiki to VS Code
Images
A) Count the figures in the chapter
- Count and write down the number of images in the chapter for reference
FIND
B) Find all h6 with the word "Figure" in it, add a comment above and replace the header with bolds
- We want to get rid of h6 values. We want to have the image titles as simple bolds, with a comment
FIND regex*
={6}\s*(.*[Ff]igure.*?)\s*={6}
REPLACE
<!-- START IMG -->
<!-- IMG TITLE -->
'''$1'''
C) Find the h4 that comes right before a file
- We want to get rid of h4 values around images. We want to have the image captions as simple bolds, with a comment
C1) EMPTY h4
- Some of the h4 are empty, we want to delete them
FIND regex*
REPLACE
<!-- IMG FILE -->
[[File:
C2) NOT EMPTY h4:
- After that, convert the remains h4 with actual content into bolds
FIND regex*
(={4})\s*(.+?)\s*(={4})\n\n\[\[File:
REPLACE
<!-- IMG CAPTION -->
'''$2'''
<!-- IMG FILE -->
[[File:
D) Find the end of an image section and add a comment
- Add an end comment after image section (for future use)
FIND regex*
(\[\[File:[^\]]+\]\][\s\S]*?)\n(<(div|span)[^>]*>)
REPLACE
Tables
A) Count the tables in the chapter
FIND
B) Find all h6 with the word "Table" in it, add a comment above and replace the header with bolds
FIND regex*
={6}\s*(.*[Tt]able.*?)\s*={6}
REPLACE
<!-- START TABLE -->
'''$1'''
C) Find the h4 that comes right before a file
- We want to get rid of h4 values around tables. We want to have the table captions as simple bolds, with a comment
C1) EMPTY h4
- Some of the h4 are empty, we want to delete them
- Manually
FIND regex*
REPLACE
C2) NOT EMPTY h4:
- After that, convert the remains h4 with actual content into bolds
- Manually
FIND regex*
REPLACE
FIND
REPLACE
<!-- TABLE -->
{| class="wikitable"
D) Add an end comment
FIND
REPLACE
- Check for image for Supplementary Material
- Paste chapter back into wiki and save
- Use a special comment for this revision
WordPress Chapters
Images
A) Count the figures in the chapter
FIND
B) Find all h6 with the word "Figure" in it, add a comment above and replace the header with bolds
FIND regex*
REPLACE
C) Find the h4 that comes right before a file
C1) EMPTY h4
FIND regex*
REPLACE
C2) NOT EMPTY h4:
FIND regex*
REPLACE
D) Find the end of an image section and add a comment
FIND regex*
REPLACE
Tables
A) Count the tables in the chapter
FIND
B) Find all h6 with the word "Table" in it, add a comment above and replace the header with bolds
FIND regex*
REPLACE
C) Find the h4 that comes right before a file
C1) EMPTY h4
FIND regex*
REPLACE
C2) NOT EMPTY h4:
FIND regex*
REPLACE
FIND
REPLACE
D) Add an end comment
FIND
REPLACE