DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:nocode

nocode plugin

Compatible with DokuWiki

2009-02-14+

plugin Removes Indentation for Code

Last updated on
2010-06-02
Provides
Syntax

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, indentation, substition

Download and Installation

Just copy the file below to a directory named nocode inside your plugin directory

syntax.php
<?php
/**
 * nocode-Plugin: Removes the Indentation for Code Syntax
 * 
 * Syntax: none
 *
 * @license GPL 2
 * @author Franz Häfner <fhaefner@informatik.tu-cottbus.de>
 */
 
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');
 
class syntax_plugin_nocode extends DokuWiki_Syntax_Plugin {
    /**
     * return some info
     */
    function getInfo(){
	return array(
    	    'email'  => 'fhaefner@informatik.tu-cottbus.de',
    	    'date'   => '2010-06-02',
    	    'name'   => 'Remove Indentation for Code',
    	    'desc'   => 'Remove Indentation for Code',
	    'url'    => 'http://studiy.tu-cottbus.de/',
	);
    }
 
    function getType(){ return 'substition';}
    function getPType(){ return 'normal';}
    function getSort(){ return 19; }
 
    function connectTo($mode) {
        // Has hard coded awareness of lists...
        $this->Lexer->addSpecialPattern('\n  (?![\*\-])',$mode,'plugin_nocode');
        $this->Lexer->addSpecialPattern('\n\t(?![\*\-])',$mode,'plugin_nocode');
    }
 
    function handle($match, $state, $pos, &$handler) {
	// do nothing
	return true;
    }
 
    function render($mode, &$renderer, $data) {
	// do nothing again
	return;
    }
}

Description

Removes the syntax that allows to use the code-environment to be created by indenting text with two spaces or a tab.

Syntax and Usage

Since syntax from the original DokuWiki-Syntax is removed there is no need for syntax.

Discussion

plugin/nocode.txt · Last modified: 2023-10-30 23:18 by Klap-in

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