Added feature to embedd Youtube videos to wiki commands for usage in

Wiki, Blog or other servlets
pull/1/head
Copro 12 years ago
parent 946fad48c7
commit ee9d7fd93d

@ -141,6 +141,16 @@
</td>
</tr>
<tr valign="top">
<td class="tt">
<span class="tt" style="white-space: nowrap;">[[Youtube:id]]</span><br />
</td>
<td>
This tag displays a Youtube video with the id specified and fixed width 425 pixels and height 350 pixels.
i.e. use [[Youtube:QZsWG4-7Qfk]] to embedd this video: https://www.youtube.com/watch?v=QZsWG4-7Qfk
</td>
</tr>
<tr valign="top">
<td class="tt">
{|<br />

@ -3240,6 +3240,9 @@ pagename==Seitenname
description\]\]==Beschreibung]]
This tag creates links to other pages of the wiki.==Dieser Tag erzeugt einen Link zu einer anderen Seite im Wiki.
This tag displays an image, it can be aligned left, right or center.==Dieser Tag fügt ein Bild ein, es kann links (left), rechts (right) oder mittig (center) ausgerichtet werden.
This tag displays a Youtube video with the id specified and fixed width 425 pixels and height 350 pixels.==Dieser Tag fügt ein Youtube Video mit der angegeben id und einer fixen Höhe von 425 Pixeln und einer fixen Breite von 350 Pixeln ein.
i.e. use==z.B. wird mit
to embedd this video:==dieses Video eingebunden:
These tags create a table, whereas the first marks the beginning of the table, the second starts==Diese Tags erstellen eine Tabelle, wobei der erste den Anfang der Tabelle markiert, der zweite beginnt
a new line, the third and fourth each create a new cell in the line. The last displayed tag==eine neue Zeile, der dritte und vierte erzeugen eine neue Zelle in der Zeile. Der zuletzt dargestellte Tag
closes the table.==schließt die Tabelle.

@ -114,6 +114,7 @@ public class WikiCode extends AbstractWikiParser implements WikiParser {
private static final String WIKI_CLOSE_PRE_ESCAPED = "&lt;/pre&gt;";
private static final String WIKI_HR_LINE = "----";
private static final String WIKI_IMAGE = "Image:";
private static final String WIKI_YOUTUBE = "Youtube:";
private static final String WIKI_OPEN_PRE_ESCAPED = "&lt;pre&gt;";
private static final char ASTERISK = '*';
@ -131,6 +132,7 @@ public class WikiCode extends AbstractWikiParser implements WikiParser {
private static final int LEN_WIKI_OPEN_LINK = WIKI_OPEN_LINK.length();
private static final int LEN_WIKI_CLOSE_LINK = WIKI_CLOSE_LINK.length();
private static final int LEN_WIKI_IMAGE = WIKI_IMAGE.length();
private static final int LEN_WIKI_YOUTUBE = WIKI_YOUTUBE.length();
private static final int LEN_WIKI_OPEN_EXTERNAL_LINK = WIKI_OPEN_EXTERNAL_LINK.length();
private static final int LEN_WIKI_CLOSE_EXTERNAL_LINK = WIKI_CLOSE_EXTERNAL_LINK.length();
private static final int LEN_WIKI_HR_LINE = WIKI_HR_LINE.length();
@ -636,8 +638,12 @@ public class WikiCode extends AbstractWikiParser implements WikiParser {
}
line = line.substring(0, positionOfOpeningTag) + "<img src=\"" + kl + "\"" + align + alt + ">" + line.substring(positionOfClosingTag + LEN_WIKI_CLOSE_LINK);
}
// this is the part of the code that's responsible for Youtube video links supporting only the video ID as parameter
else if (kl.startsWith(WIKI_YOUTUBE)) {
kl = kl.substring(LEN_WIKI_YOUTUBE);
line = line.substring(0, positionOfOpeningTag) + "" + "<object width=\"425\" height=\"350\"><param name=\"movie\" value=\"http://www.youtube.com/v/" + kl + "\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/v/" + kl + "\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"350\"></embed></object>";
}
// if it's no image, it might be an internal link
else {
if ((p = kl.indexOf(PIPE_ESCAPED)) > 0) {
kv = kl.substring(p + LEN_PIPE_ESCAPED);

Loading…
Cancel
Save