devel:section_editor
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
devel:section_editor [2015-05-27 13:59] – 130.112.1.3 | devel:section_editor [2018-04-06 21:42] (current) – Update for upcoming release "Greebo" LarsDW223 | ||
---|---|---|---|
Line 7: | Line 7: | ||
The XHTML renderer provides two methods for the DIV section edit marking: | The XHTML renderer provides two methods for the DIV section edit marking: | ||
- | * [[xref> | + | * [[xref> |
- | * [[xref> | + | * [[xref> |
These are used to create markers in the xhtml output of the renderer and after the render is done, a replacement or remove of the markers by [[xref> | These are used to create markers in the xhtml output of the renderer and after the render is done, a replacement or remove of the markers by [[xref> | ||
Note that '' | Note that '' | ||
+ | |||
+ | Before DokuWiki release " | ||
+ | |||
+ | * startSectionEdit($bytepos_start, | ||
+ | * finishSectionEdit($bytepos_end = null) | ||
+ | |||
+ | But do not worry. You can easily write backwards compatible code by checking the definition of '' | ||
A step-by-step example for a syntax plugin: | A step-by-step example for a syntax plugin: | ||
Line 22: | Line 29: | ||
// sufficiently new | // sufficiently new | ||
if ($format === ' | if ($format === ' | ||
- | // FIXME: Insert plugin name here as section type | + | |
- | | + | |
- | // the method call as well | + | |
+ | | ||
+ | | ||
+ | $sectionEditData = ' | ||
+ | } | ||
/* @var Doku_Renderer_xhtml $renderer */ | /* @var Doku_Renderer_xhtml $renderer */ | ||
$class = $renderer-> | $class = $renderer-> | ||
- | ' | + | $sectionEditData); |
+ | } | ||
+ | $renderer-> | ||
+ | |||
+ | // FIXME: Put your content here | ||
+ | |||
+ | $renderer-> | ||
+ | // Add section edit infos only in XHTML renderers which are | ||
+ | // sufficiently new | ||
+ | if ($format === ' | ||
+ | method_exists($renderer, | ||
+ | /* @var Doku_Renderer_xhtml $renderer */ | ||
+ | $renderer-> | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | If the section of your plugin has a distinguishable name, you may add it to the method call as well. In this case the old and new method signatures are to different to achieve backwards compatibility by just assigning different values to '' | ||
+ | |||
+ | <file php syntax.php> | ||
+ | public function render($format, | ||
+ | $class = ''; | ||
+ | // Add section edit infos only in XHTML renderers which are | ||
+ | // sufficiently new | ||
+ | if ($format === ' | ||
+ | // Call ' | ||
+ | if (defined(' | ||
+ | // FIXME: Insert plugin name here as ' | ||
+ | // and section name as ' | ||
+ | $sectionEditData = [' | ||
+ | ' | ||
+ | |||
+ | /* @var Doku_Renderer_xhtml $renderer */ | ||
+ | $class = $renderer-> | ||
+ | | ||
+ | } else { | ||
+ | // backwards-compatibility for Frusterick Manners (2017-02-19) | ||
+ | // FIXME: Insert plugin name here as section type | ||
+ | // and section name as title | ||
+ | /* @var Doku_Renderer_xhtml $renderer */ | ||
+ | $class = $renderer-> | ||
+ | ' | ||
+ | } | ||
} | } | ||
$renderer-> | $renderer-> |
devel/section_editor.txt · Last modified: 2018-04-06 21:42 by LarsDW223