function htmltidy_fix_linenums in HTML Tidy 5
Same name and namespace in other branches
- 6 htmltidy.module \htmltidy_fix_linenums()
- 7 htmltidy.module \htmltidy_fix_linenums()
Adjust the line numbers in an array of htmltidy errors or warnings.
Parameters
$array array of warning or error strings.:
$adjustment integer to add to each line number (negative values are: allowed).
Return value
array
1 call to htmltidy_fix_linenums()
- htmltidy_fragment in ./
htmltidy.module - Tidies an incomplete fragment of HTML by passing it through htmltidy full, then stripping back down to the 'body'.
File
- ./
htmltidy.module, line 284
Code
function htmltidy_fix_linenums(&$array, $adjustment) {
for ($i = count($array) - 1; $i >= 0; $i--) {
$array[$i] = preg_replace_callback('|(line) (\\d+)|', create_function('$matches', 'return $matches[1] ." ". (int) ($matches[2] +' . $adjustment . ');'), $array[$i]);
}
}