DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:codepad

This is an old revision of the document!


codepad Plugin

Compatible with DokuWiki

No compatibility info given!

plugin uses interpreters on codepad.org to execute sourcecode

Last updated on
2011-08-28

The missing download url means that this extension cannot be installed via the Extension Manager. Please see Publishing a Plugin on dokuwiki.org. Recommended are public repository hosts like GitHub, GitLab or Bitbucket.

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with code

By deshi

Installation

Install manually.

codepad\syntax.php

<?php
/**
 * Plugin barcode: 2D-Barcode Implementation
 * @author Enrico Croce & Simona Burzio (staff@eiroca.net)
 * @copyright Copyright (C) 2009-2011 eIrOcA - Enrico Croce & Simona Burzio
 * @license GPL >=3 (http://www.gnu.org/licenses/)
 * @version 1.0.2
 * @link http://www.eiroca.net
 */
if (!defined('DOKU_INC')) die();
if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
if (!defined('DOKU_PLUGIN_CODEPAD')) define('DOKU_PLUGIN_CODEPAD',DOKU_PLUGIN.'codepad/');
require_once (DOKU_PLUGIN.'syntax.php');

class syntax_plugin_codepad extends DokuWiki_Syntax_Plugin {
	function getType() { return 'substition'; }
	function getPType() { return 'normal'; }
	function getSort() { return 999; }
	function connectTo($mode) { 
		$this->Lexer->addSpecialPattern('~~codepad~~', $mode, 'plugin_codepad'); 
		//$this->Lexer->addSpecialPattern('~~codepad.*?~~', $mode, 'plugin_codepad'); 
	}
	
	function handle($match, $state, $pos, &$handler) {
		$match_array = array();
		//strip ~~codepad: from start and ~~ from end
		$match = substr($match,10,-2);
		// split parameters 
		// $match_array = explode(",", $match);
		// $match_array[0] will be language
		return $match_array;
	}
	/**
	 * Create output
	 */
	function render($mode, &$renderer, $data) {
		global $conf;
            if($mode == 'xhtml'){
                  $renderer->doc .= '<form action="http://codepad.org/" method="post" target=_blank>';
                  $renderer->doc .= '  <table width="100%" cellpadding="10">';
                  $renderer->doc .= '    <tbody>';			  
                  $renderer->doc .= '  <tr>';
                  $renderer->doc .= '    <td style="vertical-align: middle;"><textarea id="textarea" name="code" style="width: 100%;" rows="15" wrap="off"></textarea></td>';
                  $renderer->doc .= '  </tr>';
                  $renderer->doc .= '  <tr>';
                  $renderer->doc .= '    <td colspan="2" style="vertical-align: middle; text-align: right;">';
                  $renderer->doc .= '      <table width="100%" cellpadding="0" cellspacing="0"><tbody><tr>';
                  $renderer->doc .= '      <td style="text-align: right;">';
                  $renderer->doc .= '      <div style="float: right">';
                  $renderer->doc .= '      <table><tbody><tr>';
                  $renderer->doc .= '      <td>';
                  $renderer->doc .= '      <label style="margin-right:1em">';
                  $renderer->doc .= '        <input style="vertical-align: middle;" name="private" value="True" checked="checked" type="checkbox"><span style="vertical-align:middle" class="label">privat</span>';
                  $renderer->doc .= '      </label>';
                  $renderer->doc .= '      </td>';
                  $renderer->doc .= '      <td>';
                  $renderer->doc .= '      <label style="margin-right:1em">';
                  $renderer->doc .= '        <input style="vertical-align: middle;" name="run" value="True" checked="checked" type="checkbox"><span style="vertical-align:middle" class="label">Quellcode ausführen</span>';
                  $renderer->doc .= '      </label>';
                  $renderer->doc .= '      </td>';
                  $renderer->doc .= '      <td>';
                  $renderer->doc .= '      <label style="margin-right:1em">';
                  $renderer->doc .= '      <select id="lang" name="lang" style="vertical-align:middle"><option value="C">C</option><option value="C++">C++</option><option selected="selected" value="PHP">PHP</option></select>';
                  $renderer->doc .= '      </td>';
                  $renderer->doc .= '      <td style="text-align: right;">';
                  $renderer->doc .= '      <input name="submit" value="ausführen" type="submit">';
                  $renderer->doc .= '      </td>';
                  $renderer->doc .= '      </tr></tbody></table>';
                  $renderer->doc .= '      </div>';
                  $renderer->doc .= '      </td></tr></tbody></table>';
                  $renderer->doc .= '    </td>';
                  $renderer->doc .= '  </tr>';
                  $renderer->doc .= '  </tbody></table>';
                  $renderer->doc .= '  </form>';
                
				return true;
            }
            return false;
	}
}
?>

Examples/Usage

~~codepad~~

Syntax

~~codepad~~

Configuration and Settings

Development

[downloadable blocks, development comments]

Change Log

[preferable GitHub RSS feed or similar]

  • 2009-01-01
    • Initial release

Known Bugs and Issues

[this section might not be needed in case of external bug manager, or use RSS feed]

ToDo/Wish List

[developers roadmap]

FAQ

[discussions should ideally be deleted and turned into FAQ entries along the way]

Discussion

Could be placed on an external page (e.g. plugin:pluginname:discussion) to have a distinction between user comments and author docs

plugin/codepad.1314553219.txt.gz · Last modified: 2011-08-28 19:40 by 84.146.149.58

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki