raster pushed a commit to branch master.

http://git.enlightenment.org/website/www.git/commit/?id=09f5f33d00a76d67411a9175f3a740188e84a058

commit 09f5f33d00a76d67411a9175f3a740188e84a058
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Wed Jun 24 13:00:23 2015 +0900

    wiki plugin - add note plugin as requested
---
 public_html/lib/plugins/note/.gitignore            |   1 +
 public_html/lib/plugins/note/images/important.png  | Bin 0 -> 2250 bytes
 public_html/lib/plugins/note/images/note.png       | Bin 0 -> 2520 bytes
 .../lib/plugins/note/images/tb_important.png       | Bin 0 -> 1366 bytes
 public_html/lib/plugins/note/images/tb_note.png    | Bin 0 -> 1461 bytes
 public_html/lib/plugins/note/images/tb_tip.png     | Bin 0 -> 1441 bytes
 public_html/lib/plugins/note/images/tb_warning.png | Bin 0 -> 1870 bytes
 public_html/lib/plugins/note/images/tip.png        | Bin 0 -> 2909 bytes
 public_html/lib/plugins/note/images/warning.png    | Bin 0 -> 3249 bytes
 public_html/lib/plugins/note/info.txt              |   8 +
 public_html/lib/plugins/note/script.js             |  36 ++++
 public_html/lib/plugins/note/style.css             |  41 +++++
 public_html/lib/plugins/note/syntax.php            | 191 +++++++++++++++++++++
 public_html/lib/tpl/e/css/modifications.css        |  40 +++++
 14 files changed, 317 insertions(+)

diff --git a/public_html/lib/plugins/note/.gitignore 
b/public_html/lib/plugins/note/.gitignore
new file mode 100644
index 0000000..f3c7a7c
--- /dev/null
+++ b/public_html/lib/plugins/note/.gitignore
@@ -0,0 +1 @@
+Makefile
diff --git a/public_html/lib/plugins/note/images/important.png 
b/public_html/lib/plugins/note/images/important.png
new file mode 100644
index 0000000..dc8c8a4
Binary files /dev/null and b/public_html/lib/plugins/note/images/important.png 
differ
diff --git a/public_html/lib/plugins/note/images/note.png 
b/public_html/lib/plugins/note/images/note.png
new file mode 100644
index 0000000..df1e0a9
Binary files /dev/null and b/public_html/lib/plugins/note/images/note.png differ
diff --git a/public_html/lib/plugins/note/images/tb_important.png 
b/public_html/lib/plugins/note/images/tb_important.png
new file mode 100644
index 0000000..d853518
Binary files /dev/null and 
b/public_html/lib/plugins/note/images/tb_important.png differ
diff --git a/public_html/lib/plugins/note/images/tb_note.png 
b/public_html/lib/plugins/note/images/tb_note.png
new file mode 100644
index 0000000..f5c9316
Binary files /dev/null and b/public_html/lib/plugins/note/images/tb_note.png 
differ
diff --git a/public_html/lib/plugins/note/images/tb_tip.png 
b/public_html/lib/plugins/note/images/tb_tip.png
new file mode 100644
index 0000000..f127e91
Binary files /dev/null and b/public_html/lib/plugins/note/images/tb_tip.png 
differ
diff --git a/public_html/lib/plugins/note/images/tb_warning.png 
b/public_html/lib/plugins/note/images/tb_warning.png
new file mode 100644
index 0000000..892c833
Binary files /dev/null and b/public_html/lib/plugins/note/images/tb_warning.png 
differ
diff --git a/public_html/lib/plugins/note/images/tip.png 
b/public_html/lib/plugins/note/images/tip.png
new file mode 100644
index 0000000..2000f20
Binary files /dev/null and b/public_html/lib/plugins/note/images/tip.png differ
diff --git a/public_html/lib/plugins/note/images/warning.png 
b/public_html/lib/plugins/note/images/warning.png
new file mode 100644
index 0000000..3c8a37d
Binary files /dev/null and b/public_html/lib/plugins/note/images/warning.png 
differ
diff --git a/public_html/lib/plugins/note/info.txt 
b/public_html/lib/plugins/note/info.txt
new file mode 100644
index 0000000..5226345
--- /dev/null
+++ b/public_html/lib/plugins/note/info.txt
@@ -0,0 +1,8 @@
+# General Plugin Info do not edit
+
+author Olivier Cortès / Eric Hameleers / Christopher Smith / Aurélien Bompard
+email  ol...@deep-ocean.net
+date   2009-06-15
+name   Note Plugin
+desc   Add Note/Important/Tip/Warning Capability (DIV+CSS box)
+url    http://www.dokuwiki.org/plugin:note
diff --git a/public_html/lib/plugins/note/script.js 
b/public_html/lib/plugins/note/script.js
new file mode 100644
index 0000000..c211207
--- /dev/null
+++ b/public_html/lib/plugins/note/script.js
@@ -0,0 +1,36 @@
+/* Add Note buttons to the toolbar */
+/* from http://wiki.splitbrain.org/wiki:tips:toolbarbutton */
+
+/* Disabled because this does not allow to select a text and turn it into a 
note like the type:format does
+var notes_arr = new Array(); // key = insertion string , value = icon filename.
+notes_arr['<note></note>\\n']='tb_note.png';
+notes_arr['<note tip></note>\\n']='tb_tip.png';
+notes_arr['<note important></note>\\n']='tb_important.png';
+notes_arr['<note warning></note>\\n']='tb_warning.png';
+
+toolbar[toolbar.length] = {"type":"picker",
+                           "title":"Notes",
+                           "icon":"../../plugins/note/images/tb_note.png",
+                           "key":"",
+                           "list": notes_arr,
+                           "icobase":"../plugins/note/images"};
+*/
+ 
+if(toolbar){ 
+    toolbar[toolbar.length] = {"type":"format", "title":"note", "key":"", 
+                               "icon":"../../plugins/note/images/tb_note.png", 
+                               "open":"<note>", "close":"</note>"
+                              }; 
+    toolbar[toolbar.length] = {"type":"format", "title":"tip", "key":"", 
+                               "icon":"../../plugins/note/images/tb_tip.png", 
+                               "open":"<note tip>", "close":"</note>"
+                              }; 
+    toolbar[toolbar.length] = {"type":"format", "title":"important", "key":"", 
+                               
"icon":"../../plugins/note/images/tb_important.png", 
+                               "open":"<note important>", "close":"</note>"
+                              }; 
+    toolbar[toolbar.length] = {"type":"format", "title":"warning", "key":"", 
+                               
"icon":"../../plugins/note/images/tb_warning.png", 
+                               "open":"<note warning>", "close":"</note>"
+                              }; 
+}
diff --git a/public_html/lib/plugins/note/style.css 
b/public_html/lib/plugins/note/style.css
new file mode 100644
index 0000000..8b97dea
--- /dev/null
+++ b/public_html/lib/plugins/note/style.css
@@ -0,0 +1,41 @@
+.noteclassic, .noteimportant, .notewarning, .notetip {
+  margin: 2em;
+  margin-left: auto;
+  margin-right: auto;
+  width: 70% !important;
+  min-height: 40px;
+  clear: both;
+  text-align: justify;
+  vertical-align: middle;
+  border-collapse: collapse;
+  padding: 15px 20px 15px 80px;
+  background-position: 20px 50%;
+  background-repeat: no-repeat;
+  -moz-border-radius: 20px;
+  -khtml-border-radius: 20px;
+  border-radius: 20px;
+}
+ 
+.noteclassic {
+  /*border: 1px solid #99D;*/
+  background-color: #eef;
+  background-image: url(images/note.png);
+}
+ 
+.noteimportant {
+  /*border: 1px solid #ff0;*/
+  background-color: #ffc;
+  background-image: url(images/important.png);
+}
+ 
+.notewarning {
+  /*border: 1px solid #d99;*/
+  background-color: #fdd;
+  background-image: url(images/warning.png);
+}
+ 
+.notetip {
+  /*border: 1px solid #9d9;*/
+  background-color: #dfd;
+  background-image: url(images/tip.png);
+}
diff --git a/public_html/lib/plugins/note/syntax.php 
b/public_html/lib/plugins/note/syntax.php
new file mode 100644
index 0000000..368d0d4
--- /dev/null
+++ b/public_html/lib/plugins/note/syntax.php
@@ -0,0 +1,191 @@
+<?php
+/**
+ * Add Note capability to dokuwiki
+ *
+ * <note>This is note</note>
+ * <note classic>This is note</note>
+ * <note important>This is an important note</note>
+ * <note warning>This is a big warning</note>
+ * <note tip>This is a tip</note>
+ *
+ * by Olivier Cortès <ol...@deep-ocean.net>
+ * under the terms of the GNU GPL v2.
+ *
+ * Originaly derived from the work of :
+ * Stephane Chamberland <stephane.chamberl...@ec.gc.ca> (Side Notes PlugIn)
+ * Carl-Christian Salvesen <ca...@ioslo.net> (Graphviz plugin)
+ *
+ * Contributions by Eric Hameleers <alien [at] slackware [dot] com> :
+ *   use <div> instead of <table>,
+ *   contain the images and stylesheet inside the plugin,
+ *   permit nesting of notes,
+ *
+ * Contributed by Christopher Smith <chris [at] jalakai [dot] co [dot] uk>
+ *   fix some parsing problems and a security hole.
+ *   make note types case independent
+ *   simplify code reading
+ *   modernise the plugin for changes/fixes/improvements to the underlying 
Dokuwiki plugin class,
+ *   improve efficiency.
+ *
+ * Contributed by Aurélien Bompard <aurelien [at] bompard [dot] org>
+ *   support for the ODT output format.
+ *
+ * @license    GNU_GPL_v2
+ * @author     Olivier Cortes <ol...@deep-ocean.net>
+ */
+ 
+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_note extends DokuWiki_Syntax_Plugin {
+ 
+    var $notes = array(
+        'noteimportant' => array('important', 'importante'),
+        'notewarning'   => array('warning','bloquante','critique'),
+        'notetip'       => array('tip','tuyau','idée'),
+        'noteclassic'   => array('','classic','classique')
+      );
+      
+    var $default = 'noteclassic';
+  
+    function getInfo(){
+        return confToHash(dirname(__FILE__).'/info.txt');
+    }
+ 
+ 
+    function getType(){ return 'container'; }
+    function getPType(){ return 'normal'; }
+    function getAllowedTypes() { 
+        return 
array('container','substition','protected','disabled','formatting','paragraphs');
+    }
+    function getSort(){ return 195; }
+
+    // override default accepts() method to allow nesting 
+    // - ie, to get the plugin accepts its own entry syntax
+    function accepts($mode) {
+      if ($mode == substr(get_class($this), 7)) return true;
+        return parent::accepts($mode);
+      }
+
+    function connectTo($mode) {
+        
$this->Lexer->addEntryPattern('<note.*?>(?=.*?</note>)',$mode,'plugin_note');
+    }
+    function postConnect() {
+        $this->Lexer->addExitPattern('</note>','plugin_note');
+    }
+ 
+    function handle($match, $state, $pos, &$handler){
+
+        switch ($state) {
+
+          case DOKU_LEXER_ENTER : 
+            $note = strtolower(trim(substr($match,5,-1)));
+ 
+            foreach( $this->notes as $class => $names ) {
+              if (in_array($note, $names))
+                return array($state, $class);
+            }            
+            
+            return array($state, $this->default);          
+ 
+          case DOKU_LEXER_UNMATCHED :
+            return array($state, $match);
+        
+          default:
+            return array($state);
+        }
+    }
+ 
+    function render($mode, &$renderer, $indata) {
+
+        if($mode == 'xhtml'){
+
+          list($state, $data) = $indata;
+
+          switch ($state) {
+            case DOKU_LEXER_ENTER :
+              $renderer->doc .= '<p><div class="'.$data.'">';
+              break;
+  
+            case DOKU_LEXER_UNMATCHED :
+              $renderer->doc .= $renderer->_xmlEntities($data);
+              break;
+  
+            case DOKU_LEXER_EXIT :
+              $renderer->doc .= "\n</div></p>";
+              break;
+          }
+          return true;
+
+        } elseif ($mode == 'odt'){
+
+          list($state, $data) = $indata;
+
+          switch ($state) {
+            case DOKU_LEXER_ENTER :
+              $type = substr($data, 4);
+              if ($type == "classic") {
+                $type = "note"; // the icon for classic notes is named note.png
+              }
+              $colors = array("note"=>"#eeffff", "warning"=>"#ffdddd", 
"important"=>"#ffffcc", "tip"=>"#ddffdd");
+              $renderer->autostyles["pluginnote"] = '
+                  <style:style style:name="pluginnote" style:family="table">
+                      <style:table-properties style:width="15cm" 
table:align="center" style:shadow="#808080 0.18cm 0.18cm"/>
+                  </style:style>';
+              $renderer->autostyles["pluginnote.A"] = '
+                  <style:style style:name="pluginnote.A" 
style:family="table-column">
+                      <style:table-column-properties 
style:column-width="1.5cm"/>
+                  </style:style>';
+              $renderer->autostyles["pluginnote.B"] = '
+                  <style:style style:name="pluginnote.B" 
style:family="table-column">
+                      <style:table-column-properties 
style:column-width="13.5cm"/>
+                  </style:style>';
+              $renderer->autostyles["pluginnote".$type.".A1"] = '
+                  <style:style style:name="pluginnote'.$type.'.A1" 
style:family="table-cell">
+                      <style:table-cell-properties 
style:vertical-align="middle" fo:padding="0.1cm" fo:border-left="0.002cm solid 
#000000" fo:border-right="none" fo:border-top="0.002cm solid #000000" 
fo:border-bottom="0.002cm solid #000000" 
fo:background-color="'.$colors[$type].'"/>
+                  </style:style>';
+              $renderer->autostyles["pluginnote".$type.".B1"] = '
+                  <style:style style:name="pluginnote'.$type.'.B1" 
style:family="table-cell">
+                      <style:table-cell-properties 
style:vertical-align="middle" fo:padding="0.3cm" fo:border-left="none" 
fo:border-right="0.002cm solid #000000" fo:border-top="0.002cm solid #000000" 
fo:border-bottom="0.002cm solid #000000" 
fo:background-color="'.$colors[$type].'"/>
+                  </style:style>';
+              // Content
+              $renderer->p_close();
+              $renderer->doc .= '<table:table table:name="" 
table:style-name="pluginnote">';
+              $renderer->doc .= '<table:table-column 
table:style-name="pluginnote.A"/>';
+              $renderer->doc .= '<table:table-column 
table:style-name="pluginnote.B"/>';
+              $renderer->doc .= '<table:table-row>';
+              $renderer->doc .= '<table:table-cell 
table:style-name="pluginnote'.$type.'.A1" office:value-type="string">';
+              // Don't use p_open, as it's not the same style-name
+              $renderer->doc .= '<text:p text:style-name="Table_20_Contents">';
+              $src = DOKU_PLUGIN."note/images/".$type.".png";
+              $renderer->_odtAddImage($src);
+              $renderer->doc .= '</text:p>';
+              $renderer->doc .= '</table:table-cell>';
+              $renderer->doc .= '<table:table-cell 
table:style-name="pluginnote'.$type.'.B1" office:value-type="string">';
+              $renderer->p_open();
+              break;
+  
+            case DOKU_LEXER_UNMATCHED :
+              $renderer->cdata($data);
+              break;
+  
+            case DOKU_LEXER_EXIT :
+              $renderer->p_close();
+              $renderer->doc .= '</table:table-cell>';
+              $renderer->doc .= '</table:table-row>';
+              $renderer->doc .= '</table:table>';
+              $renderer->p_open();
+              break;
+          }
+          return true;
+        }
+        
+        // unsupported $mode
+        return false;
+    } 
+}
+ 
+//Setup VIM: ex: et ts=4 enc=utf-8 :
+?>
diff --git a/public_html/lib/tpl/e/css/modifications.css 
b/public_html/lib/tpl/e/css/modifications.css
index f7f9c6f..66329ad 100644
--- a/public_html/lib/tpl/e/css/modifications.css
+++ b/public_html/lib/tpl/e/css/modifications.css
@@ -405,6 +405,8 @@ dd {
 .dd {
    color: #606060;
    margin-left: 40px;
+   margin-top: 10px;
+   margin-bottom: 10px;
    background-color: #202020;
    border-radius: 4px;
    padding: 6px;
@@ -536,3 +538,41 @@ input#qsearch__in {
    background-color: #101010;
    color: #888888;
 }
+
+.noteclassic,
+.noteimportant,
+.notetip,
+.notewarning {
+   color: #ffffff;
+   background-color: #000000;
+   width: 90% !important;
+   border: 0px;
+   margin: 10px auto;
+   border-radius: 4px;
+   padding: 25px 25px 25px 80px;
+}
+
+.noteclassic {
+   background-color: #000000;
+   background-image: url("/_media/note-classic.svg");
+}
+
+.noteimportant {
+   background-color: #221a00;
+   background-image: url("/_media/note-important.svg");
+}
+
+.notetip {
+   background-color: #082204;
+   background-image: url("/_media/note-tip.svg");
+}
+
+.notewarning {
+   background-color: #220404;
+   background-image: url("/_media/note-warning.svg");
+}
+
+table {
+   margin-top: 10px;
+   margin-bottom: 10px;
+}

-- 


Reply via email to