(メッセージはありません)
@@ -31,6 +31,7 @@ | ||
31 | 31 | ;; [0.9.4] |
32 | 32 | ;; 1. Fixed some bugs. |
33 | 33 | ;; 2. Added predoc-open-alink() function ( and bind to C-m key ) |
34 | +;; 3. Supported "http://host/path/of/contents... " string convert into `a' tag. ( necessary to install emacs-w3m ) | |
34 | 35 | ;; |
35 | 36 | ;; [0.9.3] |
36 | 37 | ;; 1. Added costomize variable `predoc-curl-program' |
@@ -404,9 +405,10 @@ | ||
404 | 405 | predoc-image-prefix-list |
405 | 406 | "\\|") |
406 | 407 | "\\)")) |
408 | + (_url-pattern | |
409 | + "\\(http://[^\t ]+\\|.+html?\\)") | |
407 | 410 | (_url_file-pattern |
408 | 411 | "\\(http://[^\t ]+\\|.+html?\\)[\t ]+\\([^\t ]+\\)")) |
409 | - | |
410 | 412 | (let ((cur (point)) |
411 | 413 | (str (buffer-substring-no-properties (point) (point-at-eol)))) |
412 | 414 | (cond |
@@ -466,7 +468,17 @@ | ||
466 | 468 | (delete-region (match-beginning 1) (match-end 2)) |
467 | 469 | (goto-char (match-beginning 1)) |
468 | 470 | (insert (format "<a href=\"%s\" />%s</a>" url str)))) |
469 | - ;; No match | |
471 | + ;; http://host/path/of/contents... | |
472 | + ((string-match (concat "^" _url-pattern) str) | |
473 | + (re-search-forward _url-pattern (point-at-eol) t) | |
474 | + (if (boundp 'w3m-version) | |
475 | + (let* ((url (match-string 1)) | |
476 | + (title (or (w3m-arrived-title url) | |
477 | + "NoTitle"))) | |
478 | + (delete-region (match-beginning 1) (match-end 1)) | |
479 | + (goto-char (match-beginning 1)) | |
480 | + (insert (format "<a href=\"%s\" />%s</a>" url title))) | |
481 | + (message "Predoc: Please install emacs-w3m."))) | |
470 | 482 | (t |
471 | 483 | (message "Predoc: <a> link format is URL_or_FILENAME STRING' . ")))))) |
472 | 484 |
@@ -518,4 +530,4 @@ | ||
518 | 530 | (add-hook 'sgml-mode-hook 'predoc-mode-hookfunc) |
519 | 531 | |
520 | 532 | (provide 'predoc) |
521 | -;; predoc.el ends here | |
533 | +;; predoc-mode.el ends here |