refworks plugin

FIXME This Plugin breaks image rendering as the syntax is the same to images: {{..}}

Compatible con DokuWiki

No hay compatibilidad sobre la información dada!

plugin Insert citations as links to a RefWorks RefShare

actualizado por última vez en
2007-10-17
Proporciona
Syntax

El hecho de que falte la URL de descarga, significa que esta extensión no se puede instalar mediante el Gestor de Extensiones. Consulta Publicar un plugin en Dokuwiki.org. Se recomienda el uso de hosts de repositorios públicos como GitHub, GitLab o Bitbucket.

La extensión no ha sido actualizada en al menos 2 años. Puede que ya no tenga soporte o no sea mantenida y tenga problemas de compatibilidad.

Similar a wikindx

Etiquetado con !broken, quotes, references

See http://rrowv.blogspot.com/2007/10/citation-management-and-interfacing.html for more info

syntax.php

The refworks URL needs to be set in the code (render() function).

<?php
/**
 * RefWorks Citation Module
 * Derived from: Plugin Skeleton, "cite" plugin
 * 
 * @license    GPL (http://www.gnu.org/licenses/gpl.html)
 * @author     Daniel Terry <dt232@cornell.edu>
 */
 
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');
 
 
 
/**
 * All DokuWiki plugins to extend the parser/rendering mechanism
 * need to inherit from this class
 */
class syntax_plugin_refworks extends DokuWiki_Syntax_Plugin
{ 
    //Report module information
    function getInfo()
    {
        return array(
            'author' => 'Daniel Terry',
            'email'  => 'dt232@cornell.edu',
            'date'   => '2007-10-17',
            'name'   => 'RefWorks Citation Module',
            'desc'   => 'Insert citations as links to a RefWorks RefShare',
            'url'    => 'http://www.dokuwiki.org/plugin:refworks',
        );
    }
 
    //
    function getType()  { return 'substition'; }
 
    // Just after build in links
    function getSort()  { return 217; }
 
    // Grab everything between {{ and }}
    function connectTo($mode)
    {
        $this->Lexer->addSpecialPattern('\{\{.+?\}\}',$mode,'plugin_refworks');
    }
 
//    function postConnect() {
//      $this->Lexer->addExitPattern('</TEST>','plugin_test');
//    }
 
 
    /**
     * Handle the match
     */
    function handle($match, $state, $pos, &$handler)
    {
 
        $data = trim(substr($match,2,-2)); // strip {{RefID= from start and }} from end
        $data = trim($data,";"); //remove trailing ;
        $ids = split(";",$data);        
 
        //Error checking??
        //if (!$data) {
        //    trigger_error('Bad RefWorks ID: '.htmlspecialchars($match), E_USER_WARNING);
        //    return FALSE;
        //}
 
 
        //Lookup data from RefWorks?
 
        return $ids;
    }
 
    /**
     * Create output
     */
    function render($mode, &$renderer, $data)
    {
        if($mode != 'xhtml')  { return false; }
 
 
        //RefWorks share URL:
        //http://www.refworks.com/refshare/?site=###/RWWS###/###
        //USER: PUT YOUR RefShare URL HERE!!!
        $RWURL  = "http://www.refworks.com/refshare/?site=...";
 
        $output = "";
 
        foreach ($data as $entry)
        {
            list($refid,$entry) = explode(" ",$entry,2);
            $output .= "<a href=\"$RWURL&rn=$refid\">$entry</a>; ";
        }
 
        $renderer->doc .= "[". substr($output,0,-2) ."]";
 
        return true;
    }
}
 
//Setup VIM: ex: et ts=4 enc=utf-8 :