diff options
author | jan <jan@jandecaluwe.com> | 2005-04-16 23:14:22 +0200 |
---|---|---|
committer | jan <jan@jandecaluwe.com> | 2005-04-16 23:14:22 +0200 |
commit | bb0a59d46949357f85e4a8deabff585e56b906e5 (patch) | |
tree | bcf6edeffa67a964dd7feb719070228e0a3b4189 /inc/parserutils.php | |
parent | ed630903385ab3b86504e21851a3ca0c4dea2414 (diff) | |
download | rpg-bb0a59d46949357f85e4a8deabff585e56b906e5.tar.gz rpg-bb0a59d46949357f85e4a8deabff585e56b906e5.tar.bz2 |
Support for useheading with new parser
darcs-hash:20050416211422-45605-fe8c790a6b317dc9c35a63d78c6367248cc01045.gz
Diffstat (limited to 'inc/parserutils.php')
-rw-r--r-- | inc/parserutils.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/inc/parserutils.php b/inc/parserutils.php index e2b4e9feb..e190a0af7 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -235,4 +235,23 @@ function p_render_xhtml($instructions){ return $Renderer->doc; } +/** + * Gets the first heading from a file + * + * @author Jan Decaluwe <jan@jandecaluwe.com> + */ + +function p_get_first_heading($id){ + $file = wikiFN($id); + if (@file_exists($file)) { + $instructions = p_cached_instructions($file); + foreach ( $instructions as $instruction ) { + if ($instruction[0] == 'header') { + return $instruction[1][0]; + } + } + } + return NULL; +} + //Setup VIM: ex: et ts=2 enc=utf-8 : |