You are here

public static function GeshiFilterProcess::processSourceCode in GeSHi Filter for syntax highlighting 8

Same name and namespace in other branches
  1. 8.2 src/GeshiFilterProcess.php \Drupal\geshifilter\GeshiFilterProcess::processSourceCode()

General geshifilter processing function for a chunk of source code.

@paran array $special_lines Lines to highlight.

Parameters

string $source_code: Source code to process.

string $lang: Language from sourcecode.

int $line_numbering: The line numbering mode, one of LINE_NUMBERS_* from GeshiFilter class.

int $linenumbers_start: The line number to start from.

bool $inline_mode: When to write all styles inline or from a css.

string $title: The title to use in code.

array $special_lines: An array with the number of lines to highlight.

Return value

string The sourcecode after process by Geshi.

1 call to GeshiFilterProcess::processSourceCode()
GeshiFilterFilter::replaceCallback in src/Plugin/Filter/GeshiFilterFilter.php
Callback for preg_replace_callback.

File

src/GeshiFilterProcess.php, line 171

Class

GeshiFilterProcess
Helpers functions related to processing the source code with geshi.

Namespace

Drupal\geshifilter

Code

public static function processSourceCode($source_code, $lang, $line_numbering = 0, $linenumbers_start = 1, $inline_mode = FALSE, $title = NULL, array $special_lines = []) {
  $config = \Drupal::config('geshifilter.settings');

  // Process.
  if ($lang == 'php' && $config
    ->get('use_highlight_string_for_php', FALSE)) {
    return self::highlightStringProcess($source_code, $inline_mode);
  }
  else {

    // Process with GeSHi.
    return self::geshiProcess($source_code, $lang, $line_numbering, $linenumbers_start, $inline_mode, $title, $special_lines);
  }
}