Fix obnoxious "the X::Y manpage" links.
authorSean O'Rourke <seano@foobar.local>
Wed, 28 Nov 2012 00:26:23 +0000 (27 16:26 -0800)
committerSean O'Rourke <seano@foobar.local>
Wed, 28 Nov 2012 00:26:23 +0000 (27 16:26 -0800)
sepia-w3m.el

index 25bd6a3..a66a83e 100644 (file)
@@ -58,6 +58,9 @@
             (while (re-search-forward
                     "<a href=\"about://perldoc\\(-buffer\\)?/\\([^\"]*\\)\\(\\.html\\)\">" nil t)
               (delete-region (match-beginning 3) (match-end 3))
+              (save-match-data
+                (when (looking-at "the \\(\\S-+\\) manpage")
+                  (replace-match (match-string 1))))
               (save-restriction
                 (narrow-to-region (match-beginning 2) (match-end 2))
                 (while (search-backward "/" nil t)
         (message "POD errors in %s" buf)
         (display-buffer (current-buffer))))))
 
+(defadvice w3m-about-perldoc (after fix-the-manpage)
+  "Handle about://perldoc-buffer/ links."
+  (when (string-match "\\`about://perldoc/" url)
+    (goto-char (point-min))
+    (while (re-search-forward
+            "<a href=\"about://perldoc/\\([^\"]*\\)\\(\\.html\\)\">" nil t)
+      (save-match-data
+        (when (looking-at "the \\(\\S-+\\) manpage")
+          (replace-match (match-string 1)))))
+    "text/html"))
+
 ;;;###autoload
 (defun sepia-w3m-view-pod (&optional buffer)
   (require 'w3m)