DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:htag

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:htag [2011-02-11 06:21] – [Error] 70.67.243.178plugin:htag [2022-01-12 01:18] (current) – Obsolete Klap-in
Line 7: Line 7:
 type       : syntax type       : syntax
 lastupdate : 2007-07-23 lastupdate : 2007-07-23
-compatible : 2007-06-26+compatible : 2013-05-10 2012-10-13 2012-01-25 and 2011-05-25
 depends    :  depends    : 
 conflicts  : numberedheadings conflicts  : numberedheadings
 similar    :  similar    : 
-tags       : editing, headings+tags       : editing, headings,!obsolete #as not maintained, no download available 
 ---- ----
  
Line 36: Line 36:
  
 ==== Source Code ==== ==== Source Code ====
-<code php>+<code php syntax.php>
 <?php /** <?php /**
   This plugin provides alternative heading syntax.   This plugin provides alternative heading syntax.
Line 46: Line 46:
   @since      23-Jul-2007   @since      23-Jul-2007
 **/ **/
- 
-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_htag extends DokuWiki_Syntax_Plugin { class syntax_plugin_htag extends DokuWiki_Syntax_Plugin {
Line 60: Line 56:
                         'name' => 'Heading Level Tag',                         'name' => 'Heading Level Tag',
                         'desc' => 'Adds outline-style markup (h1.~) syntax for headings.',                         'desc' => 'Adds outline-style markup (h1.~) syntax for headings.',
-                        'url' => 'http://www.dokuwiki.org/plugin:htag'+                        'url' => 'https://www.dokuwiki.org/plugin:htag'
                 );                 );
         }         }
Line 78: Line 74:
         function getSort() { return 44; }         function getSort() { return 44; }
                  
-        function handle( $match, $state, $pos, &$handler )+        function handle( $match, $state, $pos, Doku_Handler $handler) {
         {         {
                 global $conf;                 global $conf;
Line 86: Line 82:
                 $level = substr( $htag[0], 1, 1 );                 $level = substr( $htag[0], 1, 1 );
  
-                if( $handler->status['section') $handler->_addCall('section_close',array(), $pos);+                if( $handler->getStatus('section') $handler->addCall('section_close',array(), $pos);
                 if( $level <= $conf['maxseclevel'] ) {                 if( $level <= $conf['maxseclevel'] ) {
-                    $handler->_addCall('section_edit',array($handler->status['section_edit_start'], $pos-1, +                    $handler->addCall('section_edit',array($handler->getStatus('section_edit_start'), $pos-1, 
-                                $handler->status['section_edit_level'], $handler->status['section_edit_title']), $pos); +                                $handler->getStatus('section_edit_level'), $handler->getStatus('section_edit_title')), $pos); 
-                    $handler->status['section_edit_start'] = $pos; +                    $handler->setStatus('section_edit_start'$pos)
-                    $handler->status['section_edit_level'] = $level; +                    $handler->setStatus('section_edit_level'$level)
-                    $handler->status['section_edit_title'] = $title;+                    $handler->setStatus('section_edit_title'$title);
                 }                 }
-                $handler->_addCall('header',array($title,$level,$pos), $pos); +                $handler->addCall('header',array($title,$level,$pos), $pos); 
-                $handler->_addCall('section_open',array($level),$pos); +                $handler->addCall('section_open',array($level),$pos); 
-                $handler->status['section'] = true;+                $handler->setStatus('section'true);
  
                 return true;                 return true;
         }         }
  
-        function render( $format, &$renderer, $data )+        function render( $format, Doku_Renderer $renderer, $data) {
         {         {
                 return true;                 return true;
Line 110: Line 106:
  
 ===== Changelog ===== ===== Changelog =====
 +  * **Version ..** 2022: some code cleanup, not tested
   * **Version 0.95 (2007-07-23)**: Fixed no-sections bug.   * **Version 0.95 (2007-07-23)**: Fixed no-sections bug.
   * **Version 0.9 (2007-07-17)**: First published version.   * **Version 0.9 (2007-07-17)**: First published version.
Line 135: Line 132:
 on the first load for each page.  Refreshing the page will have it come up clean.  Clearing the cache makes no difference. on the first load for each page.  Refreshing the page will have it come up clean.  Clearing the cache makes no difference.
  
 +----
 +
 +**11 Dec 2011** (kaj.wiik ə iki.fi)
 +
 +Edit the following lines out (section edit is done now elsewhere):
 +
 +<code>
 +if( $level <= $conf['maxseclevel'] ) {
 +                    $handler->_addCall('section_edit',array($handler->status['section_edit_start'], $pos-1,
 +                                $handler->status['section_edit_level'], $handler->status['section_edit_title']), $pos);
 +                    $handler->status['section_edit_start'] = $pos;
 +                    $handler->status['section_edit_level'] = $level;
 +                    $handler->status['section_edit_title'] = $title;
 +}
 +</code>
 +  
plugin/htag.1297401675.txt.gz · Last modified: 2011-02-11 06:21 by 70.67.243.178

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