You are here

function htmltidy_fix_linenums in HTML Tidy 6

Same name and namespace in other branches
  1. 5 htmltidy.module \htmltidy_fix_linenums()
  2. 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 247
The theme system, which controls the output of Drupal. The htmltidy module uses Tidy (http://tidy.sf.net) to properly format HTML for saving and display.

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]);
  }
}