DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:text

text (export / renderer) Plugin

Compatible with DokuWiki

  • 2017-02-19 "Frusterick Manners" unknown
  • 2016-06-26 "Elenor Of Tsort" unknown
  • 2015-08-10 "Detritus" yes
  • 2014-09-29 "Hrun" yes

plugin Exports or Renders a page as plain text (previous author: Todd Augsburger)

Last updated on
2016-06-19
Provides
Render
Repository
Source

Tagged with export, search

This plugin allows you to export a page to a plain text format usable as a simplistic document or to be used in further processing.

Usage

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');

Other plugins

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:

  1. they specifically support the 'text' output format, or
  2. they support standard XHTML output and the text is suitable when stripped of its HTML markup

Discussion

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:

  • '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.

plugin/text.txt · Last modified: 2016-06-19 18:55 by Michitux