]> git.plutz.net Git - shellwiki/commitdiff
improved syntax translation
authorPaul Hänsch <paul@plutz.net>
Thu, 7 Mar 2024 17:37:25 +0000 (18:37 +0100)
committerPaul Hänsch <paul@plutz.net>
Thu, 7 Mar 2024 17:37:25 +0000 (18:37 +0100)
moinimport.sh

index b747843310f5fc6dc48669094909a39a5b0d3a0e..1815a8379daf3dfec35a888730258d69da776f85 100755 (executable)
@@ -26,11 +26,11 @@ reformat() {
 
     s;^----+$;\n&;
 
-    s;\{\{attachment:(.*)\|(.*)\|(.*)\}\};![\2](\1 "\3");g
-    s;\{\{attachment:(.*)\|(.*)\}\};![\2](\1);g
-    s;\{\{attachment:(.*)\}\};![](\1);g
-    s;\[\[(.*)\|(.*)\|(.*)\]\];[\2](\1);g
-    s;\[\[(.*)\|(.*)\]\];[\2](\1);g
+    s;\{\{attachment:([^}|]*)\|([^}|]*)\|([^}|]*)\}\};![\2](\1 "\3");g
+    s;\{\{attachment:([^}|]*)\|([^}|]*)\}\};![\2](\1);g
+    s;\{\{attachment:([^}|]*)\}\};![](\1);g
+    s;\[\[([^]|]*)\|([^]|]*)\|([^]|]*)\]\];[\2](\1);g
+    s;\[\[([^]|]*)\|([^]|]*)\]\];[\2](\1);g
 
     /\{\{\{+#!wiki/{
       s;\{;:;g;
@@ -40,7 +40,7 @@ reformat() {
     /^\}\}\}+$/s;\};:;g;
 
     :MACRO
-    s;<<([^\(>]+)\(([^,)]+)([^)]*)\)>>;<<\1 "\2"(\3)>>;g;
+    s;<<([^\(>]+)\(([^,)]+),?([^)]*)\)>>;<<\1 "\2"(\3)>>;g;
     tMACRO
     s;<<([^\(>]+)\(\)>>;<<\1>>;g;
   '