Commit acc2d8ba authored by adriana's avatar adriana

Import with [PATCH sourceforge] Initial HTML fixes, new PSGML site validation...

Import with [PATCH sourceforge] Initial HTML fixes, new PSGML site validation <uya31ubq5.fsf@ecf.teradyne.com>

--HG--
branch : adriana
parent 5e46a6b81984
2000-07-16 Adrian Aichner <aichner@ecf.teradyne.com>
* layout/template.html: Replace physical <b> markup with logical
<strong> markup.
2000-07-16 Adrian Aichner <aichner@ecf.teradyne.com>
* include/toc.gp: Change $pattern string to regexp to avoid
genpage warning: Unrecognized escape \s passed through at toc.gp
line 36.
2000-07-16 Adrian Aichner <aichner@ecf.teradyne.com>
* faq/xemacs-faq.html: Add completely missing DTD spec.
* faq/xemacs-faq_1.html: Ditto.
* faq/xemacs-faq_2.html: Ditto.
* faq/xemacs-faq_3.html: Ditto.
* faq/xemacs-faq_4.html: Ditto.
* faq/xemacs-faq_5.html: Ditto.
* faq/xemacs-faq_6.html: Ditto.
* faq/xemacs-faq_7.html: Ditto.
* faq/xemacs-faq_8.html: Ditto.
* faq/xemacs-faq_toc.html: Ditto.
* faq/xemacs-new.html: Ditto.
2000-07-16 Adrian Aichner <aichner@ecf.teradyne.com>
* upload/xemacs-faq.html: Remove empty lines after DTD.
* upload/xemacs-faq.html: Ditto.
* upload/xemacs-faq.html: Ditto.
* upload/xemacs-faq_2.html: Ditto.
* upload/xemacs-faq_3.html: Ditto.
* upload/xemacs-faq_4.html: Ditto.
* upload/xemacs-faq_5.html: Ditto.
* upload/xemacs-faq_6.html: Ditto.
* upload/xemacs-faq_8.html: Ditto.
* upload/xemacs-faq_toc.html: Ditto.
2000-07-16 Adrian Aichner <aichner@ecf.teradyne.com>
* oldstuff/index.html: Remove leading SPACE from file, translate
iso characters to SGML entities.
* oldstuff/xemacs-faq_1.html: Ditto.
* oldstuff/xemacs-faq_2.html: Ditto.
* oldstuff/xemacs-faq_3.html: Ditto.
* oldstuff/xemacs-faq_4.html: Ditto.
* oldstuff/xemacs-faq_4.html: Ditto.
* oldstuff/xemacs-faq_5.html: Ditto.
* oldstuff/xemacs-faq_6.html: Ditto.
* oldstuff/xemacs-faq_6.html: Ditto.
* oldstuff/xemacs-faq_7.html: Ditto.
* oldstuff/xemacs-faq_8.html: Ditto.
* oldstuff/xemacs-faq_toc.html: Ditto.
2000-07-16 Adrian Aichner <aichner@ecf.teradyne.com>
* old/index.html: Remove </PRE> garbage from BOF.
* old/xemacs-faq.html: Ditto.
2000-07-16 Adrian Aichner <aichner@ecf.teradyne.com>
* faq/index.content: Remove empty lines.
* faq/index.html: Remove leading SPACE in DTD spec.
2000-07-16 Adrian Aichner <aichner@ecf.teradyne.com>
* Links/tutorials_1.html: Add DTD spec.
* Links/tutorials_2.html: Ditto.
* Links/tutorials_3.html: Ditto.
* Links/tutorials_foot.html: Ditto.
* Links/tutorials_toc.html: Ditto.
2000-07-16 Adrian Aichner <aichner@ecf.teradyne.com>
* About/created.content: Fix HTML error.
2000-07-16 Adrian Aichner <aichner@ecf.teradyne.com>
* bin/genpage: UNIX/NT interpreter portability kludge, add XEmacs
mode selector -*-Perl-*-.
2000-07-16 Adrian Aichner <aichner@ecf.teradyne.com>
* Makefile (XEMACS): New.
* Makefile (WEBDIR): New.
* Makefile (gp): Use $(WEBDIR).
* Makefile (validate): New. Validate HTML documents with XEmacs.
* Makefile (extraclean): New. Clean examples and $(WEBDIR).
XEMACS="c:/XEmacs/XEmacs-21.1.11/i386-pc-win32/xemacs.exe"
FLAGS=-batch -q -no-site-file
WEBDIR=../htdocs
site: content/index.content
./bin/genpage -o $(WEBDIR)
validate:
$(XEMACS) $(FLAGS) -l ./batch-psgml-validate.el -f batch-psgml-validate $(WEBDIR)
clean:
rm -rf $(WEBDIR)
;;;
;;; $Id$
;;;
;;; Adrian Aichner, aichner@ecf.teradyne.com, Teradyne GmbH, 2000-07-16.
;;;
(require 'psgml)
(require 'psgml-parse) ;;; for sgml-element-context-string
(defconst psgml-validate-conform
"<small>Conform with "
"Phrase to insert for conforming SGML document.")
(defconst psgml-validate-non-conform
"<small><strong>Not</strong> conform with "
"Phrase to insert for non-conforming SGML document.")
(defun batch-psgml-validate (&optional file-or-dir)
"Uses `sgml-next-trouble-spot' from the PSGML package to validate
conformance of files in FILE-OR-DIR with the specified DTD. See
`batch-psgml-validate-buffer'. If FILE-OR-DIR is missing,
`batch-psgml-validate' is performed for each `command-line-args-left'."
(interactive "DHTML directory to validate: ")
(if (null file-or-dir)
(progn
(let (file-or-dir)
(while command-line-args-left
(setq file-or-dir (expand-file-name (car command-line-args-left)))
(batch-psgml-validate file-or-dir)
(setq command-line-args-left (cdr command-line-args-left)))))
(dolist (file (directory-files file-or-dir t nil nil nil))
(cond
((member (file-name-nondirectory file) (list "." ".."))
nil)
((file-directory-p file)
(batch-psgml-validate file))
((and
(member (file-name-extension file) (list "htm" "html"))
(null
(backup-file-name-p file)))
(message "validating %s" file)
(batch-psgml-validate-file file t t))))
(message "batch-psgml-validate %s is done" file-or-dir)))
(defun batch-psgml-validate-file (file &optional insert-result indent)
"Uses `sgml-next-trouble-spot' from the PSGML package to validate
conformance of FILE with the specified DTD. See
`batch-psgml-validate-buffer'."
(interactive
(list
(read-file-name "HTML file to validate: ")
(yes-or-no-p "insert compliance text ")
(yes-or-no-p "indent buffer ")))
(with-current-buffer
(find-file-noselect file)
(batch-psgml-validate-buffer insert-result indent)))
(defun batch-psgml-validate-buffer (&optional insert-result indent)
"Uses `sgml-next-trouble-spot' from the PSGML package to validate
conformance of buffer with the specified DTD. INSERT-RESULT inserts a
\(non-\)compliance messsage before \"</BODY>\". INDENT will
`indent-according-to-mode' as well. The buffer is saved in the end if
not called interactively."
(interactive
(list
(yes-or-no-p "insert compliance text ")
(yes-or-no-p "indent buffer ")))
(let (old-result-begin
old-result-end
new-result-begin
result)
(goto-char (point-min))
(condition-case err
(setq result (sgml-next-trouble-spot))
(error (message ">> Error: %s" (prin1-to-string err)))
(t (message "trouble: %s" (prin1-to-string err))))
(when insert-result
(goto-char (point-max))
(setq old-result-end
(re-search-backward "^\\s-*</body>" (point-min) t))
(while
(re-search-backward
(format "^\\s-*\\(%s\\|%s\\)"
psgml-validate-conform
psgml-validate-non-conform)
(point-min) t)
(setq old-result-begin (point)))
(and
old-result-begin
old-result-end
(delete-region
old-result-begin
old-result-end))
(insert
(format "%s"
(if (string= result "Ok")
psgml-validate-conform
psgml-validate-non-conform)))
(setq new-result-begin (point))
(unless (string= result "Ok")
(if sgml-last-element
(message "validation error in %s"
(sgml-element-context-string sgml-last-element)))
(message "validation error:%d:%s"
(count-lines (point-min) (point))
(buffer-file-name)))
(insert html-helper-htmldtd-version)
(html-quote-region new-result-begin (point))
(insert
", PSGML "
psgml-version ", "
emacs-version ".</small>\n"))
(when indent
(indent-region (point-min) (point-max) nil))
(if (noninteractive)
(if (buffer-modified-p)
(progn (message "Saving modified %s" (buffer-file-name))
(save-buffer))))))
# Example paramaters for genpage.
# Note: It's case sensitive for now.
# Command line options override what's in here!
#
template = template.html
contentdir = content
layoutdir = layout
outputdir = ../docs
force = 0
debug = 0
quiet = 0
ignore_regexp = ^.*\.news$|CVS|.*,v$|^\#.*\#$|.*~$
suffix = .html
glossary = layout/glossary
afterpass =
evalparam =
execute =
includedir = include
recipes = toc.gp
#! /usr/bin/perl -w
use File::Find;
find( \&changer , ( "content/Releases" ));
sub changer {
my $file = $_;
if ( $file =~ '.html' ) {
my $contents;
my $author;
my $title;
my $main;
my $newfile = $file;
$newfile =~ s/\.html/\.content/ ;
{
local $/;
undef $/;
open( IN , $file );
$contents = <IN>;
close( IN );
}
if ( $contents =~ m["author".*?content="(.*?)"]s ) { $author = $1; }
else { die( "no author in $file!\n") }
if ( $contents =~ m[<title>(.*?)</title>] ) { $title = $1; }
else { die( "no title in $file!\n" ) }
if ( $contents =~
m[<!-- content cell -->.*?<td align="left" valign="top">(.*)</td><!-- /content cell -->]s) {
$main = $1;
}
else { die( "no main in $file!\n" ) }
open( OUT , ">$newfile" );
print OUT <<EOF;
%title%
$title
%author%
$author
%main%
$main
EOF
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment