Skip to content
Browse files

2 Initial import

darcs-hash:20070813121202-303ed-8c2833b0da661fb577f90f18601a5330cd7f6022.gz
  • Loading branch information...
0 parents commit 1645d9136eb6f2102b9505dce84ce00fd904d157 mbiolley committed Aug 13, 2007
Showing with 319 additions and 0 deletions.
  1. +16 −0 style.css
  2. +102 −0 syntax/deleted.php
  3. +99 −0 syntax/highlighted.php
  4. +102 −0 syntax/inserted.php
16 style.css
@@ -0,0 +1,16 @@
+div.dokuwiki ins {
+ background: #cfc;
+ color: #393;
+ text-decoration: none;
+ border-bottom: 1px dotted #393;
+}
+
+div.dokuwiki del {
+ background: #fcc;
+ color: #933;
+ text-decoration: line-through;
+}
+
+div.dokuwiki span.highlighted {
+ background-color: #ff6;
+}
102 syntax/deleted.php
@@ -0,0 +1,102 @@
+<?php
+/**
+ * Changemarks Plugin: mark deleted text with -->text--
+ *
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ * @author Esther Brunner <wikidesign@gmail.com>
+ */
+
+// must be run within Dokuwiki
+if(!defined('DOKU_INC')) die();
+
+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_changemarks_deleted extends DokuWiki_Syntax_Plugin {
+
+ var $ins = 'plugin_changemarks_deleted'; // instruction of this plugin
+
+ /**
+ * return some info
+ */
+ function getInfo(){
+ return array(
+ 'author' => 'Esther Brunner',
+ 'email' => 'wikidesign@gmail.com',
+ 'date' => '2007-08-13',
+ 'name' => 'Changemarks Plugin (deleted)',
+ 'desc' => 'Mark deleted text',
+ 'url' => 'http://www.wikidesign.ch/en/plugin/changemarks/start',
+ );
+ }
+
+ function getType(){ return 'formatting'; }
+ function getSort(){ return 122; }
+
+ function connectTo($mode){
+ $this->Lexer->addEntryPattern('<del[^\r\n]*?>(?=.*?</del>)', $mode, $this->ins);
+ $this->Lexer->addEntryPattern('\-\-[^\r\n]*?>(?=.*?\-\-)', $mode, $this->ins);
+ }
+
+ function postConnect(){
+ $this->Lexer->addExitPattern('\-\-', $this->ins);
+ $this->Lexer->addExitPattern('</del>', $this->ins);
+ }
+
+ /**
+ * Handle the match
+ */
+ function handle($match, $state, $pos, &$handler){
+ switch ($state){
+
+ // entry pattern with optional title
+ case DOKU_LEXER_ENTER:
+ // strip markup
+ if (substr($match, 0, 4) == '<del') $match = substr($match, 5, -1);
+ else $match = substr($match, 2, -1);
+ return array($state, $match);
+
+ // inserted text
+ case DOKU_LEXER_UNMATCHED:
+ return array($state, $match);
+
+ // exit pattern
+ case DOKU_LEXER_EXIT:
+ return array($state);
+
+
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Create output
+ */
+ function render($mode, &$renderer, $data) {
+ if (($mode == 'xhtml') && (is_array($data))){
+ switch ($data[0]){
+ case DOKU_LEXER_ENTER:
+ $title = ($data[1] ? ' title="'.hsc($data[1]).'"' : '');
+ $renderer->doc .= '<del'.$title.'>';
+ return true;
+ case DOKU_LEXER_UNMATCHED:
+ $renderer->doc .= hsc($data[1]);
+ return true;
+ case DOKU_LEXER_EXIT:
+ $renderer->doc .= '</del>';
+ return true;
+ default:
+ return false;
+ }
+ }
+ return false;
+ }
+
+}
+
+//Setup VIM: ex: et ts=4 enc=utf-8 :
99 syntax/highlighted.php
@@ -0,0 +1,99 @@
+<?php
+/**
+ * Changemarks Plugin: highlight text with !!>text!!
+ *
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ * @author Esther Brunner <wikidesign@gmail.com>
+ */
+
+// must be run within Dokuwiki
+if(!defined('DOKU_INC')) die();
+
+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_changemarks_highlighted extends DokuWiki_Syntax_Plugin {
+
+ var $ins = 'plugin_changemarks_highlighted'; // instruction of this plugin
+
+ /**
+ * return some info
+ */
+ function getInfo(){
+ return array(
+ 'author' => 'Esther Brunner',
+ 'email' => 'wikidesign@gmail.com',
+ 'date' => '2007-08-13',
+ 'name' => 'Changemarks Plugin (highlighted)',
+ 'desc' => 'Highlight text',
+ 'url' => 'http://www.wikidesign.ch/en/plugin/changemarks/start',
+ );
+ }
+
+ function getType(){ return 'formatting'; }
+ function getSort(){ return 123; }
+
+ function connectTo($mode){
+ $this->Lexer->addEntryPattern('\!\![^\r\n]*?>(?=.*?\!\!)', $mode, $this->ins);
+ }
+
+ function postConnect(){
+ $this->Lexer->addExitPattern('\!\!', $this->ins);
+ }
+
+ /**
+ * Handle the match
+ */
+ function handle($match, $state, $pos, &$handler){
+ switch ($state){
+
+ // entry pattern with optional title
+ case DOKU_LEXER_ENTER:
+ // strip markup
+ $match = substr($match, 2, -1);
+ return array($state, $match);
+
+ // inserted text
+ case DOKU_LEXER_UNMATCHED:
+ return array($state, $match);
+
+ // exit pattern
+ case DOKU_LEXER_EXIT:
+ return array($state);
+
+
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Create output
+ */
+ function render($mode, &$renderer, $data) {
+ if (($mode == 'xhtml') && (is_array($data))){
+ switch ($data[0]){
+ case DOKU_LEXER_ENTER:
+ $title = ($data[1] ? ' title="'.hsc($data[1]).'"' : '');
+ $renderer->doc .= '<span class="highlighted"'.$title.'>';
+ return true;
+ case DOKU_LEXER_UNMATCHED:
+ $renderer->doc .= hsc($data[1]);
+ return true;
+ case DOKU_LEXER_EXIT:
+ $renderer->doc .= '</span>';
+ return true;
+ default:
+ return false;
+ }
+ }
+ return false;
+ }
+
+}
+
+//Setup VIM: ex: et ts=4 enc=utf-8 :
102 syntax/inserted.php
@@ -0,0 +1,102 @@
+<?php
+/**
+ * Changemarks Plugin: mark inserted text with ++>text++
+ *
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ * @author Esther Brunner <wikidesign@gmail.com>
+ */
+
+// must be run within Dokuwiki
+if(!defined('DOKU_INC')) die();
+
+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_changemarks_inserted extends DokuWiki_Syntax_Plugin {
+
+ var $ins = 'plugin_changemarks_inserted'; // instruction of this plugin
+
+ /**
+ * return some info
+ */
+ function getInfo(){
+ return array(
+ 'author' => 'Esther Brunner',
+ 'email' => 'wikidesign@gmail.com',
+ 'date' => '2007-08-13',
+ 'name' => 'Changemarks Plugin (inserted)',
+ 'desc' => 'Mark inserted text',
+ 'url' => 'http://www.wikidesign.ch/en/plugin/changemarks/start',
+ );
+ }
+
+ function getType(){ return 'formatting'; }
+ function getSort(){ return 121; }
+
+ function connectTo($mode){
+ $this->Lexer->addEntryPattern('<ins[^\r\n]*?>(?=.*?</ins>)', $mode, $this->ins);
+ $this->Lexer->addEntryPattern('\+\+[^\r\n]*?>(?=.*?\+\+)', $mode, $this->ins);
+ }
+
+ function postConnect(){
+ $this->Lexer->addExitPattern('\+\+', $this->ins);
+ $this->Lexer->addExitPattern('</ins>', $this->ins);
+ }
+
+ /**
+ * Handle the match
+ */
+ function handle($match, $state, $pos, &$handler){
+ switch ($state){
+
+ // entry pattern with optional title
+ case DOKU_LEXER_ENTER:
+ // strip markup
+ if (substr($match, 0, 4) == '<ins') $match = substr($match, 5, -1);
+ else $match = substr($match, 2, -1);
+ return array($state, $match);
+
+ // inserted text
+ case DOKU_LEXER_UNMATCHED:
+ return array($state, $match);
+
+ // exit pattern
+ case DOKU_LEXER_EXIT:
+ return array($state);
+
+
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Create output
+ */
+ function render($mode, &$renderer, $data) {
+ if (($mode == 'xhtml') && (is_array($data))){
+ switch ($data[0]){
+ case DOKU_LEXER_ENTER:
+ $title = ($data[1] ? ' title="'.hsc($data[1]).'"' : '');
+ $renderer->doc .= '<ins'.$title.'>';
+ return true;
+ case DOKU_LEXER_UNMATCHED:
+ $renderer->doc .= hsc($data[1]);
+ return true;
+ case DOKU_LEXER_EXIT:
+ $renderer->doc .= '</ins>';
+ return true;
+ default:
+ return false;
+ }
+ }
+ return false;
+ }
+
+}
+
+//Setup VIM: ex: et ts=4 enc=utf-8 :

0 comments on commit 1645d91

Please sign in to comment.
Something went wrong with that request. Please try again.