From b672ba367d346b06eb09c63cc7c3b17b6db0f803 Mon Sep 17 00:00:00 2001 From: Igor Date: Thu, 4 Nov 2010 22:49:41 +0300 Subject: tag (just like , but with semantics in mind) --- conf/default.php | 3 ++- syntax.php | 13 +++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/conf/default.php b/conf/default.php index f4357d5..6ae34fc 100644 --- a/conf/default.php +++ b/conf/default.php @@ -9,5 +9,6 @@ $conf['year_min'] = '2001'; $conf['papers_ns'] = 'papers'; $conf['filetypes'] = array('PDF', 'DjVu', 'PS', 'TIFF'); -$conf['bibtex'] = 'публикации'; // Wiki page with bibtex data +$conf['papers'] = 'публикации'; // Wiki page with bibtex data +$conf['grants'] = 'гранты'; diff --git a/syntax.php b/syntax.php index 4f2b2ad..622887b 100644 --- a/syntax.php +++ b/syntax.php @@ -35,12 +35,14 @@ class syntax_plugin_papers extends DokuWiki_Syntax_Plugin { $this->Lexer->addEntryPattern('(?=.*)', $mode, 'plugin_papers'); $this->Lexer->addEntryPattern('(?=.*)', $mode, 'plugin_papers'); + $this->Lexer->addEntryPattern('(?=.*)', $mode, 'plugin_papers'); } function postConnect() { $this->Lexer->addExitPattern('', 'plugin_papers'); $this->Lexer->addExitPattern('', 'plugin_papers'); + $this->Lexer->addExitPattern('', 'plugin_papers'); } function handle($match, $state, $pos, &$handler) @@ -55,7 +57,7 @@ class syntax_plugin_papers extends DokuWiki_Syntax_Plugin return array($state, $tag, '', array()); case DOKU_LEXER_UNMATCHED : - if ($tag === 'papers') // Parse ... + if ($tag === 'papers' || $tag === 'grants') { $spec = array(); $fields = preg_split('/\s*\n\s*/u', $match); @@ -63,9 +65,11 @@ class syntax_plugin_papers extends DokuWiki_Syntax_Plugin { if (preg_match('/\s*(\w+?)\s*=\s*(.*)/u', $f, $m)) { - $spec[$m[1]] = $m[2]; + $spec[mb_strtolower($m[1])] = $m[2]; } } + + // begin: display options, not BiBTeX fields $source = ''; if (isset($spec['source'])) { @@ -74,7 +78,7 @@ class syntax_plugin_papers extends DokuWiki_Syntax_Plugin } else { - $source = wikiFN($this->getConf('bibtex')); + $source = wikiFN($this->getConf($tag)); } $options = array(); @@ -86,6 +90,7 @@ class syntax_plugin_papers extends DokuWiki_Syntax_Plugin unset($spec[$o]); } } + // end: display options, not BiBTeX fields $bibtex = (!isset($options['byyear']) || $options['byyear']) ? new BibtexParserTeam() : new BibtexParserWorker(); @@ -96,7 +101,7 @@ class syntax_plugin_papers extends DokuWiki_Syntax_Plugin $bibtex->sort(); return array($state, $tag, $bibtex, $options); } - elseif ($tag === 'bibtex') // Parse ... + elseif ($tag === 'bibtex') { $bibtex = new BibtexParserTeam(); $bibtex->read_text($match); -- cgit v1.2.3