changeset 2261:b459b643bf5a

Added "video" element to include YouTube videos.
author Valentin Bartenev <vbart@nginx.com>
date Mon, 29 Oct 2018 19:52:32 +0300
parents 4e53813fbe21
children 086e307d8b28
files dtd/content.dtd xsls/content.xsls xsls/style.xsls
diffstat 3 files changed, 24 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dtd/content.dtd
+++ b/dtd/content.dtd
@@ -11,7 +11,7 @@
 >
 
 <!ELEMENT  para         (#PCDATA | link | links | varlinks | br | list | note |
-                         i | b | nobr | table | literal | command |
+                         i | b | nobr | table | literal | command | video |
                          path | example | header | value | programlisting |
                          initial |
                          mainline_version | stable_version | commercial_version |
@@ -95,6 +95,11 @@
 
 <!ELEMENT  paypal       EMPTY >
 
+<!ELEMENT  video        EMPTY >
+<!ATTLIST  video
+           id           CDATA #IMPLIED
+>
+
 <!ELEMENT  mainline_version    EMPTY >
 <!ELEMENT  stable_version      EMPTY >
 <!ELEMENT  commercial_version  (#PCDATA) >
--- a/xsls/content.xsls
+++ b/xsls/content.xsls
@@ -178,5 +178,12 @@ X:stylesheet {
     X:template = "nobr" { <nobr> !!; </nobr> }
     X:template = "br" { <br/> }
 
-
+    X:template = "video[@id]" {
+        <div class="video">
+        <iframe type="text/html"
+                src="https://www.youtube.com/embed/{@id}?modestbranding=1&amp;rel=0&amp;showinfo=0&amp;color=white"
+                frameborder="0" allowfullscreen="1">
+        </iframe>
+        </div>
+    }
 }
--- a/xsls/style.xsls
+++ b/xsls/style.xsls
@@ -94,6 +94,16 @@ X:template style (lang) {
                             padding:        0;
                             margin:         0; }
         sup               { font-size:      50%; }
+        .video            { position: relative;
+                            padding-bottom: 56.25%;
+                            overflow: hidden; }
+        .video iframe,
+        .video object,
+        .video embed      { position: absolute;
+                            top:0;
+                            left:0;
+                            width:100%;
+                            height:100%; }
         ') }
 
     X:if "$lang = 'he'" {