DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:source

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:source [2013-09-24 15:34] 177.69.173.214plugin:source [2023-10-30 22:58] (current) Klap-in
Line 2: Line 2:
  
 ---- plugin ---- ---- plugin ----
-description: Allows you to include all or part of the contents of another file, with syntax highlighting, into the current page. +description: Allows you to include all or part of the contents of another file, with syntax highlighting, into the current page 
-author     : Christopher Smit+author     : Christopher Smith
 email      : chris@jalakai.co.uk email      : chris@jalakai.co.uk
 type       : syntax type       : syntax
 lastupdate : 2008-08-13 lastupdate : 2008-08-13
-compatible : 2007-06-26 and later, 2006-11-06+compatible : Hrun
 depends    :  depends    : 
 conflicts  conflicts 
Line 59: Line 59:
  
 ===== Installation ===== ===== Installation =====
 +Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
 +
  
-This plugin can be installed by the [[plugin:plugin]] manager using the following packages: 
   * [[http://dokuwiki.jalakai.co.uk/plugin-source.zip|zip format (8k)]]   * [[http://dokuwiki.jalakai.co.uk/plugin-source.zip|zip format (8k)]]
   * [[http://dokuwiki.jalakai.co.uk/plugin-source.tar.gz|tar.gz format (5k)]]   * [[http://dokuwiki.jalakai.co.uk/plugin-source.tar.gz|tar.gz format (5k)]]
  
-Or using [[http://darcs.net/DarcsWiki|darcs]] 
-  * [[http://wiki.jalakai.co.uk/repo/dokuwiki/plugins/source|darcs repository]] 
- 
-=== Manual Installation === 
- 
-Download one of the first two packages to your plugin folder, ''lib/plugins'' and extract its contents.  That will create a new plugin folder, ''lib/plugins/source'' and install the plugin there. 
  
-The folder will contain: 
-  conf/ 
-  conf/default.php                       default setting values 
-  conf/metadata.php                      setting details for DokuWiki's configuration plugin 
-  lang/ 
-  lang/xx/                               directory for each supported language, will always include 'en' 
-  lang/xx/lang.php                       language strings used by the plugin itself 
-  lang/xx/setting.php                    language strings used by DokuWiki's configuration plugin 
-  action.php                             action plugin component - provides caching support 
-  style.css                              styles for the new boxes and titles 
-  syntax.php                             syntax plugin component 
  
-The plugin is now installed. 
  
 ===== Revision History ===== ===== Revision History =====
Line 93: Line 76:
     * add support for (basic) rules to govern source file access. The rules work in addition to the earlier 'location','allow' & 'deny' criteria. It is probably sensible to use one or the other.  That is, if you use rules set the other three settings to empty string.     * add support for (basic) rules to govern source file access. The rules work in addition to the earlier 'location','allow' & 'deny' criteria. It is probably sensible to use one or the other.  That is, if you use rules set the other three settings to empty string.
     * add support for line number selection.     * add support for line number selection.
-    * add support for any renderer format.  If a format other than 'XHTML' or 'metadata' is chosen, the plugin reads the appropriate lines from the source file and passes them to DokuWiki's ->code() method to be rendered in the same was as a code block+    * add support for any renderer format.  If a format other than 'XHTML' or 'metadata' is chosen, the plugin reads the appropriate lines from the source file and passes them to DokuWiki's ->code() method to be rendered in the same was as a code block.
   * 2006-05-01 --- (darcs version only, others to follow) Settings updated to use [[devel:common plugin functions]] which will allow them to be edited using the [[plugin:config|Configuration Manger]] in the admin menu.   * 2006-05-01 --- (darcs version only, others to follow) Settings updated to use [[devel:common plugin functions]] which will allow them to be edited using the [[plugin:config|Configuration Manger]] in the admin menu.
   * 2005-08-23 --- updated; supports filenames with spaces.   * 2005-08-23 --- updated; supports filenames with spaces.
Line 297: Line 280:
  * @author     Christopher Smith <chris@jalakai.co.uk>  * @author     Christopher Smith <chris@jalakai.co.uk>
  */  */
-if(!defined('DOKU_INC')) die();  // no DokuWiki, no go+if(!defined('DOKU_INC')) die();  // no Dokuwiki, no go
  
 if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
Line 350: Line 333:
      * Handle the match      * Handle the match
      */      */
-    function handle($match, $state, $pos, &$handler){+    function handle($match, $state, $pos, Doku_Handler $handler){
       $match = trim(substr($match,7,-1));                    //strip <source from start and > from end       $match = trim(substr($match,7,-1));                    //strip <source from start and > from end
  
Line 376: Line 359:
      * Create output      * Create output
      */      */
-    function render($format, &$renderer, $data) {+    function render($format, Doku_Renderer $renderer, $data) {
  
       $this->_loadSettings();       $this->_loadSettings();
Line 508: Line 491:
 </code> </code>
  
 + --- [[user>Juergen_aus_Zuendorf|Juergen_aus_Zuendorf]] //2018-02-06 17:27//\\
 +-> Changes for compatibility to PHP7:\\
 +"&$handler" and "&$renderer" to "Doku_Handler $handler" and "Doku_Renderer $renderer"
 ==== action.php ==== ==== action.php ====
  
Line 548: Line 534:
      * plugin should use this method to register its handlers with the DokuWiki's event controller      * plugin should use this method to register its handlers with the DokuWiki's event controller
      */      */
-    function register(&$controller) {+    function register(Doku_Event_Handler $controller) {
       $controller->register_hook('PARSER_CACHE_USE','BEFORE', $this, '_cache_prepare');       $controller->register_hook('PARSER_CACHE_USE','BEFORE', $this, '_cache_prepare');
     }     }
Line 702: Line 688:
   div.source .code .<geshi-hilite-code> {}    div.source .code .<geshi-hilite-code> {} 
 </code> </code>
-===== Bugs ===== 
  
 +\\
 +==== Tab size ====
 +You can set the tab-size to 4 as the default, for Chrome, Firefox and Opera, using:
 +<code css>
 +div.source pre.code {
 +  tab-size: 4;
 +  -moz-tab-size: 4;
 +  -o-tab-size: 4;
 +}
 +</code>
 +===== Bugs =====
  
  
plugin/source.1380029643.txt.gz · Last modified: 2013-09-24 15:34 by 177.69.173.214

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