5 Commit-ok f0d0942bfb ... 99af4d984d

Szerző SHA1 Üzenet Dátum
  Alex Schroeder 99af4d984d Handle [an example](#foo "Title") 1 éve
  Alex Schroeder 88f4fe3b89 Whitespace 1 éve
  Sandra Snan 851f2f77e8 Handle image/right 1 éve
  Alex Schroeder 975e15c9f8 Don't turn all whitespace into a space 2 éve
  Alex Schroeder d235d6ac47 GetId returns the normal form of $id. 2 éve
4 módosított fájl, 18 hozzáadás és 9 törlés
  1. 3 3
      modules/mail.pl
  2. 9 0
      modules/markdown-rule.pl
  3. 4 4
      stuff/gemini-server.pl
  4. 2 2
      wiki.pl

+ 3 - 3
modules/mail.pl

@@ -505,9 +505,9 @@ sub MailUnsubscribe {
 
 =head1 Migrate
 
-The mailmigrate action will migrate your subscription list from the
-old format to the new format. This is necessary because these days
-because the keys and values of the DB_File are URL encoded.
+The mailmigrate action will migrate your subscription list from the old format
+to the new format. This is necessary because these days the keys and values of
+the DB_File are URL encoded.
 
 =cut
 

+ 9 - 0
modules/markdown-rule.pl

@@ -203,6 +203,15 @@ sub MarkdownRule {
     $params{-title} = $title if $title;
     return $q->a(\%params, $text);
   }
+  # link: [an example](#foo "Title")
+  elsif (m/\G\[((?:[^]\n]+\n?)+)\]\((#\S)+(\s+"(.+?)")?\)/cg) {
+    my ($text, $url, $title) = ($1, $2, $4);
+    my %params;
+    $params{-href} = $url;
+    $params{-class} = "named-anchor";
+    $params{-title} = $title if $title;
+    return $q->a(\%params, $text);
+  }
   # setext headers (must come after block quotes)
   elsif ($bol and m/\G((\s*\n)*(.+?)[ \t]*\n(-+|=+)[ \t]*\n)/cg) {
     return CloseHtmlEnvironments()

+ 4 - 4
stuff/gemini-server.pl

@@ -675,10 +675,10 @@ sub gemini_text {
     $block =~ s/\[\[tag:([^]|]+)\]\]/push(@links, $self->gemini_link("tag\/$1", $1)); $1/ge;
     $block =~ s/\[\[tag:([^]|]+)\|([^\]|]+)\]\]/push(@links, $self->gemini_link("tag\/$1", $2)); $2/ge;
     $block =~ s/<journal search tag:(\S+)>\n*/push(@links, $self->gemini_link("tag\/$1", "Explore the $1 tag")); ""/ge;
-    $block =~ s/\[\[image:([^]|]+)\]\]/push(@links, $self->gemini_link($1, "$1 (image)")); "$1"/ge;
-    $block =~ s/\[\[image:([^]|]+)\|([^\]|]+)\]\]/push(@links, $self->gemini_link($1, "$2 (image)")); "$2"/ge;
-    $block =~ s/\[\[image:([^]|]+)\|([^\]|]*)\|([^\]|]+)\]\]/push(@links, $self->gemini_link($1, "$2 (image)"), $self->gemini_link($3, "$2 (follow-up)")); "$2"/ge;
-    $block =~ s/\[\[image:([^]|]+)\|([^\]|]*)\|([^\]|]*)\|([^\]|]+)\]\]/push(@links, $self->gemini_link($1, "$2 (image)"), $self->gemini_link($3, "$4 (follow-up)")); "$2"/ge;
+    $block =~ s/\[\[image(?:\/right)?:([^]|]+)\]\]/push(@links, $self->gemini_link($1, "$1 (image)")); "$1"/ge;
+    $block =~ s/\[\[image(?:\/right)?:([^]|]+)\|([^\]|]+)\]\]/push(@links, $self->gemini_link($1, "$2 (image)")); "$2"/ge;
+    $block =~ s/\[\[image(?:\/right)?:([^]|]+)\|([^\]|]*)\|([^\]|]+)\]\]/push(@links, $self->gemini_link($1, "$2 (image)"), $self->gemini_link($3, "$2 (follow-up)")); "$2"/ge;
+    $block =~ s/\[\[image(?:\/right)?:([^]|]+)\|([^\]|]*)\|([^\]|]*)\|([^\]|]+)\]\]/push(@links, $self->gemini_link($1, "$2 (image)"), $self->gemini_link($3, "$4 (follow-up)")); "$2"/ge;
     $block =~ s/\[\[$FreeLinkPattern\|([^\]|]+)\]\]/push(@links, $self->gemini_link($1, $2)); $2/ge;
     $block =~ s/\[\[$FreeLinkPattern\]\]/push(@links, $self->gemini_link($1)); $1/ge;
     $block =~ s/\[color=([^]]+)\]/color($1)/ge;

+ 2 - 2
wiki.pl

@@ -514,7 +514,7 @@ sub ApplyRules {
 	Clean(CloseHtmlEnvironments() . AddHtmlEnvironment('p')); # another one like this further up
       } elsif (m/\G&amp;([A-Za-z]+|#[0-9]+|#x[A-Za-f0-9]+);/cg) { # entity references
 	Clean("&$1;");
-      } elsif (m/\G\s+/cg) {
+      } elsif (m/\G[ \t\r\n]+/cg) { # don't use \s because we want to honor NO-BREAK SPACE etc
 	Clean(' ');
       } elsif (m/\G([A-Za-z\x{0080}-\x{fffd}]+([ \t]+[a-z\x{0080}-\x{fffd}]+)*[ \t]+)/cg
 	       or m/\G([A-Za-z\x{0080}-\x{fffd}]+)/cg or m/\G(\S)/cg) {
@@ -1313,7 +1313,7 @@ sub GetId {
       SetParam($p, 1);    # script/p/q -> p=1
     }
   }
-  return $id;
+  return FreeToNormal($id);
 }
 
 sub DoBrowseRequest {