MediaWiki Include

From Noah.org
Revision as of 11:38, 2 August 2007 by Root (talk | contribs) (New page: category:Engineering category:Free_Software This describes "include" -- a MediaWiki extension that lets you include external static content from the file system; remote URL; or Su...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


This describes "include" -- a MediaWiki extension that lets you include external static content from the file system; remote URL; or Subversion.

If the external text is source code then it can be optionally colorized with syntax highlighting. By default the text is automatically wrapped in a <pre></pre> tag and all HTML entities are escaped. This can be turned off if you want to include raw text or HTML.

Note that syntax coloring requires the Pear Text_Highlighter module. The <include> extension will run without Text_Highlighter, but the 'highlight' attribute will be disabled. If you try to use it without installing Text_Highlighter the include script will silently ignore the 'highlight' attribute.

You can optionally add the svncat attribute which tells the extension to use "svn cat" to include the file from an SVN repository. In this case the "src" argument will be passed directly to SVN, so src="URL" may be any URL that SVN understand (file:///, svn+ssh://, webdav://, http://). This is very handy for documenting source code.

Download the include script

For example, the include script below is itself included in this article with the following include line:

 <include svncat src="file:///home/svn/src/mediawiki/extensions/include.php" highlight="php" />

That pulls the latest copy of code from SVN and generates the following output:

<include svncat src="file:///home/svn/src/mediawiki/extensions/include.php" highlight="php" />

https://www.noah.org/mediawiki-1.34.2/index.php?title=MediaWiki_Include&action=purge