As discussed previously, I need an automated way to put
clickable (i.e., client-side image-mapped) images on wiki
pages. Jan Steinman showed me a cute way to do this (see
below), using raw HTML. Although I've gotten it to work
for me, I've found some oddities in the way that addresses
(e.g., file names, URLs) get interpreted.
What I'm hoping for is a way to use some relatively short
and simple addresses for the images and associated pages.
Ideally, I'd be able to get to uploaded images, using a
name such as 'Image:Segwayabbeyroad.jpg', rather than
having to use my own directory or reverse engineer path
names such as 'images/3/3a/Segwayabbeyroad.jpg'.
I realize that I'm off in an unsupported area, but perhaps
some of you have had (and resolved) similar issues. Any
helpful advice will be greatly appreciated.
I have two copies of the image, located at:
images/3/3a/Segwayabbeyroad.jpg
images_raw/Segwayabbeyroad.jpg
The saved page can be viewed at
http://www.cfcl.com/rdm/MW/index.php/IM_X1
Here's the code for the page:
=============================
This image shows up.
[[Image:Segwayabbeyroad.jpg]]
<RawHtml>
<p> These two images, not surprisingly, don't show up at all.
<p>A <img src='Image:Segwayabbeyroad.jpg'
usemap='#foo'>
<p>B <img
src='http://www.cfcl.com/rdm/mediawiki/index.php?title=Image:Segwayabbeyroad.jpg'
usemap='#foo'>
<p> These two images only show up in preview mode.
<p>C <img src='images/3/3a/Segwayabbeyroad.jpg'
usemap='#foo'>
<p>D <img src='images_raw/Segwayabbeyroad.jpg'
usemap='#foo'>
<p> These two images show up in both preview and save mode.
<p>E <img
src='http://www.cfcl.com/rdm/mediawiki/images_raw/Segwayabbeyroad.jpg'
usemap='#foo'>
<p>F <img src='/rdm/mediawiki/images_raw/Segwayabbeyroad.jpg'
usemap='#foo'>
<p> The left-most image-map links (George, Paul) work in preview mode,
but not after a "Save page". The other two work in both modes.
<map name="foo">
<area coords=" 0, 0, 83, 199"
href="?title=George">
<area coords=" 84, 0,167, 199"
href="./index.php?title=Paul">
<area coords="168, 0,251, 199"
href="/rdm/mediawiki/index.php?title=Ringo">
<area coords="252, 0,332, 199"
href="/rdm/mediawiki/index.php?title=John">
</map>
</RawHtml>
=============================
Finally, here's RawHtml.php:
=============================
<?php
# RawHtml.php - raw HTML extension
#
# Defines the tag pair <RawHtml></RawHtml>.
# Sends the content out without any processing.
#
# To use, include this file into your LocalSettings.php
# To configure, set members of $wgRawHtml after the inclusion.
#
# include 'RawHtml.php';
#
# $wgRawHtml = array('JoeUser', 'JoeUserBot')
#
# Adapted from code by Jan Steinman <Jan(a)Bytesmiths.com>
class raw_html_settings { };
$wgRawHtml = new raw_html_settings;
$wgExtensionFunctions[] = 'wf_raw_html_ext';
function wf_raw_html_ext() {
global $wgParser;
$wgParser->setHook('RawHtml', 'render_raw_html');
}
function render_raw_html($raw_html_src, $style='') {
return $raw_html_src;
}
?>
=============================
--
http://www.cfcl.com/rdm Rich Morin
http://www.cfcl.com/rdm/resume rdm(a)cfcl.com
http://www.cfcl.com/rdm/weblog +1 650-873-7841
Technical editing and writing, programming, and web development
The extension for mathematical expressions and conditional constructs has been enabled on all
Wikimedia wikis, on a trial basis. Documentation is at:
http://meta.wikimedia.org/wiki/ParserFunctions
See the talk page for discussion.
-- Tim Starling
An automated run of parserTests.php showed the following failures:
Running test Table security: embedded pipes (http://mail.wikipedia.org/pipermail/wikitech-l/2006-April/034637.html)... FAILED!
Running test Magic Word: {{NUMBEROFFILES}}... FAILED!
Running test BUG 1887, part 2: A <math> with a thumbnail- math enabled... FAILED!
Passed 300 of 303 tests (99.01%) FAILED!
On 4/13/06, Gregory Maxwell <gmaxwell(a)gmail.com> wrote:
> AFAIR, most string matches in mysql are case insensitive, which would
> mean that we could have indexed case insensitive matches quickly...
> but I'm guessing that our use of binary fields for titles (which is
> required because no version of mysql has complete UTF-8 support) most
> likely breaks that.
Yes, they are, and yes, it does. Could someone explain what the exact
reason is that we're using varchar binary in MediaWiki for page
titles? I've been using regular varchars for my WiktionaryZ tables,
and so far it seems to work fine with UTF-8. Where exactly does a
non-binary varchar break?
Also, according to the MySQL 5.0 documentation:
http://dev.mysql.com/doc/refman/5.0/en/binary-varbinary.html
<quote>
The BINARY and VARBINARY data types are distinct from the CHAR BINARY
and VARCHAR BINARY data types. For the latter types, the BINARY
attribute does not cause the column to be treated as a binary string
column. Instead, it causes the binary collation for the column
character set to be used, and the column itself contains non-binary
character strings rather than binary byte strings. For example,
CHAR(5) BINARY is treated as CHAR(5) CHARACTER SET latin1 COLLATE
latin1_bin, assuming that the default character set is latin1. This
differs from BINARY(5), which stores 5-bytes binary strings that have
no character set or collation.
</quote>
Since we are using VARCHAR(255) BINARY for page titles, rather than
VARBINARY(255), does that mean that "it causes the binary collation
for the column character set to be used"? If so, does the use of
VARCHAR(255) BINARY, as opposed to a simple VARCHAR(255), affect
anything but the sorting order (collation)?
Might it make sense to use non-binary strings and use binary
comparisons instead where case-sensitivity is required?
Erik
An automated run of parserTests.php showed the following failures:
Running test Table security: embedded pipes (http://mail.wikipedia.org/pipermail/wikitech-l/2006-April/034637.html)... FAILED!
Running test Magic Word: {{NUMBEROFFILES}}... FAILED!
Running test BUG 1887, part 2: A <math> with a thumbnail- math enabled... FAILED!
Passed 300 of 303 tests (99.01%) FAILED!
On 4/11/06, Steve Bennett <stevage(a)gmail.com> wrote:
>...
> And honestly, we have to stop worrying about whether edit wars will
> break out every time we propose a new feature :)
>
> PS Magnus, {{LIMITTOC|3}} would be fine - for a minute there I thought
> you were telling me about an existing feature and I got all excited :)
>
I'd prefer {{TOClimit|3}} to match existing documentation for {{TOCleft}}
and {{TOCright}}, that will make it easier for folks to remember.
I just saw the de.wikipedia article about the pKB value, which:
* looks like "PKB"
* should look like "pK<sub>B</sub>"
This looks pityful, and the note that it can't be shown otherwise for
technical reasons doesn't really help the matter.
I suggest the implementation of a new magic template:
{{DISPLAYTITLE|HTML-encoded title}}
which will change the display of the title. I am aware that it would be
a potential target for vandals, but hey, what on wikipedia isn't?
I'd be willing to implement it if there's no major objection.
Magnus
{{SERVER}}{{localurl:{{{Link}}}|preload={{{Preload}}}&action=edit}}
1) When I do not put "&action=edit" in the code, the preload-parameter
does not seem to work. Can someone explain why in this code the "
&action=edit" MUST be there in order for the preload-parameter to be passed?
2) Where in the MediaWiki source code is it possible to adapt "action=edit"?
Thanks!