Installation
Quick Take
Examples
Purpose
This program detects, is a character at a given index in a given string being a closing of an attribute. In healthy code, that’s normally a double quotes character.
This program is aimed at fixing seriously broken HTML code — missing closing quotes, mismatching closing quotes, swapped quotes and unencoded “content” quotes as a part of attribute’s value.
It’s driving the codsen-tokenizer
which in turn powers codsen-parser
which in turn powers emlint
.
For healthy HTML code, however, finding the closing double quotes is a trivial task.
API — isAttrClosing()
The main function isAttrClosing()
is imported like this:
It’s a function which takes three input arguments:
Input argument | Type | Obligatory | Description |
---|---|---|---|
str Type: String Obligatory: yes | |||
str | String | yes | The input string of zero or more characters |
idxOfAttrOpening Type: Natural number or zero Obligatory: yes | |||
idxOfAttrOpening | Natural number or zero | yes | Index of an opening quote of an attribute |
isThisClosingIdx Type: Natural number Obligatory: yes | |||
isThisClosingIdx | Natural number | yes | Index we ask this program to evaluate, is it a closing quote |
The function returns a boolean.
If anything is wrong with the input arguments, the program returns false. It never throws.
API — version
You can import version
: