emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master a426434 23/23: * html5-schema: Add locating-rules.xml and


From: Stefan Monnier
Subject: [elpa] master a426434 23/23: * html5-schema: Add locating-rules.xml and setup nxml to use it
Date: Thu, 14 Jan 2016 19:22:41 +0000

branch: master
commit a42643459f0e32e3cda87d652c9f2602316f13b1
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * html5-schema: Add locating-rules.xml and setup nxml to use it
---
 packages/html5-schema/html5-schema.el    |   67 ++++++++++++++++++++++++++++++
 packages/html5-schema/locating-rules.xml |    9 ++++
 2 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/packages/html5-schema/html5-schema.el 
b/packages/html5-schema/html5-schema.el
new file mode 100644
index 0000000..5fff760
--- /dev/null
+++ b/packages/html5-schema/html5-schema.el
@@ -0,0 +1,67 @@
+;;; html5-schema.el --- Add HTML5 schemas for use by nXML  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2016  Free Software Foundation, Inc
+
+;; Author: Stefan Monnier <address@hidden>
+;; Keywords: html, xml
+;; Version: 0.1
+;; URL: https://github.com/validator/validator
+;; Package-Type: multi
+
+;; 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 3 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, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; The RelaxNG files are taken straight from
+;; https://github.com/validator/validator.git's via:
+;;
+;;     git subtree -P schema/html5 split
+;;
+;; To which we manually add `locating-rules.xml` and this file.
+
+;;; Code:
+
+;;;###autoload
+(when load-file-name
+  (let* ((dir (file-name-directory load-file-name))
+         (file (expand-file-name "locating-rules.xml" dir)))
+    (eval-after-load 'rng-loc
+      `(progn
+         (add-to-list 'rng-schema-locating-files-default 'file)
+         ;; FIXME: We should only push to rng-schema-locating-files-default,
+         ;; since rng-schema-locating-files is a custom var, but by the time
+         ;; we run, rng-schema-locating-files has already been initialized
+         ;; from rng-schema-locating-files-default, so setting
+         ;; rng-schema-locating-files-default doesn't have any effect
+         ;; any more!
+         (add-to-list 'rng-schema-locating-files ,file)
+         (put 'http://whattf.org/datatype-draft 'rng-dt-compile
+              #'nxml-html5-dt-compile)))))
+
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.html?\\'" . nxml-mode))
+
+(defvar nxml-html5-dt-params nil)
+(defvar nxml-html5-dt-names nil)
+
+;;;###autoload
+(defun nxml-html5-dt-compile (name params)
+  ;; FIXME: How/when is `params' ever used?  It seems to always be nil!
+  (add-to-list 'nxml-html5-dt-params params)
+  (add-to-list 'nxml-html5-dt-names name)
+  ;; FIXME: We currently don't do any actual validation of datatypes!
+  '(t identity))
+
+(provide 'html5-schema)
+;;; html5-schema.el ends here
diff --git a/packages/html5-schema/locating-rules.xml 
b/packages/html5-schema/locating-rules.xml
new file mode 100644
index 0000000..86b2bb1
--- /dev/null
+++ b/packages/html5-schema/locating-rules.xml
@@ -0,0 +1,9 @@
+<!-- <?xml version="1.0"?> -->
+<locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0";>
+  <uri pattern="*.html" typeId="HTML5" />
+  <uri pattern="*.xhtml" typeId="XHTML5" />
+  <namespace ns="http://www.w3.org/1999/xhtml"; typeId="XHTML5"/>
+  <documentElement localName="html" typeId="HTML5" />
+  <typeId id="XHTML5" uri="xhtml5.rnc" />
+  <typeId id="HTML5" uri="html5.rnc" />
+</locatingRules>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]