Software > MediaWiki > MediaWiki extensions >
https://web.archive.org/web/20050910025252/http://www.wickle.com/horde/cvs/cvs.php/mediawikiextensions
https://web.archive.org/web/20050411183429/http://meta.wikimedia.org/wiki/User:Coffman/Syntax_Highlight
Issues ∞
This should do colouration on <pre>
and not <code>
. :/
If you receive:
Warning: file_get_contents(/opt/lampp/htdocs/mw/images/syntax/21183671e1f8fc97dc838821f1546ccc.txt) [function.file-get-contents]: failed to open stream: No such file or directory in /opt/lampp/htdocs/mw/extensions/SyntaxHighlight.php on line 94
Then change in the extension:
" -Eperl --color -w html -o".wfEscapeShellArg( $fname.".txt")."
to:
" -Eperl --color --language html -o".wfEscapeShellArg( $fname.".txt")."
Then save Ruby.st and place it in /usr/share/enscript/hl/
You can also edit the hl/enscript.st
to add an entry for .rb
files.
2006-05-08 ∞
I still can't get this extension working. This means I can't get Ruby.st (Ruby enscript support) working.. I even found another resource for the ruby.st
package, which has been cached.
2005-08-31 ∞
I got syntax highlighting working thanks to the syntax highlight extension for MediaWiki. I have not yet found a way to get Ruby support. I did hunt down Ruby.st but it's not working as expected. I don't know what I'm doing wrong.
#!/bin/bash # comment if foo foo foo else bar bar bar fi echo "quux!"
Yes, I would like to see old DOS batch files and 4DOS batch files supported, but I'm sure that's a pipe dream. :/
Of course this seems to screw up all use of <code>
and <pre>
elsewhere.. all new things are double-edged it seems.
There's a trackback.php
file in the root of MediaWiki, and I decided to figure out how to use it. So in LocalSettings.php, I added $wgUseTrackbacks=true;
(btw, using =yes
worked too). Now I've got a Trackbacks link on the left-hand side.
Clicking it doesn't work, of course, giving:
1 Invalid request: Required field not specified
There seems to be zero documentation on this feature.
Examples ∞
You can view the samples working at the author's wiki.
Perl ∞
#!/usr/local/bin/perl5.8.2 #envia un correo a [email protected] como usuario wickle con el backup de las #ultimas base de datos de wickle y con el label Backup #Usa Mail::Webmail::Gmail en #http://search.cpan.org/dist/Mail-Webmail-Gmail/lib/Mail/Webmail/Gmail.pm #Syntax ./send_gmail.pl file_to_backup.tar.gz use Mail::Webmail::Gmail; my $backup_label="Backups"; my $file_to_backup=$ARGV[0]; my $mail_to_backup="[email protected]"; my $now = localtime time; print "It is now $now.\nfile to backup: $file_to_backup\n"; my ( $gmail ) = Mail::Webmail::Gmail->new( username => 'mygmailaccount', password => 'mypassword', ); my $msgid = $gmail->send_message( to => '[email protected]', subject => 'Backup bases de datos '. $now, msgbody => 'Backup del dia '.$now. ' realizado', file0 => [$file_to_backup] ); print "Msgid: $msgid\n"; if ( $msgid ) { if ( $gmail->error() ) { print $gmail->error_msg(); } else { ### Add this label to our new message ### $gmail->edit_labels( label => $backup_label, action => 'add', 'msgid' => $msgid ); if ( $gmail->error() ) { print $gmail->error_msg(); } else { print "Added label: $backup_label to message $msgid\n"; } } }
bash ∞
#!/bin/bash #Getting some variables FULLPATH=`dirname $1`; BASE=`basename $1`; # Needs an argument if [ $# -eq 0 ] ; then # no argument given, print usage echo "start control version on configuration file"; echo "use: $0 file"; else # check if RCS directory exist or create it if [ -d $FULLPATH/RCS ] ; then echo "revisions directory existent ..."; else mkdir $FULLPATH/RCS fi # Things to do when a RCS file exist if [ -e $FULLPATH/RCS/$BASE,v ] ; then echo "File exist. Checking for differences ..." # Check if there is any differences if ! rcsdiff $1; then echo "===================================" echo "WARNING: changes have been made to $1 and are not in the repository. Carefully look at the diff above, comment them below for committing or CTRL+C to abort." # Lock file /usr/bin/rcs -l $1 if ! /usr/bin/ci -u $1; then echo "Error when commiting. Aborting" exit fi fi echo "===================================" echo "Getting lastest revision and locking it ..." /usr/bin/co -l $1 fi echo "Launching editor ..." vim $1 # changes made, commit them to the repository unlocked /usr/bin/ci -u $1 exit fi
Java ∞
/* * Algernon - a rule-based inference engine in Java. * http://algernon-j.sourceforge.net/ * * This example shows how to open a Protege knowledge base * in Java and use Algernon to query the KB. * * To run it, be sure to change the path in NEWSPAPER_PROJECT * to match the correct project on your system. * * Micheal Hewett * 05 May 2004 * [email protected] */ package org.algernon.test; import java.util.*; import org.algernon.Algernon; import org.algernon.util.ErrorSet; import org.algernon.datatype.Result; import org.algernon.datatype.BindingList; import org.algernon.kb.okbc.protege.AlgernonProtegeKB; import org.algernon.kb.AlgernonKB; // date created: Wed Aug 14 11:02:44 2002 /** * Opens the Protege newspaper KB and makes some simple queries on it. * * Example: * * java -classpath algernon.jar:protege.jar org.algernon.test.SimpleAlgernonExample * * @see org.algernon.Algernon * @author Micheal S. Hewett [email protected] * */ public class SimpleAlgernonExample extends Object { public static String NEWSPAPER_PROJECT = "/Applications/Protege_2.0/examples/newspaper/newspaper.pprj"; protected Algernon f_algy = null; // Algernon instance protected AlgernonKB f_kb = null; protected String f_projectFile = ""; // date created: Wed Aug 14 11:02:44 2002 // created by: Micheal S. Hewett [email protected] public SimpleAlgernonExample() { f_projectFile = NEWSPAPER_PROJECT; } public SimpleAlgernonExample(String project) { f_projectFile = project; } /** * Opens the KB and initializes Algernon. */ public void init() { try { f_algy = new Algernon(); f_kb = new AlgernonProtegeKB(f_algy, f_projectFile); f_algy.addKB(f_kb); } catch (Exception e) { System.err.println(e + "\nUnable to open the '" + f_projectFile + "' KB."); stop(); } } /** * Halts the program nicely. */ public void stop() { if (f_kb != null) f_kb.close(); } public static void main(String[] args) { SimpleAlgernonExample example = new SimpleAlgernonExample(NEWSPAPER_PROJECT); example.init(); example.start(); } public void start() { try { // Example that retrieves all bindings of the variable ?X. // Note that the variable names are case-sensitive: ErrorSet errors = new ErrorSet(); String query = "<span class="footnote_referrer" ><a><sup id="footnote_plugin_tooltip_27256_1" class="footnote_plugin_tooltip_text" onclick="footnote_moveToAnchor_27256('footnote_plugin_reference_27256_1');" >[ 1 ]</sup ></a><span id="footnote_plugin_tooltip_text_27256_1" class="footnote_tooltip" >:instance Author ?a)(name ?a ?name</span ></span><script type="text/javascript"> jQuery('#footnote_plugin_tooltip_27256_1').tooltip({ tip: '#footnote_plugin_tooltip_text_27256_1', tipClass: 'footnote_tooltip', effect: 'fade', predelay: 0, fadeInSpeed: 200, delay: 400, fadeOutSpeed: 200, position: 'top center', relative: true, offset: [1, 0], });</script>"; Result result = (Result)f_algy.ask(query, errors); if (result == null) { System.err.println("Errors during ask of '" + query + "'"); System.err.println(errors.toString()); } else { // One way to access the results is to iterate on the results // using result.iterator(). Each element of the iterator // is of type BindingList. for (Iterator iterator = result.iterator(); iterator.hasNext();) { // Result contains some BindingList objects. BindingList bl = (BindingList) iterator.next(); // The bound object will either be a Java Object (Integer, Float, etc.) // or a KB object (typically a Protege Instance). // If you want Algernon objects, use algy.getAlgernonBinding(). Object author = f_algy.getBinding("?a", bl); Object name = f_algy.getBinding("?name", bl); System.out.println("Author: " + author + ", name: " + name); // If for some reason you don't know the names of the variables // in the Binding Lists, you can iterate on the BindingList to // retrieve variable names and values. See the JavaDoc documentation // for the BindingList api. } // A simpler way to show the results is to let Algernon print the results: System.out.println(f_algy.printResultToString("ask", result)); } } catch (Exception e) { System.err.println("Error running Algernon: " + e); e.printStackTrace(); } finally { stop(); } } }
Ruby ∞
(Ruby)
I haven't figured this out yet. See Ruby.st.
Footnotes
^ 1 | :instance Author ?a)(name ?a ?name |
Last updated 2020-07-06 at 20:40:38
ported
renamed from [[syntax highlight extension]]