Class TextParser
Parses text in a variety of ways.
Called from a template by $Content.Parse(SubClassName), similar to $Content.XML. This will work on any Text database field (Or a sub-class, such as HTMLText, although it's usefulness in this situation is more limited).
Any sub-classes of TextParser must implement a parse() method. This should take $this->content and parse it however you want. For an example of the implementation, @see BBCodeParser.
Your sub-class will be initialized with a string of text, then parse() will be called. parse() should (after processing) return the formatted string.
Note: $this->content will have NO conversions applied to it. You should run Covert::raw2xml or whatever is appropriate before using it.
Optionally (but recommended), is creating a static usable_tags method, which will return a DataObjectSet of all the usable tags that can be parsed. This will (mostly) be used to create helper blocks - telling users what things will be parsed. Again, @see BBCodeParser for an example of the syntax
- Object
-
TextParser
Direct known subclasses
Methods summary
public
|
|
public
|
#
setContent( mixed $content = "" )
Convenience method, shouldn't really be used, but it's here if you want it |
abstract public
|
Methods inherited from Object
__call(),
__toString(),
__wakeup(),
addMethodsFrom(),
addStaticVars(),
addWrapperMethod(),
add_extension(),
add_static_var(),
allMethodNames(),
cacheToFile(),
cacheToFileWithArgs(),
clearCache(),
combined_static(),
create(),
createMethod(),
create_from_string(),
defineMethods(),
exists(),
extInstance(),
extend(),
getCustomClass(),
getExtensionInstance(),
getExtensionInstances(),
get_extensions(),
get_static(),
hasExtension(),
hasMethod(),
has_extension(),
invokeWithExtensions(),
is_a(),
loadCache(),
parentClass(),
parse_class_spec(),
remove_extension(),
sanitiseCachename(),
saveCache(),
set_stat(),
set_static(),
set_uninherited(),
stat(),
strong_create(),
uninherited(),
uninherited_static(),
useCustomClass()
Magic methods summary
Properties summary
protected
mixed
|
$content |