Exports or Renders a page as plain text (previous author: Todd Augsburger)
Compatible with DokuWiki
Similar to plaintext
Needed for bookcreator, odtsupport, searchtext
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:
<pagename>?do=export_text
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:
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'); ?>
Note:
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.