aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor <pashev.igor@gmail.com>2010-11-10 15:17:08 +0300
committerIgor <pashev.igor@gmail.com>2010-11-10 15:17:08 +0300
commitf1c473be59369e909ccc54a49fdfd8cfebc6be8a (patch)
treeb2312e9395b320424caef8b935d0ed427e44c7d4
parent67f72f1a617371b2ea1a235872315120ea1683f5 (diff)
downloaddokuwiki-plugin-papers-f1c473be59369e909ccc54a49fdfd8cfebc6be8a.tar.gz
Support for Translate plugin (automatically choose source for <papers> and <grants>)
-rw-r--r--bibtex.php2
-rw-r--r--syntax.php10
2 files changed, 8 insertions, 4 deletions
diff --git a/bibtex.php b/bibtex.php
index 7f36063..88904d4 100644
--- a/bibtex.php
+++ b/bibtex.php
@@ -57,7 +57,7 @@ class BibtexParser
$this->ENTRIES[$bibent]['id'] = strtolower($matches[2]);
// e. g. $ENTRIES['pashev_2010_axiom']['entry'] = 'book'
}
- elseif (preg_match('/(\w+?)\s*=\s*(.*?)\s*,?\s*$/u', $line, $matches))
+ elseif (preg_match('/^\s*(\w+?)\s*=\s*(.*?)\s*,?\s*$/u', $line, $matches))
{
$this->ENTRIES[$bibent][strtolower($matches[1])] = $matches[2];
/* e. g.
diff --git a/syntax.php b/syntax.php
index a9260ee..27c1eb6 100644
--- a/syntax.php
+++ b/syntax.php
@@ -58,6 +58,7 @@ class syntax_plugin_papers extends DokuWiki_Syntax_Plugin
function handle($match, $state, $pos, &$handler)
{
static $tag;
+ global $ID;
switch ($state)
{
case DOKU_LEXER_ENTER :
@@ -81,15 +82,18 @@ class syntax_plugin_papers extends DokuWiki_Syntax_Plugin
// begin: display options, not BiBTeX fields
$source = '';
+ $lang = $this->getLangPart($ID);
+ if (!empty($lang)) $source .= $lang . ':';
if (isset($spec['source']))
{
- $source = wikiFN($spec['source']);
+ $source .= $spec['source'];
unset($spec['source']);
}
else
{
- $source = wikiFN($this->getConf($tag));
+ $source .= $this->getConf($tag);
}
+ $source = wikiFN($source);
$options = array('byyear' => 0);
foreach(array('raw', 'byyear', 'recent') as $o)
@@ -163,7 +167,7 @@ class syntax_plugin_papers extends DokuWiki_Syntax_Plugin
function getLangPart($id)
{
- if (preg_match('/^' . $this->langs_rx . '/', $id, $match))
+ if (preg_match('/^' . $this->langs_rx . ':/', $id, $match))
{
return $match[1];
}