1 ;;; html5-schema.el --- Add HTML5 schemas for use by nXML -*- lexical-binding: t; -*-
3 ;; Copyright (C) 2016 Free Software Foundation, Inc
5 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
8 ;; URL: https://github.com/validator/validator
11 ;; This program is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
16 ;; This program is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
26 ;; The RelaxNG files are taken straight from
27 ;; https://github.com/validator/validator.git's via:
29 ;; git subtree -P schema/html5 split
31 ;; To which we manually add `locating-rules.xml` and this file.
37 (let* ((dir (file-name-directory load-file-name))
38 (file (expand-file-name "locating-rules.xml" dir)))
39 (eval-after-load 'rng-loc
41 (add-to-list 'rng-schema-locating-files-default 'file)
42 ;; FIXME: We should only push to rng-schema-locating-files-default,
43 ;; since rng-schema-locating-files is a custom var, but by the time
44 ;; we run, rng-schema-locating-files has already been initialized
45 ;; from rng-schema-locating-files-default, so setting
46 ;; rng-schema-locating-files-default doesn't have any effect
48 (add-to-list 'rng-schema-locating-files ,file)
49 (put 'http://whattf.org/datatype-draft 'rng-dt-compile
50 #'nxml-html5-dt-compile)))))
53 (add-to-list 'auto-mode-alist '("\\.html?\\'" . nxml-mode))
55 (defvar nxml-html5-dt-params nil)
56 (defvar nxml-html5-dt-names nil)
59 (defun nxml-html5-dt-compile (name params)
60 ;; FIXME: How/when is `params' ever used? It seems to always be nil!
61 (add-to-list 'nxml-html5-dt-params params)
62 (add-to-list 'nxml-html5-dt-names name)
63 ;; FIXME: We currently don't do any actual validation of datatypes!
66 (provide 'html5-schema)
67 ;;; html5-schema.el ends here