From 3641199a253e8f92f378f03926af80724ef04146 Mon Sep 17 00:00:00 2001
From: Anika Henke <anika@selfthinker.org>
Date: Sun, 2 Feb 2014 14:42:47 +0000
Subject: [PATCH] fixed html errors in video and audio rendering

---
 inc/parser/xhtml.php            | 10 +++++++---
 lib/tpl/dokuwiki/css/basic.less |  6 +++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index 5fca1bf45..80701cd2e 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -1302,8 +1302,9 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
         $out = '';
         // open video tag
         $out .= '<video '.buildAttributes($atts).' controls="controls"';
-        if ($posterUrl) $out .= ' poster="'.$posterUrl.'"';
+        if ($posterUrl) $out .= ' poster="'.hsc($posterUrl).'"';
         $out .= '>'.NL;
+        $fallback = '';
 
         // output source for each alternative video format
         foreach($alternatives as $mime => $file) {
@@ -1312,10 +1313,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
 
             $out .= '<source src="'.hsc($url).'" type="'.$mime.'" />'.NL;
             // alternative content (just a link to the file)
-            $out .= $this->internalmedia($file, $title, NULL, NULL, NULL, $cache=NULL, $linking='linkonly', $return=true);
+            $fallback .= $this->internalmedia($file, $title, NULL, NULL, NULL, $cache=NULL, $linking='linkonly', $return=true);
         }
 
         // finish
+        $out .= $fallback;
         $out .= '</video>'.NL;
         return $out;
     }
@@ -1338,6 +1340,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
         $out = '';
         // open audio tag
         $out .= '<audio '.buildAttributes($atts).' controls="controls">'.NL;
+        $fallback = '';
 
         // output source for each alternative audio format
         foreach($alternatives as $mime => $file) {
@@ -1346,10 +1349,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
 
             $out .= '<source src="'.hsc($url).'" type="'.$mime.'" />'.NL;
             // alternative content (just a link to the file)
-            $out .= $this->internalmedia($file, $title, NULL, NULL, NULL, $cache=NULL, $linking='linkonly', $return=true);
+            $fallback .= $this->internalmedia($file, $title, NULL, NULL, NULL, $cache=NULL, $linking='linkonly', $return=true);
         }
 
         // finish
+        $out .= $fallback;
         $out .= '</audio>'.NL;
         return $out;
     }
diff --git a/lib/tpl/dokuwiki/css/basic.less b/lib/tpl/dokuwiki/css/basic.less
index 636923192..c296185e9 100644
--- a/lib/tpl/dokuwiki/css/basic.less
+++ b/lib/tpl/dokuwiki/css/basic.less
@@ -93,8 +93,6 @@ pre,
 table,
 hr,
 blockquote,
-video,
-audio,
 figure,
 details,
 fieldset,
@@ -103,7 +101,9 @@ address {
     padding: 0;
 }
 
-div {
+div,
+video,
+audio {
     margin: 0;
     padding: 0;
 }
-- 
GitLab