[gimp-web-devel/pat/bootstrap] Script for converting wiki markup into markdown.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp-web-devel/pat/bootstrap] Script for converting wiki markup into markdown.
- Date: Fri, 23 Sep 2022 15:35:43 +0000 (UTC)
commit 5683d398bc1647fe25cd636870e2094156da5c0d
Author: Robin Swift <robinswiftart gmail com>
Date: Fri Sep 23 12:44:38 2022 +0000
Script for converting wiki markup into markdown.
Call as
```
$ sed -i -f scripts/wiki_to_markdown.sed TARGET
```
scripts/wiki_to_markdown.sed | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
---
diff --git a/scripts/wiki_to_markdown.sed b/scripts/wiki_to_markdown.sed
new file mode 100644
index 0000000..2a1a706
--- /dev/null
+++ b/scripts/wiki_to_markdown.sed
@@ -0,0 +1,20 @@
+# Script for converting wiki syntax into markdown.
+
+# Converting the internal link format which has a label.
+s/\[\[\([^|]*\)|\([^]]*\)\]\]/[\2](\1)/g
+
+# Converting the external link format which has a label.
+s/\[\(http[^ ]*\) \([^]]*\)\]/[\2](http\1)/g
+
+# Converting the external link format which has a label without a protocol.
+s/\[\(www[^ ]*\) \([^]]*\)\]/[\2](www\1)/g
+
+# Converting headers.
+s/^===== *\(.*\) *=====$/##### \1/g
+s/^==== *\(.*\) *====$/#### \1/g
+s/^=== *\(.*\) *===$/### \1/g
+s/^== *\(.*\) *==$/## \1/g
+
+# Converting emphasis markers.
+s/'''/**/g
+s/''/*/g
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]