From 1008a9ec698df2c8e4e93e53b9d42d76e1432475 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Thu, 7 Oct 1999 17:00:07 +0000 Subject: [PATCH] Initial revision --- v7/src/edwin/htmlmode.scm | 72 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 v7/src/edwin/htmlmode.scm diff --git a/v7/src/edwin/htmlmode.scm b/v7/src/edwin/htmlmode.scm new file mode 100644 index 000000000..c679adc14 --- /dev/null +++ b/v7/src/edwin/htmlmode.scm @@ -0,0 +1,72 @@ +;;; -*-Scheme-*- +;;; +;;; $Id: htmlmode.scm,v 1.1 1999/10/07 17:00:07 cph Exp $ +;;; +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;;;; Major Mode for HTML + +(declare (usual-integrations)) + +(define-major-mode html text "HTML" + "Major mode for editing HTML." + (lambda (buffer) + (local-set-variable! syntax-table html-syntax-table buffer) + (local-set-variable! indent-line-procedure + (ref-command indent-relative) + buffer) + (local-set-variable! paragraph-separate html-paragraph-separator buffer) + (local-set-variable! paragraph-start html-paragraph-separator buffer) + (local-set-variable! syntax-ignore-comments-backwards #f buffer) + (local-set-variable! comment-locator-hook html-comment-locate buffer) + (local-set-variable! comment-indent-hook html-comment-indentation buffer) + (local-set-variable! comment-start "" buffer) + (local-set-variable! + sentence-end + "[.?!][]\"')}]*\\(<[^>]*>\\)*\\($\\| $\\|\t\\| \\)[ \t\n]*" + buffer) + (event-distributor/invoke! (ref-variable html-mode-hook buffer) buffer))) + +(define html-paragraph-separator + "^[ \t]*$\\|^[ \t]*$") + +(define-command html-mode + "Enter HTML mode." + () + (lambda () (set-current-major-mode! (ref-mode-object html)))) + +(define-variable html-mode-hook + "An event distributor that is invoked when entering HTML mode." + (make-event-distributor)) + +(define html-syntax-table + (let ((syntax-table (make-syntax-table text-mode:syntax-table))) + (modify-syntax-entry! syntax-table #\< "(>1") + (modify-syntax-entry! syntax-table #\! ". 2") + (modify-syntax-entry! syntax-table #\- "_ 3") + (modify-syntax-entry! syntax-table #\> ")<4") + (modify-syntax-entry! syntax-table #\" "\"\"") + syntax-table)) + +(define (html-comment-locate mark) + (and (re-search-forward "