Skip to content

Commit 46e2542

Browse files
ZeroSkill1neobrain
authored andcommitted
Convert MediaWiki redirects, add script for that
1 parent 3b6fb2a commit 46e2542

File tree

301 files changed

+617
-616
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

301 files changed

+617
-616
lines changed

08_convert_redirects.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
for i in $(grep -rl "REDIRECT" ./content); do
2+
# get frontmatter of page
3+
frontmatter="$(cat "$i" | head -n$(grep '+++' -n "$i" | tail -n 1 | cut -d: -f1) | head -n-1)";
4+
# extract target page from MediaWiki REDIRECT thing,
5+
target_page="$(perl -0777 -pe 's,(?:.|\n)*REDIRECT(?:\s|\n)*(?:\[(?:[\s\S]*?)\])\((.*) "wikilink"\)(?:.|\n)*,\1,g' $i)"
6+
7+
# rewrite page to be placeholder with BookHref for automatic redirect
8+
cat > "$i" << EOL
9+
$frontmatter
10+
BookHref = '../${target_page}'
11+
+++
12+
13+
$target_page
14+
EOL
15+
16+
echo "Processed $i -> $target_page";
17+
done;

content/3DSLL.md

Lines changed: 2 additions & 1 deletion

content/3DSViewer.md

Lines changed: 2 additions & 1 deletion

content/3DS_exploits.md

Lines changed: 2 additions & 1 deletion

content/9.0.0-?.md

Lines changed: 2 additions & 1 deletion

content/AES.md

Lines changed: 2 additions & 1 deletion

content/AM.md

Lines changed: 2 additions & 2 deletions

content/AM:AbortCIAInstall.md

Lines changed: 2 additions & 1 deletion

content/AM:CloseCIA.md

Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 1 deletion

0 commit comments

Comments
 (0)