[ Index ]
 

Code source de Serendipity 1.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/bundled-libs/Text/ -> Wiki.php (sommaire)

Parse structured wiki text and render into arbitrary formats such as XHTML.

Author: Paul M. Jones <pmjones@ciaweb.net>
License: LGPL
Version: $Id: Wiki.php,v 1.27 2005/02/01 16:56:56 pmjones Exp $
Poids: 1271 lignes (32 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

Text_Wiki:: (26 méthodes):
  Text_Wiki()
  setParseConf()
  getParseConf()
  setRenderConf()
  getRenderConf()
  setFormatConf()
  getFormatConf()
  insertRule()
  deleteRule()
  changeRule()
  enableRule()
  disableRule()
  transform()
  parse()
  render()
  getSource()
  getTokens()
  addToken()
  setToken()
  loadParseObj()
  loadRenderObj()
  loadFormatObj()
  addPath()
  getPath()
  findFile()
  fixPath()


Classe: Text_Wiki  - X-Ref

Parse structured wiki text and render into arbitrary formats such as XHTML.

This is the "master" class for handling the management and convenience
functions to transform Wiki-formatted text.

Text_Wiki($rules = null)   X-Ref
Constructor.

param: array $rules The set of rules to load for this object.

setParseConf($rule, $arg1, $arg2 = null)   X-Ref
Set parser configuration for a specific rule and key.

param: string $rule The parse rule to set config for.
param: array|string $arg1 The full config array to use for the
param: string $arg2 The config value for the key.
return: void

getParseConf($rule, $key = null)   X-Ref
Get parser configuration for a specific rule and key.

param: string $rule The parse rule to get config for.
param: string $key A key in the conf array; if null,
return: mixed The whole conf array if no key is specified,

setRenderConf($format, $rule, $arg1, $arg2 = null)   X-Ref
Set renderer configuration for a specific format, rule, and key.

param: string $format The render format to set config for.
param: string $rule The render rule to set config for in the format.
param: array|string $arg1 The config array, or the config key
param: string $arg2 The config value for the key.
return: void

getRenderConf($format, $rule, $key = null)   X-Ref
Get renderer configuration for a specific format, rule, and key.

param: string $format The render format to get config for.
param: string $rule The render format rule to get config for.
param: string $key A key in the conf array; if null,
return: mixed The whole conf array if no key is specified,

setFormatConf($format, $arg1, $arg2 = null)   X-Ref
Set format configuration for a specific rule and key.

param: string $format The format to set config for.
param: string $key The config key within the format.
param: string $val The config value for the key.
return: void

getFormatConf($format, $key = null)   X-Ref
Get configuration for a specific format and key.

param: string $format The format to get config for.
param: mixed $key A key in the conf array; if null,
return: mixed The whole conf array if no key is specified,

insertRule($name, $tgt = null)   X-Ref
Inserts a rule into to the rule set.

param: string $name The name of the rule.  Should be different from
param: string $tgt The rule after which to insert this new rule.  By
return: void

deleteRule($name)   X-Ref
Delete (remove or unset) a rule from the $rules property.

param: string $rule The name of the rule to remove.
return: void

changeRule($old, $new)   X-Ref
Change from one rule to another in-place.

param: string $old The name of the rule to change from.
param: string $new The name of the rule to change to.
return: void

enableRule($name)   X-Ref
Enables a rule so that it is applied when parsing.

param: string $rule The name of the rule to enable.
return: void

disableRule($name)   X-Ref
Disables a rule so that it is not applied when parsing.

param: string $rule The name of the rule to disable.
return: void

transform($text, $format = 'Xhtml')   X-Ref
Parses and renders the text passed to it, and returns the results.

First, the method parses the source text, applying rules to the
text as it goes.  These rules will modify the source text
in-place, replacing some text with delimited tokens (and
populating the $this->tokens array as it goes).

Next, the method renders the in-place tokens into the requested
output format.

Finally, the method returns the transformed text.  Note that the
source text is transformed in place; once it is transformed, it is
no longer the same as the original source text.

param: string $text The source text to which wiki rules should be
param: string $format The target output format, typically 'xhtml'.
return: string The transformed wiki text.

parse($text)   X-Ref
Sets the $_source text property, then parses it in place and
retains tokens in the $_tokens array property.

param: string $text The source text to which wiki rules should be
return: void

render($format = 'Xhtml')   X-Ref
Renders tokens back into the source text, based on the requested format.

param: string $format The target output format, typically 'xhtml'.
return: string The transformed wiki text.

getSource()   X-Ref
Returns the parsed source text with delimited token placeholders.

return: string The parsed source text.

getTokens($rules = null)   X-Ref
Returns tokens that have been parsed out of the source text.

param: array $rules If an array of rule names is passed, only return
return: array An array of tokens.

addToken($rule, $options = array()   X-Ref
Add a token to the Text_Wiki tokens array, and return a delimited
token number.

param: array $options An associative array of options for the new
param: boolean $id_only If true, return only the token number, not
return: string|int By default, return the number of the

setToken($id, $rule, $options = array()   X-Ref
Set or re-set a token with specific information, overwriting any
previous rule name and rule options.

param: int $id The token number to reset.
param: int $rule The rule name to use.
param: array $options An associative array of options for the
return: void

loadParseObj($rule)   X-Ref
Load a rule parser class file.

return: bool True if loaded, false if not.

loadRenderObj($format, $rule)   X-Ref
Load a rule-render class file.

return: bool True if loaded, false if not.

loadFormatObj($format)   X-Ref
Load a format-render class file.

return: bool True if loaded, false if not.

addPath($type, $dir)   X-Ref
Add a path to a path array.

param: string $type The path-type to add (parse or render).
param: string $dir The directory to add to the path-type.
return: void

getPath($type = null)   X-Ref
Get the current path array for a path-type.

param: string $type The path-type to look up (plugin, filter, or
return: array The array of paths for the requested type.

findFile($type, $file)   X-Ref
Searches a series of paths for a given file.

param: array $type The type of paths to search (template, plugin,
param: string $file The file name to look for.
return: string|bool The full path and file name for the target file,

fixPath($path)   X-Ref
Append a trailing '/' to paths, unless the path is empty.

param: string $path The file path to fix
return: string The fixed file path



Généré le : Sat Nov 24 09:00:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics