From ee9d7fd93d3859a668f93abb013eb847977567c9 Mon Sep 17 00:00:00 2001 From: Copro Date: Wed, 23 Jan 2013 02:43:58 +0100 Subject: [PATCH 1/3] Added feature to embedd Youtube videos to wiki commands for usage in Wiki, Blog or other servlets --- htroot/WikiHelp.html | 10 ++++++++++ locales/de.lng | 3 +++ source/net/yacy/data/wiki/WikiCode.java | 8 +++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/htroot/WikiHelp.html b/htroot/WikiHelp.html index ee3dbb864d..9a2f7b0041 100644 --- a/htroot/WikiHelp.html +++ b/htroot/WikiHelp.html @@ -141,6 +141,16 @@

Wiki-Code

+ + + [[Youtube:id]]
+ + + 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 + + + {|
diff --git a/locales/de.lng b/locales/de.lng index b6de14c617..660b9c2b21 100644 --- a/locales/de.lng +++ b/locales/de.lng @@ -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. diff --git a/source/net/yacy/data/wiki/WikiCode.java b/source/net/yacy/data/wiki/WikiCode.java index 4f4661aa31..ce9fd296e2 100644 --- a/source/net/yacy/data/wiki/WikiCode.java +++ b/source/net/yacy/data/wiki/WikiCode.java @@ -114,6 +114,7 @@ private static enum Tags { private static final String WIKI_CLOSE_PRE_ESCAPED = "</pre>"; 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 = "<pre>"; private static final char ASTERISK = '*'; @@ -131,6 +132,7 @@ private static enum Tags { 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 @@ private static String processLinksAndImages(final String hostport, String line) } line = line.substring(0, positionOfOpeningTag) + "" + 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) + "" + ""; } - // 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); From 3ea83809597d091e5fe0f7f382361dcd3616beb6 Mon Sep 17 00:00:00 2001 From: Copro Date: Wed, 23 Jan 2013 04:00:15 +0100 Subject: [PATCH 2/3] Adding Vimeo tag to wiki commands to embedd Video video with id --- htroot/WikiHelp.html | 9 ++++++--- locales/de.lng | 4 ++-- source/net/yacy/data/wiki/WikiCode.java | 18 +++++++++++++----- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/htroot/WikiHelp.html b/htroot/WikiHelp.html index 9a2f7b0041..f1ea257f5e 100644 --- a/htroot/WikiHelp.html +++ b/htroot/WikiHelp.html @@ -123,7 +123,8 @@

Wiki-Code

- [url]
[url description] + [url]
+ [url description] This tag creates links to external websites. @@ -144,10 +145,12 @@

Wiki-Code

[[Youtube:id]]
+ [[Vimeo:id]]
- 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 + This tag displays a Youtube or Vimeo 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
+ i.e. use [[Vimeo:32200946]] to embedd this video: http://vimeo.com/32200946
diff --git a/locales/de.lng b/locales/de.lng index 660b9c2b21..008c511a84 100644 --- a/locales/de.lng +++ b/locales/de.lng @@ -3240,7 +3240,7 @@ 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. +This tag displays a Youtube or Vimeo video with the id specified and fixed width 425 pixels and height 350 pixels.==Dieser Tag fügt ein Youtube oder Vimeo 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 @@ -3249,7 +3249,7 @@ closes the table.==schließt die Tabelle. #The escape tags will cause all tags in the text between the starting and the closing tag to not be treated as wiki-code.==Durch diesen Tag wird der Text, der zwischen den Klammern steht, nicht interpretiert und unformatiert als normaler Text ausgegeben. A text between these tags will keep all the spaces and linebreaks in it. Great for ASCII-art and program code.==Ein Text zwischen diesen Tags wird alle Leerzeichen und Zeilenumbrüche beinhalten. Gut geeignet für ASCII-Kunst und Programm Code. If a line starts with a space, it will be displayed in a non-proportional font.==Wenn eine Zeile mit einem Leerzeichen anfängt, wird diese als nicht-proportionale Schriftart dargestellt. -url description==URL Beschreibung +url description==url Beschreibung This tag creates links to external websites.==Dieser Tag erstellt einen Link zu einer externen Internetseite. alt text==alt Beschreibung #----------------------------- diff --git a/source/net/yacy/data/wiki/WikiCode.java b/source/net/yacy/data/wiki/WikiCode.java index ce9fd296e2..44c84149b0 100644 --- a/source/net/yacy/data/wiki/WikiCode.java +++ b/source/net/yacy/data/wiki/WikiCode.java @@ -114,7 +114,8 @@ private static enum Tags { private static final String WIKI_CLOSE_PRE_ESCAPED = "</pre>"; 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_VIDEO_YOUTUBE = "Youtube:"; + private static final String WIKI_VIDEO_VIMEO = "Vimeo:"; private static final String WIKI_OPEN_PRE_ESCAPED = "<pre>"; private static final char ASTERISK = '*'; @@ -132,7 +133,8 @@ private static enum Tags { 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_VIDEO_YOUTUBE = WIKI_VIDEO_YOUTUBE.length(); + private static final int LEN_WIKI_VIDEO_VIMEO = WIKI_VIDEO_VIMEO.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(); @@ -639,11 +641,17 @@ private static String processLinksAndImages(final String hostport, String line) line = line.substring(0, positionOfOpeningTag) + "" + 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); + // this is the part of the code that is responsible for Youtube video links supporting only the video ID as parameter + else if (kl.startsWith(WIKI_VIDEO_YOUTUBE)) { + kl = kl.substring(LEN_WIKI_VIDEO_YOUTUBE); line = line.substring(0, positionOfOpeningTag) + "" + ""; } + // this is the part of the code that is responsible for Vimeo video links supporting only the video ID as parameter + else if (kl.startsWith(WIKI_VIDEO_VIMEO)) { + kl = kl.substring(LEN_WIKI_VIDEO_VIMEO); + line = line.substring(0, positionOfOpeningTag) + "" + ""; + } + // 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); From 00259839936da3880fd0a57bc8711c3ddcbca363 Mon Sep 17 00:00:00 2001 From: Copro Date: Wed, 23 Jan 2013 04:11:55 +0100 Subject: [PATCH 3/3] Fix typo embedd -> embed --- htroot/WikiHelp.html | 4 ++-- locales/de.lng | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htroot/WikiHelp.html b/htroot/WikiHelp.html index f1ea257f5e..d4fe5d4b10 100644 --- a/htroot/WikiHelp.html +++ b/htroot/WikiHelp.html @@ -149,8 +149,8 @@

Wiki-Code

This tag displays a Youtube or Vimeo 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
- i.e. use [[Vimeo:32200946]] to embedd this video: http://vimeo.com/32200946
+ i.e. use [[Youtube:QZsWG4-7Qfk]] to embed this video: https://www.youtube.com/watch?v=QZsWG4-7Qfk
+ i.e. use [[Vimeo:32200946]] to embed this video: http://vimeo.com/32200946
diff --git a/locales/de.lng b/locales/de.lng index 008c511a84..62a7396e6b 100644 --- a/locales/de.lng +++ b/locales/de.lng @@ -3242,7 +3242,7 @@ This tag creates links to other pages of the wiki.==Dieser Tag erzeugt einen Lin 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 or Vimeo video with the id specified and fixed width 425 pixels and height 350 pixels.==Dieser Tag fügt ein Youtube oder Vimeo 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: +to embed 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.