plugin:getraw
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:getraw [2015-06-24 21:41] – Klap-in | plugin:getraw [2021-07-07 05:54] (current) – [Usability suggestions] dot is not bar-dot beco | ||
---|---|---|---|
Line 4: | Line 4: | ||
description: | description: | ||
author | author | ||
- | email : | + | email : elifenton@this_is_not_a_real_email.fake |
type : | type : | ||
- | lastupdate : 2015-06-09 | + | lastupdate : 2021-07-07 |
- | compatible : angua, rincewind, hrun | + | compatible : angua, rincewind, hrun, detritus, Frusterick Manners, greebo |
depends | depends | ||
conflicts | conflicts | ||
Line 15: | Line 15: | ||
---- | ---- | ||
- | This isn't a standard | + | This isn't a standard |
- | This is a useful utility for plug-ins | + | This is a useful utility for plugins |
- | This plug-in allows you to request only what's inside of a code block, so you could have a wiki page that describes a block of code, and that could could easily be imported by another script. | ||
- | |||
- | Another use is to store arbitrary text files in your wiki. For example, if you call a wiki page a:b.js and use this script to fetch the page, it will act like a javascript file. | ||
===== Installation ===== | ===== Installation ===== | ||
Line 39: | Line 36: | ||
$file = rawWiki($ID); | $file = rawWiki($ID); | ||
if ($onlyCode) | if ($onlyCode) | ||
- | $file = preg_replace('/ | + | $file = preg_replace('/ |
if ($insideTag) | if ($insideTag) | ||
$file = preg_replace('/ | $file = preg_replace('/ | ||
Line 46: | Line 43: | ||
else | else | ||
print " | print " | ||
+ | ?> | ||
</ | </ | ||
===== Examples/ | ===== Examples/ | ||
+ | |||
+ | === Simple Case === | ||
Let's say you have a wiki page called a:b that looks like this: | Let's say you have a wiki page called a:b that looks like this: | ||
Line 71: | Line 71: | ||
and things, too! | and things, too! | ||
</ | </ | ||
+ | |||
+ | |||
+ | === Use to insert JavaScript on your page ==== | ||
+ | |||
+ | Create a page called //a:b.js//: | ||
+ | < | ||
+ | alert(' | ||
+ | </ | ||
+ | |||
+ | If you want the page to be readable, you can wrap it in code tags and use the onlyCode parameter. On another page, you can include your JavaScript like this, if you've enabled html in your settings: | ||
+ | |||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | |||
Line 77: | Line 93: | ||
=== Change Log === | === Change Log === | ||
+ | * **2021-07-07** | ||
+ | * With a simple regex added to the code < | ||
* **2015-06-19** | * **2015-06-19** | ||
* Removed some unnecessary code from the script. This plugin is no longer dependent on the version of DokuWiki. Tested with DokuWiki Hrun. | * Removed some unnecessary code from the script. This plugin is no longer dependent on the version of DokuWiki. Tested with DokuWiki Hrun. | ||
Line 97: | Line 115: | ||
* people can update with the Extension Manager | * people can update with the Extension Manager | ||
* people can install via the extension manager, without manually copying a file | * people can install via the extension manager, without manually copying a file | ||
+ | |||
+ | [[user> | ||
+ | |||
+ | ==== Usability suggestions ==== | ||
+ | For ease of use, you can set up another rewrite rule in your .htaccess so that a user only needs to add .txt to their URL to get the text format. Also, optionally, add .c to the URL to get only the the source inside the code tags. | ||
+ | |||
+ | '' | ||
+ | '' | ||
+ | |||
+ | Also for readability, |
plugin/getraw.txt · Last modified: 2021-07-07 05:54 by beco