$wgUseTeX = false;
$wgTexvc = './math/texvc'; # Location of the texvc binary
-# Support for inline hieroglyphs, see http://aoineko.free.fr/ The
-# WikiHiero php files must be present in the same directory as the
-# rest of the mediawiki code, and WikiHiero must have been configured
-# with the correct image locations.
-$wgUseWikiHiero = false;
-
-# Support for inline timelines, see http://members.chello.nl/epzachte/Wikipedia/EasyTimeline/Introduction.htm
-# The Timeline php files must be present in the extension directory and you must have the
-# ploticus tool available, see http://ploticus.sourceforge.net/
-$wgUseTimeline = false;
-
# Profiling / debugging
$wgProfiling = false; # Enable for more detailed by-function times in debug log
$wgProfileLimit = 0.0; # Only record profiling info for pages that took longer than this
# covered by $wgFileExtensions.
$wgStrictFileExtensions = true;
+# Warn if uploaded files are larger than this
+$wgUploadSizeWarning = 150000;
+
$wgPasswordSalt = true; # For compatibility with old installations set to false
# Which namespaces should support subpages?
// require_once('Tokenizer.php');
-if( $GLOBALS['wgUseWikiHiero'] ){
- require_once('extensions/wikihiero/wikihiero.php');
-}
-if( $GLOBALS['wgUseTimeline'] ){
- require_once('extensions/timeline/Timeline.php');
-}
-
# PHP Parser
#
# Processes wiki markup
# prefix for escaping, used in two functions at least
define( "UNIQ_PREFIX", "NaodW29");
+/* private */ $wgParserHooks = array();
+
class Parser
{
# Cleared with clearState():
# counting the sections in the wikisource
function strip( $text, &$state, $stripcomments = false )
{
+ global $wgParserHooks;
+
$render = ($this->mOutputType == OT_HTML);
$nowiki_content = array();
- $hiero_content = array();
- $timeline_content = array();
$math_content = array();
$pre_content = array();
$comment_content = array();
-
+ $ext_content = array();
+
# Replace any instances of the placeholders
$uniq_prefix = UNIQ_PREFIX;
#$text = str_replace( $uniq_prefix, wfHtmlEscapeFirst( $uniq_prefix ), $text );
+
+ # nowiki
$text = Parser::extractTags('nowiki', $text, $nowiki_content, $uniq_prefix);
foreach( $nowiki_content as $marker => $content ){
if( $render ){
}
}
- $text = Parser::extractTags('hiero', $text, $hiero_content, $uniq_prefix);
- foreach( $hiero_content as $marker => $content ){
- if( $render && $GLOBALS['wgUseWikiHiero']){
- $hiero_content[$marker] = WikiHiero( $content, WH_MODE_HTML);
- } else {
- $hiero_content[$marker] = "<hiero>$content</hiero>";
- }
- }
-
- $text = Parser::extractTags('timeline', $text, $timeline_content, $uniq_prefix);
- foreach( $timeline_content as $marker => $content ){
- if( $render && $GLOBALS['wgUseTimeline']){
- $timeline_content[$marker] = renderTimeline( $content );
- } else {
- $timeline_content[$marker] = "<timeline>$content</timeline>";
- }
- }
-
+ # math
$text = Parser::extractTags('math', $text, $math_content, $uniq_prefix);
foreach( $math_content as $marker => $content ){
if( $render ) {
}
}
+ # pre
$text = Parser::extractTags('pre', $text, $pre_content, $uniq_prefix);
foreach( $pre_content as $marker => $content ){
if( $render ){
$pre_content[$marker] = "<pre>$content</pre>";
}
}
+
+ # Comments
if($stripcomments) {
$text = Parser::extractTags(STRIP_COMMENTS, $text, $comment_content, $uniq_prefix);
foreach( $comment_content as $marker => $content ){
}
}
+ # Extensions
+ foreach ( $wgParserHooks as $tag => $callback ) {
+ $ext_contents[$tag] = array();
+ $text = Parser::extractTags( $tag, $text, $ext_content[$tag], $uniq_prefix );
+ foreach( $ext_content[$tag] as $marker => $content ) {
+ if ( $render ) {
+ $ext_content[$tag][$marker] = $callback( $content );
+ } else {
+ $ext_content[$tag][$marker] = "<$tag>$content</$tag>";
+ }
+ }
+ }
+
# Merge state with the pre-existing state, if there is one
if ( $state ) {
$state['nowiki'] = $state['nowiki'] + $nowiki_content;
- $state['hiero'] = $state['hiero'] + $hiero_content;
- $state['timeline'] = $state['timeline'] + $timeline_content;
$state['math'] = $state['math'] + $math_content;
$state['pre'] = $state['pre'] + $pre_content;
$state['comment'] = $state['comment'] + $comment_content;
+
+ foreach( $ext_content as $tag => $array ) {
+ if ( array_key_exists( $tag, $state ) ) {
+ $state[$tag] = $state[$tag] + $array;
+ }
+ }
} else {
$state = array(
'nowiki' => $nowiki_content,
- 'hiero' => $hiero_content,
- 'timeline' => $timeline_content,
'math' => $math_content,
'pre' => $pre_content,
- 'comment' => $comment_content
- );
+ 'comment' => $comment_content,
+ ) + $ext_content;
}
return $text;
}
if ( !$state ) {
$state = array(
'nowiki' => array(),
- 'hiero' => array(),
'math' => array(),
'pre' => array()
);
$executing = false;
return $text;
}
+
+ # Create an HTML-style tag, e.g. <yourtag>special text</yourtag>
+ # Callback will be called with the text within
+ # Transform and return the text within
+ /* static */ function setHook( $tag, $callback ) {
+ global $wgParserHooks;
+ $oldVal = @$wgParserHooks[$tag];
+ $wgParserHooks[$tag] = $callback;
+ return $oldVal;
+ }
}
class ParserOutput