USAGE NOTES
static site checker
https://ssc.lu/
(c) 2020-2022 Dylan Harris


Running SSC
===========
To run SSC, bring up the command line, change to ssc's installation
directory, and type:

    Windows: ssc
    Unix: ./ssc

If it is installed correctly, it should respond with (c) info.

It is possible to set up configuration files, but, to start, we'll try
a simple set of command line options. It the HTML files belonging to
your website is located in DIR, and the main index file is called
index.html, then all you need type is:

ssc DIR

and off it will go, reporting on any issues it finds in all HTML files
in DIR and its descendants.


reports
-------
When ssc reports issues, it reports the HTML where it realised there
was a problem, with the corresponding line number. This may be after
the actual point of the problem. Consider, for example:

<P>Taost<A href="https://example.com/superdoopersecretrecipe.html"
title="what a wonderful page oh so wow" onclick="haltandcatchfire"
onhover="winkembarrassingly" wimper=frequently>d wombats are a
delicious</A> thing.</P>

The word ssc spots is "taostd". It knows there's a word to check when
it gets to the end of the word, e.g. at the space that follows it. In
this case, the word is interrupted by rather a lot of HTML, which is
ignored when checking spelling. Because the intervening HTML is so
long, crossing a number of lines, and ssc reports small snippets of
HTML per issue, to avoid spouting too much verbiage, it will not show
sufficient HTML to see the entire misspelt word. That's why, for some
errors, you must take the HTML snippet and corresponding line number as
a hint, not an absolute. There is an issue, it is near the reported
HTML and line number, but, in this case, is not actually there. Of
course, the report of the misspelt word does report the word it
considers misspelt (here, "taostd").


switches
--------
SSC has a number of switches:

-h	        Output simple help
-V	        Output the version of SSC
-f file	    Load a runtime configuration from file
-F	        Load a runtime configuration from ~/.ssc/config

-o file     Output report to file

-v x	    Report level x issues, where x is
	0 None
	1 Catastrophes
	2 Errors
	3 Warnings
	4 Info
	5 Comments
	6 Debug
	7... more and more debug

-I	        Process Server Side Includes
-g dir      set website root directory (defaults to current directory)
-x xxx      treat files with extension xxx as HTML/XHTML (may be
            repeated)
-i file     file is index file in directories (default index.html)
-s dom      dom is the local sites domain name (may be repeated)
-L arg      Define virtual directory (arg is formatted
            virtual=physical) (may be repeated)

-e	        Check external links (each link is checked once per run,
            not once per encounter)
-3	        Report HTTP 301 and 308 as errors (e.g. forwarding)
-l	        Check internal links
-O	        Report each broken link only once, not each time it occurs
-r	        Do not check whether https certificates have been revoked
-X	        Check crosslinked IDs (e.g. id attribute)

-M	        Check microformats.org set using class attribute
-m	        Check ontologies set using WhatWG microdata attributes

-S	        Report site statistics

A longer list of switches is given by the -h switch.


Environment
-----------
SSC will process the following environment variables:
SSC_CONFIG  name of configuration file if none given on the command
            line
SSC_ARGS    command line switches

SSC will recognise when it is running in a CGI environment by
processing QUERY_STRING and other CGI environment variables. In such
circumstances, QUERY_STRING must contain a parameter called
html.snippet, with an appropriate value.



Configuration Files
===================

SSC will accept configuration files in INI file format. Here are some
examples, mostly adapted from the tests:


A simple configuration file
---------------------------
[general]
verbose=4
output=ssc.out
class=yes

[site]
domain=example.edu
extension=html
index=index.html
root=~/www/htdocs

The website for example.edu can be found in ~/www.htdocs. Standard
index files are called index.html, and html files always have the html
extension.

The configuration outputs errors, warnings and info messages to
ssc.out. It analyses class identifiers, so will scan CSS files for
class names.


Links and virtual directories
-----------------------------
[general]
verbose=4
output=ssc.out

[site]
domain=example.edu
extension=html
index=index.html
root=~/www/htdocs
virtual=/net=tests/virtual

[link]
check=yes
external=yes
xlink=yes

Beyond the previous example, SSC will also check links, including
external links and crosslinked ids.

The configuration file specifies a virtual directory. When a link
refers to the local directory /net, SSC will seek the corresponding
file(s) in tests/virtual (relative to the current directory, not the
root).


Microformats
------------
[general]
verbose=4
output=ssc.out
class=yes

[site]
domain=example.edu
extension=html
index=index.html
root=~/www/htdocs

[microformat]
verify=yes

The only new thing here is to turn on microformats analysis (class
analysis is required).


Microdata
------------
[general]
verbose=4
output=ssc.out
class=yes

[site]
domain=example.edu
extension=html
index=index.html
root=~/www/htdocs

Actually, SSC will report on any microdata it finds, no matter what.
Note that, if you use itemref in your pages, ssc may give false
warnings in the section referenced by the itemref. This is because ssc
does not always know that the referenced data is not intended to be
used in its own right, unless you put it under a TEMPLATE element.

You can export the microdata encountered in JSON file format by using
the export setting (not shown).


Statistics
----------
[general]
ssi=yes
verbose=4
output=ssc.out
class=yes

[site]
domain=example.edu
extension=html
extension=shtml
index=index.html
root=~/www/htdocs

[stats]
summary=yes

Turn on summary statistics, which produces a grand total at the end of
a complete run (add page=yes below summary for individual page stats).

Note that server side includes have been turned on using general.ssi,
and files with the SHTML extension will be treated as web pages.


MathML 2
--------
This configuration file could be used to test MathML 2.

[general]
verbose=4
output=m2.out
class=yes

[link]
check=yes

[site]
domain=example.edu
extension=html
index=index.html
root=~/www/htdocs

[math]
version=2

[validation]
citype=function
citype=list
citype=logical
citype=matrix
citype=set
citype=var-x
citype=vector

What's interesting here is the validation section. The MathML
documentation lists a specific set of values that can be used with the
TYPE attribute on the CI element. The examples in the specification
give this attribute many additional, and apparently illegal, values.
(This apparent inconsistency is not uncommon amongst web
specifications.) The way to avoid SSC complaining about these extra
values is to give CI TYPE additional values in the configuration file,
as noted.

Indeed, many enumerated attribute values can be extended in this way.
Use the --validation switch to get a complete list.


arts & ego
----------
This is the configuration file I used to analyse my site.

[general]
verbose=4
class=yes
output=ssc.out
ssi=yes

[site]
domain=dylanharris.org
extension=shtml
extension=html
extension=htm
extension=asp
index=index.shtml
root=X:\Site

[link]
check=yes
xlink=yes

[microformat]
verify=yes

[stats]
summary=yes

My site has been built by hand over the decades, and is full of errors.
I wrote ssc because I was frustrated that I could find no tool to
properly check it. Unfortunately, SSC is too successful: it finds
hundreds of errors in arts & ego. I am slowly making the repairs.


Potential gotchas
=================

Versions
--------
For HTML, ssc defaults to a version of the living standard that's
contemporary to the version of ssc. The same applies to other document
types. In all cases, though, if the document itself specifies a
particular version (such as HTML 3.2), then that applies.

The version indicated by the DOCTYPE can be very broad. For example,
the HTML 5 doctype specifies HTML 5 alone, but not which flavour (W3 or
living standard), nor which revision.

If you are verifying HTML, and it contains some MathML, SVG, or other
such snippets, then ssc will attempt to guess the version of the latter
from the former (unless you tell it which to use).

All this is why that, if you want to be precise about document
verification, specify versions, either with a switch or an entry in a
configuration file. If your HTML contains MathML/SVG/etc. snippets,
then specify those versions too.
