Skip to content

Latest commit

 

History

History
84 lines (48 loc) · 2.2 KB

LangTag.ReadMe.md

File metadata and controls

84 lines (48 loc) · 2.2 KB

LangTag.php

What it does

LangTag.php is a command-line PHP script which can process an HTML file.

It will look for the <body> and <html> tags.

It will move any attributes lang=... or xml:lang=... from the <body> tag up to the <html> tag

Configuration

LangTag.php will look for a file LangTag.config.txt nearby. In that file you can set or override configuration options.

The names of these options are case-sensitive.

attrsToMove

List of attributes to move from body tag to html tag. Will normally include 2 names: lang, and xml:lang.

Example:

attrsToMove = lang, xml:lang

acceptFileNameExtensions

Optional. The script will ignore any files whose file name does not end in one of the listed extensions

The default when this is omitted is:

acceptFileNameExtensions = html, htm, xhtml

backupFileNameExtension

Optional. The file name extension to use for backup files

The default when this is omitted is:

backupFileNameExtension = old

defaultIfMissing

If there is no lang or xml:lang set on the body tag, use this as a default instead

lockHTMLHeader

Must be set to 'false'. By default the <html> tag is locked from being modified by the DropScript. Setting this to false allows this DropScript to change the html tag attributes.

logLevel

Set to 0, 1, 2, 3, or 4. Depending on the number, more or less logging information will be provided. Useful for diagnostics when the script does not seem to work correctly.

The default when this is omitted is:

logLevel = 0

maxBackupCount

Optional. How many backup files to keep.

The default when this is omitted is:

maxBackupCount = 5

If maxBackupCount is 0, no backups are made

If maxBackupCount is greater than zero the backups will be

SomeFile.xhtml ->
    SomeFile.xhtml.old
    SomeFile.xhtml_1.old
    SomeFile.xhtml_2.old
    ...
    SomeFile.xhtml_5.old

The SomeFile.xhtml.old is special: once made, it is never overwritten. It stores the content of the original file from before you ran the script for the first time.

SomeFile.xhtml_1.old, SomeFile.xhtml_2.old... rotate. The _1 file is the latest, the _5 file is the oldest.