plugin:source
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:source [2009-08-31 11:51] – standardize author name ChrisS | plugin:source [2023-10-30 22:58] (current) – Klap-in | ||
---|---|---|---|
Line 2: | Line 2: | ||
---- plugin ---- | ---- plugin ---- | ||
- | description: | + | description: |
author | author | ||
email : chris@jalakai.co.uk | email : chris@jalakai.co.uk | ||
type : syntax | type : syntax | ||
lastupdate : 2008-08-13 | lastupdate : 2008-08-13 | ||
- | compatible : 2007-06-26 and later, 2006-11-06 | + | compatible : Hrun |
depends | depends | ||
conflicts | conflicts | ||
similar | similar | ||
- | tags : | + | tags : |
+ | downloadurl: | ||
---- | ---- | ||
Line 20: | Line 21: | ||
* **// | * **// | ||
* **//# | * **//# | ||
- | * **// | + | * **// |
* **// | * **// | ||
Line 58: | Line 59: | ||
===== Installation ===== | ===== Installation ===== | ||
+ | Search and install the plugin using the [[plugin: | ||
+ | |||
- | This plugin can be installed by the [[plugin: | ||
* [[http:// | * [[http:// | ||
* [[http:// | * [[http:// | ||
- | Or using [[http:// | ||
- | * [[http:// | ||
- | |||
- | === Manual Installation === | ||
- | |||
- | Download one of the first two packages to your plugin folder, '' | ||
- | The folder will contain: | ||
- | conf/ | ||
- | conf/ | ||
- | conf/ | ||
- | lang/ | ||
- | lang/ | ||
- | lang/ | ||
- | lang/ | ||
- | action.php | ||
- | style.css | ||
- | syntax.php | ||
- | The plugin is now installed. | ||
===== Revision History ===== | ===== Revision History ===== | ||
Line 92: | Line 76: | ||
* add support for (basic) rules to govern source file access. The rules work in addition to the earlier ' | * add support for (basic) rules to govern source file access. The rules work in addition to the earlier ' | ||
* add support for line number selection. | * add support for line number selection. | ||
- | * add support for any renderer format. | + | * add support for any renderer format. |
* 2006-05-01 --- (darcs version only, others to follow) Settings updated to use [[devel: | * 2006-05-01 --- (darcs version only, others to follow) Settings updated to use [[devel: | ||
* 2005-08-23 --- updated; supports filenames with spaces. | * 2005-08-23 --- updated; supports filenames with spaces. | ||
Line 231: | Line 215: | ||
---- | ---- | ||
+ | ==== Numbering Lines ==== | ||
+ | |||
+ | This change in syntax.php will number the lines: | ||
+ | < | ||
+ | |||
+ | <file php syntax_changes.php> | ||
+ | function _getSource($file, | ||
+ | |||
+ | $source = @file($this-> | ||
+ | if (empty($source)) return ''; | ||
+ | |||
+ | // $start is a 1 based index, need to correct to 0 based when slicing arrray | ||
+ | if (!empty($start)) { | ||
+ | $lines = count($source); | ||
+ | if ($start > $lines) { | ||
+ | $source = $this-> | ||
+ | } else if ($end < $start) { | ||
+ | $source = $this-> | ||
+ | } else if ($end > $lines) { | ||
+ | $source = join('', | ||
+ | } else { | ||
+ | $source = join('', | ||
+ | } | ||
+ | } else { | ||
+ | $source = join('', | ||
+ | } | ||
+ | |||
+ | $rows = explode(" | ||
+ | for($i = 0; $i < | ||
+ | $new_text .= sprintf(" | ||
+ | return $new_text; | ||
+ | } | ||
+ | </ | ||
===== Details ===== | ===== Details ===== | ||
Line 263: | Line 280: | ||
* @author | * @author | ||
*/ | */ | ||
- | if(!defined(' | + | if(!defined(' |
if(!defined(' | if(!defined(' | ||
Line 316: | Line 333: | ||
* Handle the match | * Handle the match | ||
*/ | */ | ||
- | function handle($match, | + | function handle($match, |
$match = trim(substr($match, | $match = trim(substr($match, | ||
Line 342: | Line 359: | ||
* Create output | * Create output | ||
*/ | */ | ||
- | function render($format, | + | function render($format, |
$this-> | $this-> | ||
Line 474: | Line 491: | ||
</ | </ | ||
+ | --- [[user> | ||
+ | -> Changes for compatibility to PHP7:\\ | ||
+ | "& | ||
==== action.php ==== | ==== action.php ==== | ||
Line 514: | Line 534: | ||
* plugin should use this method to register its handlers with the DokuWiki' | * plugin should use this method to register its handlers with the DokuWiki' | ||
*/ | */ | ||
- | function register(&$controller) { | + | function register(Doku_Event_Handler |
$controller-> | $controller-> | ||
} | } | ||
Line 668: | Line 688: | ||
div.source .code .< | div.source .code .< | ||
</ | </ | ||
- | ===== Bugs ===== | ||
+ | \\ | ||
+ | ==== Tab size ==== | ||
+ | You can set the tab-size to 4 as the default, for Chrome, Firefox and Opera, using: | ||
+ | <code css> | ||
+ | div.source pre.code { | ||
+ | tab-size: 4; | ||
+ | -moz-tab-size: | ||
+ | -o-tab-size: | ||
+ | } | ||
+ | </ | ||
+ | ===== Bugs ===== | ||
plugin/source.1251712307.txt.gz · Last modified: 2009-08-31 11:51 by ChrisS