text (export / renderer) Plugin
Compatible with DokuWiki
- 2022-07-31 "Igor" unknown
- 2020-07-29 "Hogfather" yes
- 2018-04-22 "Greebo" yes
- 2017-02-19 "Frusterick Manners" unknown
This plugin allows you to export a page to a plain text format usable as a simple document or to be used in further processing.
To export a single page add the following parameter to the page URL:
To get a copy of rendered text in PHP (i.e. from a button or some other plugin) use:
global $ID; $ID = $id; //necessary for correct metadata handling $text = p_cached_output(wikiFN($id),'text');
The text renderer plugin was originally designed for use with the searchtext plugin, to provide both a basis for searching rendered text, and providing a rendered text snippet for displayed search result.
If you use other syntax plugins, their output may not appear correctly in the exported text unless:
- they specifically support the 'text' output format, or
- they support standard XHTML output and the text is suitable when stripped of its HTML markup
To add a button to your template to access this plugin's output, try adding the following in your template at the point you would like the button to appear.
<?php echo html_button('text',$ID,'t',array('do' => 'export_text'),'get','export this page as text'); ?>
- 'text' will appear in the button, change as appropriate.
- 'export this page as text' will appear as a tooltip when you hover over the button. change as appropriate.
If you are not using a dev version or are on the latest stable use this code instead:
<?php echo html_btn('text',$ID,'t',array('do' => 'export_text'),'get','export this page as text'); ?>
Or if you like pretty icon links rather than buttons:
<a href="<?php echo exportlink($ID, 'text')?>"><img src="<?php echo DOKU_BASE?>lib/images/fileicons/txt.png" alt="Text Export"></a>
Please report any issues on the issue tracker, feel free to create pull requests.