[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-dev] SF.net SVN: supercollider:[8324] trunk/linux/scel/el/sclang-help.el
Revision: 8324
http://supercollider.svn.sourceforge.net/supercollider/?rev=8324&view=rev
Author: andersvi
Date: 2008-12-29 20:30:28 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
included html-filters to make p-tags display better with w3m - for use with 'w3m-filter
Modified Paths:
--------------
trunk/linux/scel/el/sclang-help.el
Modified: trunk/linux/scel/el/sclang-help.el
===================================================================
--- trunk/linux/scel/el/sclang-help.el 2008-12-29 19:37:46 UTC (rev 8323)
+++ trunk/linux/scel/el/sclang-help.el 2008-12-29 20:30:28 UTC (rev 8324)
@@ -63,6 +63,62 @@
:version "21.3"
:type 'string)
+;; dynamically change certain html-tags when displaying in w3m-browser:
+
+(defcustom sclang-help-filters
+ '(("p\\.p\\([0-9]+\\)" . "#p\\1")
+ ("<p class=\"\\(.*\\)\">\\(.*\\)</p>" . "<div id=\"\\1\">\\2</div>"))
+ "list of pairs of (regexp . filter) defining html-tags to be replaced by the function sclang-help-substitute-for-filters"
+ :group 'sclang-interface
+ :type '(repeat (cons (string :tag "match") (string :tag "replacement"))))
+
+(defun sclang-help-substitute-for-filters (&rest args)
+ "substitute various tags in SCs html-docs"
+ (mapcar #'(lambda (filter)
+ (let ((regexp (car filter))
+ (to-string (cdr filter)))
+ (goto-char (point-min))
+ (while (re-search-forward regexp nil t)
+ (replace-match to-string nil nil))))
+ sclang-help-filters))
+
+;; w3m's content-filtering system
+(setq w3m-use-filter t)
+
+(eval-after-load "w3m-filter"
+ '(add-to-list 'w3m-filter-rules
+ ;; run on all files read by w3m...
+ '(".*" sclang-help-substitute-for-filters)))
+
+
+;; dynamically change certain html-tags when displaying in w3m-browser:
+
+(defcustom sclang-help-filters
+ '(("p\\.p\\([0-9]+\\)" . "#p\\1")
+ ("<p class=\"\\(.*\\)\">\\(.*\\)</p>" . "<div id=\"\\1\">\\2</div>"))
+ "list of pairs of (regexp . filter) defining html-tags to be replaced by the function sclang-help-substitute-for-filters"
+ :group 'sclang-interface
+ :type '(repeat (cons (string :tag "match") (string :tag "replacement"))))
+
+(defun sclang-help-substitute-for-filters (&rest args)
+ "substitute various tags in SCs html-docs"
+ (mapcar #'(lambda (filter)
+ (let ((regexp (car filter))
+ (to-string (cdr filter)))
+ (goto-char (point-min))
+ (while (re-search-forward regexp nil t)
+ (replace-match to-string nil nil))))
+ sclang-help-filters))
+
+;; w3m's content-filtering system
+(setq w3m-use-filter t)
+
+(eval-after-load "w3m-filter"
+ '(add-to-list 'w3m-filter-rules
+ ;; run on all files read by w3m...
+ '(".*" sclang-help-substitute-for-filters)))
+
+
(defvar sclang-help-topic-alist nil
"Alist mapping help topics to file names.")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
_______________________________________________
sc-dev mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/