mirror of
https://github.com/cosmocode/dokuwiki-plugin-aichat.git
synced 2025-07-23 01:03:06 +00:00
exclude page parts from indexing using a regex
This commit is contained in:
@ -53,4 +53,5 @@ $conf['logging'] = 0;
|
||||
$conf['restrict'] = '';
|
||||
$conf['skipRegex'] = ':(playground|sandbox)(:|$)';
|
||||
$conf['matchRegex'] = '';
|
||||
$conf['ignoreRegex'] = '';
|
||||
$conf['preferUIlanguage'] = 0;
|
||||
|
@ -60,6 +60,7 @@ $meta['logging'] = array('onoff');
|
||||
$meta['restrict'] = array('string');
|
||||
$meta['skipRegex'] = array('string');
|
||||
$meta['matchRegex'] = array('string');
|
||||
$meta['ignoreRegex'] = array('string');
|
||||
$meta['preferUIlanguage'] = array('multichoice', '_choices' => array(
|
||||
\dokuwiki\plugin\aichat\AIChat::LANG_AUTO_ALL,
|
||||
\dokuwiki\plugin\aichat\AIChat::LANG_UI_ALL,
|
||||
|
@ -45,6 +45,7 @@ $lang['logging'] = 'Log all questions and answers. Use the <a href="?do=admin&pa
|
||||
$lang['restrict'] = 'Restrict access to these users and groups (comma separated). Leave empty to allow all users.';
|
||||
$lang['skipRegex'] = 'Skip indexing pages matching this regular expression (no delimiters).';
|
||||
$lang['matchRegex'] = 'Only index pages matching this regular expression (no delimiters).';
|
||||
$lang['ignoreRegex'] = 'Ignore parts of the page content matching this regular expression (no delimiters).';
|
||||
$lang['preferUIlanguage'] = 'How to work with multilingual wikis? (Requires the translation plugin)';
|
||||
|
||||
$lang['preferUIlanguage_o_0'] = 'Guess language, use all sources';
|
||||
|
@ -87,6 +87,12 @@ class renderer_plugin_aichat extends Doku_Renderer_xhtml
|
||||
{
|
||||
$this->doc = preg_replace("/(\r?\n){3,}/", "\n\n", $this->doc);
|
||||
$this->doc = ltrim($this->doc); // remove leading space and empty lines
|
||||
|
||||
// remove ignored parts
|
||||
$regex = $this->getConf('ignoreRegex');
|
||||
if($regex) {
|
||||
$this->doc = preg_replace('/' . $regex . '/i', '', $this->doc);
|
||||
}
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
|
Reference in New Issue
Block a user