DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:text

text (export / renderer) Plugin

Compatible with DokuWiki

  • 2024-02-06 "Kaos" unknown
  • 2023-04-04 "Jack Jackrum" unknown
  • 2022-07-31 "Igor" unknown
  • 2020-07-29 "Hogfather" yes

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

Last updated on
2022-07-07
Provides
Render
Repository
Source

Similar to plaintext

Tagged with export, search

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.

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: 2022-08-02 12:35 by michitux

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