From fc34ffc506923c8797a434bf29d12c76bd42b164 Mon Sep 17 00:00:00 2001
From: "Dr. Martin Goik" <goik@hdm-stuttgart.de>
Date: Wed, 16 Dec 2020 09:53:03 +0100
Subject: [PATCH] Switching to https://highlightjs.org

---
 ws/Docbook/CustomLayer/slide/slideHdm.xsl     | 635 +++++++++---------
 .../CustomLayer/webhelp/hdmextensions.xsl     |  86 +++
 ws/Docbook/CustomLayer/webhelp/webhelpHdm.xsl |   2 +
 ws/Docbook/Extensions/Tdata/Listing/doc.xml   |   2 +-
 ws/Docbook/Preprocess/make.rules              |  13 +-
 5 files changed, 428 insertions(+), 310 deletions(-)

diff --git a/ws/Docbook/CustomLayer/slide/slideHdm.xsl b/ws/Docbook/CustomLayer/slide/slideHdm.xsl
index 120a192ae..c58b618c6 100644
--- a/ws/Docbook/CustomLayer/slide/slideHdm.xsl
+++ b/ws/Docbook/CustomLayer/slide/slideHdm.xsl
@@ -1,57 +1,58 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1"
-  xmlns:xlink="http://www.w3.org/1999/xlink"
-  xmlns:d="http://docbook.org/ns/docbook"
+  xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:d="http://docbook.org/ns/docbook"
   xmlns="http://www.w3.org/1999/xhtml">
-  
+
   <xsl:import href="../../docbook-xsl/xhtml/chunk.xsl"/>
   <xsl:import href="../../docbook-xsl/xhtml/highlight.xsl"/>
   <xsl:import href="../../docbook-xsl/webhelp/xsl/webhelp-common.xsl"/>
   <xsl:import href="../../docbook-xsl/webhelp/xsl/titlepage.templates.xsl"/>
-  
+
   <xsl:import href="../Common/common.xsl"/>
   <xsl:import href="../../Preprocess/Xsl/slideReference.xsl"/>
-  
+
   <xsl:variable name="topicLookup" select="document('topics.tid.xml', .)"/>
-  
-  <xsl:template match="/">        
-    <xsl:apply-templates select="
-      (//d:chapter | //d:section | //d:appendix) [contains(@annotations, 'slide') or 
-      descendant::*[contains(@annotations, 'slide')]]"
-      mode = "slideUnit"/>    
+
+  <xsl:template match="/">
+    <xsl:apply-templates
+      select="
+        (//d:chapter | //d:section | //d:appendix)[contains(@annotations, 'slide') or
+        descendant::*[contains(@annotations, 'slide')]]"
+      mode="slideUnit"/>
   </xsl:template>
-  
+
   <xsl:template name="createBreadcrumbHierarchy">
     <xsl:param name="nodes"/>
     <xsl:param name="currentPosition"/>
     <ul>
       <li style="list-style-type: none;">
-        
+
         <xsl:if test="not($currentPosition = 1)">
           <xsl:text>➟ </xsl:text>
         </xsl:if>
-        
-        <xsl:apply-templates select="$nodes[$currentPosition]/d:title/text()|$nodes[$currentPosition]/d:title/*"/>
-        
+
+        <xsl:apply-templates
+          select="$nodes[$currentPosition]/d:title/text() | $nodes[$currentPosition]/d:title/*"/>
+
         <xsl:choose>
           <xsl:when test="$currentPosition &lt; count($nodes)">
             <xsl:variable name="nextPosition" select="$currentPosition + 1"/>
-            <xsl:call-template  name="createBreadcrumbHierarchy">
+            <xsl:call-template name="createBreadcrumbHierarchy">
               <xsl:with-param name="nodes" select="$nodes"/>
               <xsl:with-param name="currentPosition" select="$nextPosition"/>
             </xsl:call-template>
           </xsl:when>
-          
+
           <xsl:otherwise>
             <div class="slideSectionOverview">
               <xsl:apply-templates select="$nodes[$currentPosition]/d:info/d:abstract/d:para"/>
             </div>
           </xsl:otherwise>
-        </xsl:choose>       
+        </xsl:choose>
       </li>
     </ul>
-  </xsl:template>  
-  
+  </xsl:template>
+
   <xsl:template name="createTooltipBreadcrumbHierarchy">
     <xsl:param name="nodes"/>
     <xsl:param name="currentPosition"/>
@@ -59,139 +60,141 @@
       <xsl:if test="$currentPosition = 1">
         <xsl:attribute name="class">tooltiptext</xsl:attribute>
       </xsl:if>
-      
+
       <li style="list-style-type: none;">
         <xsl:if test="not($currentPosition = 1)">
           <xsl:text>➟ </xsl:text>
         </xsl:if>
-        
-        <xsl:apply-templates select="$nodes[$currentPosition]/d:title/text()|$nodes[$currentPosition]/d:title/*"/>
-        
+
+        <xsl:apply-templates
+          select="$nodes[$currentPosition]/d:title/text() | $nodes[$currentPosition]/d:title/*"/>
+
         <xsl:if test="$currentPosition &lt; count($nodes)">
           <xsl:variable name="nextPosition" select="$currentPosition + 1"/>
-          <xsl:call-template  name="createTooltipBreadcrumbHierarchy">
+          <xsl:call-template name="createTooltipBreadcrumbHierarchy">
             <xsl:with-param name="nodes" select="$nodes"/>
             <xsl:with-param name="currentPosition" select="$nextPosition"/>
           </xsl:call-template>
         </xsl:if>
       </li>
     </ul>
-  </xsl:template>  
-  
+  </xsl:template>
+
   <xsl:template match="d:chapter | d:section | d:appendix" mode="slideUnit">
-    
+
     <xsl:variable name="slideFileName">
       <xsl:call-template name="slideFilename">
         <xsl:with-param name="slideContainerId" select="@xml:id"/>
       </xsl:call-template>
     </xsl:variable>
-    
-    <!-- Writing slide series -->    
-    <xsl:document href="{$slideFileName}" method="html" encoding="utf-8" indent="yes" doctype-system="none">
-      
+
+    <!-- Writing slide series -->
+    <xsl:document href="{$slideFileName}" method="html" encoding="utf-8" indent="yes"
+      doctype-system="none">
+
       <html lang="en">
         <head>
           <title>
             <xsl:value-of select="d:title"/>
           </title>
-          <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
-          <link href="common/css/positioning.css" rel="stylesheet" />
-          <link href="reveal.js/css/reveal.css" rel="stylesheet" />
-          <link href="reveal.js/css/theme/serif.css" id="theme" rel="stylesheet" />
-          
+          <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
+          <link href="common/css/positioning.css" rel="stylesheet"/>
+          <link href="reveal.js/css/reveal.css" rel="stylesheet"/>
+          <link href="reveal.js/css/theme/serif.css" id="theme" rel="stylesheet"/>
+
           <!-- Code syntax highlighting -->
-          <link href="reveal.js/lib/css/zenburn.css" rel="stylesheet" />
-          
+          <link href="reveal.js/lib/css/zenburn.css" rel="stylesheet"/>
+
           <style>
             /* Tooltip container */
             .tooltip {
-            position: relative;
-            display: inline-block;
-            border-bottom: 1px dotted black; /* If you want dots under the hoverable text */
+              position: relative;
+              display: inline-block;
+              border-bottom: 1px dotted black; /* If you want dots under the hoverable text */
             }
             
             /* Tooltip text */
             .tooltip .tooltiptext {
-            visibility: hidden;
-            width: 600px;
-            background-color: #555;
-            color: #fff;
-            padding: 50px;
-            border-radius: 6px;
+              visibility: hidden;
+              width: 600px;
+              background-color: #555;
+              color: #fff;
+              padding: 50px;
+              border-radius: 6px;
             
-            /* Position the tooltip text */
-            position: absolute;
-            z-index: 1;
-            bottom: 110%;
-            left: 0%;
-            margin-left: -300px;
+              /* Position the tooltip text */
+              position: absolute;
+              z-index: 1;
+              bottom: 110%;
+              left: 0%;
+              margin-left: -300px;
             
-            /* Fade in tooltip */
-            opacity: 0;
-            transition: opacity 0.3s;
+              /* Fade in tooltip */
+              opacity: 0;
+              transition: opacity 0.3s;
             }
             
             /* Tooltip arrow */
             .tooltip .tooltiptext::after {
-            content: "";
-            position: absolute;
-            top: 100%;
-            left: 50%;
-            margin-left: -5px;
-            border-width: 5px;
-            border-style: solid;
-            border-color: #555 transparent transparent transparent;
+              content: "";
+              position: absolute;
+              top: 100%;
+              left: 50%;
+              margin-left: -5px;
+              border-width: 5px;
+              border-style: solid;
+              border-color: #555 transparent transparent transparent;
             }
             
             /* Show the tooltip text when you mouse over the tooltip container */
             .tooltip:hover .tooltiptext {
-            visibility: visible;
-            opacity: 1;
-            }
-          </style>
-          
+              visibility: visible;
+              opacity: 1;
+            }</style>
+
           <!-- Using free header and footer zones -->
           <style type="text/css">
             .header-left {
-            position: absolute;
-            top: 0%;
-            left: 0%;
+              position: absolute;
+              top: 0%;
+              left: 0%;
             }
             .header-right {
-            position: absolute;
-            top: 0%;
-            right: 0%;
+              position: absolute;
+              top: 0%;
+              right: 0%;
             }
             .footer-center {
-            position: absolute;
-            bottom: 0%;
-            left: 40%;
+              position: absolute;
+              bottom: 0%;
+              left: 40%;
             }</style>
         </head>
-        
+
         <body>
           <!-- Wrap the entire slide show in a div using the "reveal" class. -->
           <div class="reveal">
             <!-- Wrap all slides in a single "slides" class -->
-            
-            <xsl:variable name="revealSections" select="
-              
-              .//d:figure[not (ancestor::d:qandaset)] |
-              
-              (descendant-or-self::d:chapter|
-              descendant-or-self::d:section |
-              descendant-or-self::d:appendix) [d:figure[not (ancestor::d:qandaset)]]"/>
-            
-            <xsl:apply-templates select="$revealSections"
-              mode="slideRootHeaders"/>
-            
+
+            <xsl:variable name="revealSections"
+              select="
+                
+                .//d:figure[not(ancestor::d:qandaset)] |
+                
+                (descendant-or-self::d:chapter |
+                descendant-or-self::d:section |
+                descendant-or-self::d:appendix)[d:figure[not(ancestor::d:qandaset)]]"/>
+
+            <xsl:apply-templates select="$revealSections" mode="slideRootHeaders"/>
+
             <div class="slides">
-              <xsl:apply-templates select="$revealSections"
-                mode="slideRootSections"/>
+              <xsl:apply-templates select="$revealSections" mode="slideRootSections"/>
             </div>
           </div>
-          
-          <script src="reveal.js/js/reveal.js"></script>
+
+          <script src="reveal.js/js/reveal.js"/>
+          <link rel="stylesheet"
+            href="https://freedocs.mi.hdm-stuttgart.de/lib/highlight.js/styles/idea.css"/>
           <script>/*<![CDATA[*/
             
             Reveal.initialize({
@@ -213,68 +216,66 @@
             { src: 'reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
             { src: 'reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
             { src: 'reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
-            { src: 'reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
+            { src: 'https://freedocs.mi.hdm-stuttgart.de/lib/highlight.js/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
             { src: 'reveal.js/plugin/zoom-js/zoom.js', async: true },
             { src: 'reveal.js/plugin/notes/notes.js', async: true },
             { src: 'reveal.js/plugin/math/math.js', async: true }
             ]
             });
             /*]]>*/</script>
-          
-          <script src="common/jquery/jquery-1.7.2.min.js"></script>
-          <script type="text/javascript">  
-            
-            Reveal.addEventListener( 'slidechanged', function( event ) {
-            $.currHeaderId = '#__HEADER_' + event.currentSlide.getAttribute("id");
-            $.previusHeaderId = '#__HEADER_' + event.previousSlide.getAttribute("id");
-            
-            $($.previusHeaderId).attr("style", "display:none;");
-            $($.currHeaderId).attr("style", "display:block;");
-            
-            //$('#myShow').text($.previusHeaderId + ":" + $.currHeaderId);
-            } );
+
+          <script src="common/jquery/jquery-1.7.2.min.js"/>
+          <script type="text/javascript">
+            Reveal.addEventListener('slidechanged', function (event) {
+              $.currHeaderId = '#__HEADER_' + event.currentSlide.getAttribute("id");
+              $.previusHeaderId = '#__HEADER_' + event.previousSlide.getAttribute("id");
+              
+              $($.previusHeaderId).attr("style", "display:none;");
+              $($.currHeaderId).attr("style", "display:block;");
+              
+              //$('#myShow').text($.previusHeaderId + ":" + $.currHeaderId);
+            });
             
-            Reveal.addEventListener( 'ready', function( event ) {	
-            $.currHeaderId = '#__HEADER_' + event.currentSlide.getAttribute("id");	    
-            $($.currHeaderId).attr("style", "display:block;");	
-            //$('#myShow').text($.currHeaderId);
-            } );   
-          </script>  
-          
+            Reveal.addEventListener('ready', function (event) {
+              $.currHeaderId = '#__HEADER_' + event.currentSlide.getAttribute("id");
+              $($.currHeaderId).attr("style", "display:block;");
+              //$('#myShow').text($.currHeaderId);
+            });</script>
+
         </body>
       </html>
     </xsl:document>
   </xsl:template>
-  
-  <xsl:template match="d:chapter|d:section|d:appendix" mode="slideRootHeaders">
+
+  <xsl:template match="d:chapter | d:section | d:appendix" mode="slideRootHeaders">
     <div id="__HEADER_{@xml:id}" style="display: none;">
-      
+
       <div class="header-left" style="z-index: 1000;">
-        
-          <h3>Overview</h3>
+
+        <h3>Overview</h3>
         <!-- 
         <xsl:apply-templates select="d:title"/>
         -->
       </div>
-      
+
       <div class="footer-center" style="z-index: 1000;">
         <xsl:apply-templates mode="footer" select="."/>
       </div>
-    </div>    
+    </div>
   </xsl:template>
-  
+
   <xsl:template name="generateFollowupQandasetHeaders">
-    
-    <xsl:variable name="currentFigureGenerateId" select="generate-id()"/>    
-    <xsl:variable name="followupQandasets" 
+
+    <xsl:variable name="currentFigureGenerateId" select="generate-id()"/>
+    <xsl:variable name="followupQandasets"
       select="following::d:qandaset[generate-id(preceding::d:figure[not(ancestor::d:qandaset)][1]) = $currentFigureGenerateId]"/>
-    
+
     <xsl:if test="$followupQandasets">
-      
+
       <div id="__HEADER_{@xml:id}_followupExercise" style="display: none;">
-        
+
         <div class="header-left" style="z-index: 1000;">
-          
+
           <xsl:choose>
             <xsl:when test="1 = count($followupQandasets)">
               <h3>Followup exercise</h3>
@@ -282,14 +283,14 @@
             <xsl:otherwise>
               <h3>Followup exercises</h3>
             </xsl:otherwise>
-          </xsl:choose>            
+          </xsl:choose>
         </div>
-        
+
         <div class="footer-center" style="z-index: 1000;">
           <xsl:apply-templates mode="footer" select="."/>
         </div>
-         
-         <!--
+
+        <!--
         
         <div class="footer-center" style="z-index: 1000;">
           <xsl:choose>
@@ -304,17 +305,17 @@
       </div>    
       -->
       </div>
-    </xsl:if>   
+    </xsl:if>
   </xsl:template>
-  
+
   <xsl:template match="d:figure" mode="slideRootHeaders">
-    
+
     <xsl:variable name="primarySectionId">
       <xsl:apply-templates mode="id_or_generate_id" select="."/>
     </xsl:variable>
-    
+
     <xsl:variable name="currentFigure" as="element()*" select="."/>
-        
+
     <xsl:variable name="figBasename">
       <xsl:call-template name="hdm.get.leftmost.of.separator">
         <xsl:with-param name="path" select="d:mediaobject/d:imageobject/d:imagedata/@fileref"/>
@@ -324,98 +325,100 @@
         <xsl:with-param name="path" select="d:mediaobject/d:imageobject/d:imagedata/@fileref"/>
         <xsl:with-param name="separator" select="'.multi.svg'"/>
       </xsl:call-template>
-    </xsl:variable>      
-    
+    </xsl:variable>
+
     <xsl:variable name="figSet" as="element()*">
       <xsl:if test="0 &lt; string-length($figBasename)">
         <xsl:copy-of select="document(concat($figBasename, '.filenames'), .)/start/file"/>
       </xsl:if>
     </xsl:variable>
-    
+
     <xsl:choose>
-      
-      <xsl:when test="1 &lt; count($figSet/*)"> <!-- Image series -->
-        
-          <xsl:for-each select="$figSet/*">
-            
-            <xsl:variable name="currentAnimationId">
-              <xsl:choose>
-                
-                <xsl:when test="1 = position()">
-                  <xsl:value-of select="$primarySectionId"/>
-                </xsl:when>
-                
-                <xsl:otherwise>
-                  <xsl:value-of select="concat($primarySectionId, '-', position() - 1)"/>
-                </xsl:otherwise>
-                
-              </xsl:choose>
-              
-            </xsl:variable>
-            
-            <div id="__HEADER_{$currentAnimationId}" style="display: none;">
-              
-              <div class="header-left" style="z-index: 1000;">
-                <xsl:apply-templates select="$currentFigure/d:title"/>
-              </div>
-              
-              <div class="footer-center" style="z-index: 1000;">               
-                <xsl:apply-templates select="$currentFigure" mode="footer"/>
-              </div>
-              
+
+      <xsl:when test="1 &lt; count($figSet/*)">
+        <!-- Image series -->
+
+        <xsl:for-each select="$figSet/*">
+
+          <xsl:variable name="currentAnimationId">
+            <xsl:choose>
+
+              <xsl:when test="1 = position()">
+                <xsl:value-of select="$primarySectionId"/>
+              </xsl:when>
+
+              <xsl:otherwise>
+                <xsl:value-of select="concat($primarySectionId, '-', position() - 1)"/>
+              </xsl:otherwise>
+
+            </xsl:choose>
+
+          </xsl:variable>
+
+          <div id="__HEADER_{$currentAnimationId}" style="display: none;">
+
+            <div class="header-left" style="z-index: 1000;">
+              <xsl:apply-templates select="$currentFigure/d:title"/>
             </div>
-          </xsl:for-each>
+
+            <div class="footer-center" style="z-index: 1000;">
+              <xsl:apply-templates select="$currentFigure" mode="footer"/>
+            </div>
+
+          </div>
+        </xsl:for-each>
       </xsl:when>
-      
-      <xsl:otherwise>          <!-- Just a single image or other content -->
-        
+
+      <xsl:otherwise>
+        <!-- Just a single image or other content -->
+
         <div id="__HEADER_{$primarySectionId}" style="display: none;">
-          
+
           <div class="header-left" style="z-index: 1000;">
             <xsl:apply-templates select="$currentFigure/d:title"/>
           </div>
-          
-          <div class="footer-center" style="z-index: 1000;">               
+
+          <div class="footer-center" style="z-index: 1000;">
             <xsl:apply-templates select="$currentFigure" mode="footer"/>
           </div>
-          
+
         </div>
-        
-      </xsl:otherwise>             
+
+      </xsl:otherwise>
     </xsl:choose>
-    
+
     <xsl:call-template name="generateFollowupQandasetHeaders"/>
-    
+
   </xsl:template>
-  
-  <xsl:template match="d:chapter|d:section|d:appendix" mode="slideRootSections">
-    
+
+  <xsl:template match="d:chapter | d:section | d:appendix" mode="slideRootSections">
+
     <section id="{@xml:id}">
       <xsl:call-template name="createBreadcrumbHierarchy">
-        
-        <xsl:with-param name="nodes" 
+
+        <xsl:with-param name="nodes"
           select="
-          ancestor-or-self::d:section |
-          ancestor-or-self::d:chapter |
-          ancestor-or-self::d:appendix"/>
-        
+            ancestor-or-self::d:section |
+            ancestor-or-self::d:chapter |
+            ancestor-or-self::d:appendix"/>
+
         <xsl:with-param name="currentPosition" select="1"/>
-        
+
       </xsl:call-template>
     </section>
-    
+
   </xsl:template>
-  
+
   <xsl:template match="d:figure" mode="slideRootSections">
-    
+
     <xsl:variable name="primarySectionId">
       <xsl:apply-templates mode="id_or_generate_id" select="."/>
     </xsl:variable>
-    
-    <xsl:variable name="figureTitle" >
+
+    <xsl:variable name="figureTitle">
       <xsl:apply-templates select="d:title"/>
     </xsl:variable>
-    
+
     <xsl:variable name="baseSupplementDir">
       <xsl:if test="ancestor::*/@xml:base">
         <xsl:call-template name="hdm.get.leftmost.of.separator">
@@ -425,7 +428,7 @@
         <xsl:text>/</xsl:text>
       </xsl:if>
     </xsl:variable>
-    
+
     <xsl:variable name="figBasename">
       <xsl:call-template name="hdm.get.leftmost.of.separator">
         <xsl:with-param name="path" select="d:mediaobject/d:imageobject/d:imagedata/@fileref"/>
@@ -435,63 +438,67 @@
         <xsl:with-param name="path" select="d:mediaobject/d:imageobject/d:imagedata/@fileref"/>
         <xsl:with-param name="separator" select="'.multi.svg'"/>
       </xsl:call-template>
-    </xsl:variable>      
-    
+    </xsl:variable>
+
     <xsl:variable name="figSet" as="element()*">
       <xsl:if test="0 &lt; string-length($figBasename)">
         <xsl:copy-of select="document(concat($figBasename, '.filenames'), .)/start/file"/>
       </xsl:if>
     </xsl:variable>
-    
+
     <xsl:variable name="currentFigureFooter">
       <xsl:apply-templates select="." mode="footer"/>
     </xsl:variable>
-    
+
     <xsl:choose>
-      
-      <xsl:when test="1 &lt; count($figSet/*)"> <!-- Image series -->
+
+      <xsl:when test="1 &lt; count($figSet/*)">
+        <!-- Image series -->
         <section>
           <xsl:for-each select="$figSet/*">
             <section>
               <xsl:choose>
-                
+
                 <xsl:when test="1 = position()">
-                  <xsl:attribute name="id" >
+                  <xsl:attribute name="id">
                     <xsl:value-of select="$primarySectionId"/>
                   </xsl:attribute>
                 </xsl:when>
-                
+
                 <xsl:otherwise>
-                  <xsl:attribute name="id" >
+                  <xsl:attribute name="id">
                     <xsl:value-of select="concat($primarySectionId, '-', position() - 1)"/>
                   </xsl:attribute>
                 </xsl:otherwise>
               </xsl:choose>
-                            
+
               <div class="mediaobject">
-                <img width="95%" src="{concat($baseSupplementDir, $figBasename, '-', position() - 1, '.svg')}"  alt="layered SVG image"/>                  
+                <img width="95%"
+                  src="{concat($baseSupplementDir, $figBasename, '-', position() - 1, '.svg')}"
+                  alt="layered SVG image"/>
               </div>
-                            
+
             </section>
           </xsl:for-each>
         </section>
       </xsl:when>
-      
-      <xsl:otherwise>          <!-- Just a single image or other content -->
-        
+
+      <xsl:otherwise>
+        <!-- Just a single image or other content -->
+
         <section id="{$primarySectionId}">
-          
+
           <xsl:apply-templates select="*[not(self::d:title)]"/>
-          
+
         </section>
-        
-      </xsl:otherwise>             
+
+      </xsl:otherwise>
     </xsl:choose>
-    
+
     <xsl:call-template name="generateFollowupQandasets"/>
-    
+
   </xsl:template>
-  
+
   <xsl:template match="d:imagedata">
     <xsl:variable name="baseSupplementDir">
       <xsl:if test="ancestor::*/@xml:base">
@@ -502,18 +509,19 @@
         <xsl:text>/</xsl:text>
       </xsl:if>
     </xsl:variable>
-    
-    <img width="95%" src="{concat($baseSupplementDir, @fileref)}"  alt="{ancestor::d:figure/d:title}"/>    
+
+    <img width="95%" src="{concat($baseSupplementDir, @fileref)}" alt="{ancestor::d:figure/d:title}"
+    />
   </xsl:template>
-  
+
   <xsl:template name="generateFollowupQandasets">
-    
-    <xsl:variable name="currentFigureGenerateId" select="generate-id()"/>    
-    <xsl:variable name="followupQandasets" 
+
+    <xsl:variable name="currentFigureGenerateId" select="generate-id()"/>
+    <xsl:variable name="followupQandasets"
       select="following::d:qandaset[generate-id(preceding::d:figure[not(ancestor::d:qandaset)][1]) = $currentFigureGenerateId]"/>
-    
+
     <xsl:if test="$followupQandasets">
-      
+
       <xsl:if test="10 &lt; count($followupQandasets)">
         <xsl:message>
           <xsl:text>Warning: </xsl:text>
@@ -524,37 +532,37 @@
           <xsl:value-of select="@xml:id"/>
         </xsl:message>
       </xsl:if>
-      
+
       <xsl:variable name="primarySectionId">
         <xsl:apply-templates mode="id_or_generate_id" select="."/>
       </xsl:variable>
-      
+
       <section id="{$primarySectionId}_followupExercise">
         <xsl:choose>
-          
+
           <xsl:when test="1 = count($followupQandasets)">
             <xsl:apply-templates select="$followupQandasets" mode="createTitleLink"/>
           </xsl:when>
-          
+
           <xsl:otherwise>
             <ol>
               <xsl:for-each select="$followupQandasets">
                 <li>
                   <xsl:apply-templates select="." mode="createTitleLink"/>
-                </li>                
+                </li>
               </xsl:for-each>
             </ol>
           </xsl:otherwise>
-          
-        </xsl:choose>  
-      </section>      
+
+        </xsl:choose>
+      </section>
     </xsl:if>
-    
+
   </xsl:template>
-    
-  <xsl:template match="d:figure" mode="footer"> 
-    
-    <div class="hdmfooter">              
+
+  <xsl:template match="d:figure" mode="footer">
+
+    <div class="hdmfooter">
       <table>
         <tr>
           <td class="tooltip">
@@ -568,52 +576,55 @@
             </a>
           </td>
           <td class="tooltip">
-            <a target="_blank" href="__presentation{ancestor::*[contains(@annotations, 'slide')]/@xml:id}.pdf">
+            <a target="_blank"
+              href="__presentation{ancestor::*[contains(@annotations, 'slide')]/@xml:id}.pdf">
               <img src="common/images/printer.svg" width="60"
                 style="border: 0mm; margin-top: 0mm; margin-bottom: 0mm;"/>
               <p class="tooltiptext">Pdf slides</p>
             </a>
-            
+
           </td>
-          
+
           <td class="tooltip">
-            <a  target="_blank" href="#{parent::*/@xml:id}">
+            <a target="_blank" href="#{parent::*/@xml:id}">
               <img src="common/images/compass.svg" width="60"
                 style="border: 0mm; margin-top: 0mm; margin-bottom: 0mm;"/>
             </a>
             <xsl:call-template name="createTooltipBreadcrumbHierarchy">
-              
-              <xsl:with-param name="nodes" 
+
+              <xsl:with-param name="nodes"
                 select="
-                ancestor-or-self::d:section|
-                ancestor-or-self::d:chapter|
-                ancestor-or-self::d:appendix"/>
-              
+                  ancestor-or-self::d:section |
+                  ancestor-or-self::d:chapter |
+                  ancestor-or-self::d:appendix"/>
+
               <xsl:with-param name="currentPosition" select="1"/>
-              
+
             </xsl:call-template>
           </td>
-          
-          
-          
+
+
+
           <xsl:variable name="qandaId" select="@xml:id"/>
           <xsl:if test="$topicLookup/map/entry[@id = $qandaId]">
-            
+
             <td class="tooltip">
-              <a target="_blank" href="https://bb.mi.hdm-stuttgart.de/topic/{$topicLookup/map/entry[@id = $qandaId]/@tid}">
+              <a target="_blank"
+                href="https://bb.mi.hdm-stuttgart.de/topic/{$topicLookup/map/entry[@id = $qandaId]/@tid}">
                 <img src="common/images/comment.svg"
-                  style="border: 0mm; margin-top: 0mm; margin-bottom: 0mm;" width="60" /></a>
+                  style="border: 0mm; margin-top: 0mm; margin-bottom: 0mm;" width="60"/>
+              </a>
               <p class="tooltiptext">Create comment</p>
             </td>
-          </xsl:if>                    
+          </xsl:if>
         </tr>
       </table>
     </div>
   </xsl:template>
-  
-  <xsl:template match="d:chapter|d:section|d:appendix" mode="footer"> 
-    
-    <div class="hdmfooter">              
+
+  <xsl:template match="d:chapter | d:section | d:appendix" mode="footer">
+
+    <div class="hdmfooter">
       <table>
         <tr>
           <td class="tooltip">
@@ -622,21 +633,21 @@
                 <xsl:call-template name="href.target.uri"/>
               </xsl:attribute>
               <img src="common/images/book.svg" width="60"
-                style="border: 0mm; margin-top: 0mm; margin-bottom: 0mm;"></img>
+                style="border: 0mm; margin-top: 0mm; margin-bottom: 0mm;"/>
               <p class="tooltiptext">Lecture notes</p>
             </a>
-          </td>          
+          </td>
         </tr>
       </table>
     </div>
   </xsl:template>
-  
+
   <xsl:template match="d:qandaset" mode="createTitleLink">
-    
+
     <xsl:variable name="linkTarget">
       <xsl:call-template name="href.target.uri"/>
     </xsl:variable>
-    
+
     <xsl:choose>
       <xsl:when test="d:title">
         <xsl:apply-templates select="d:title/node()" mode="createTitleLink">
@@ -650,24 +661,24 @@
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
-  
-  <xsl:template match="d:xref|d:link" mode="createTitleLink">
+
+  <xsl:template match="d:xref | d:link" mode="createTitleLink">
     <xsl:apply-templates select="."/>
   </xsl:template>
-  
-  <xsl:template match="*|text()" mode="createTitleLink">
+
+  <xsl:template match="* | text()" mode="createTitleLink">
     <xsl:param name="linkTarget"/>
     <a href="{$linkTarget}" target="_blank">
       <xsl:apply-templates select="."/>
     </a>
   </xsl:template>
-  
+
   <!-- Get rid of block object names e.g. "Figure 3.1" -->
   <xsl:template match="d:figure">
     <xsl:apply-templates/>
   </xsl:template>
-  
-  <!-- Ignore e.g. calloutlist elements inside figure --> 
+
+  <!-- Ignore e.g. calloutlist elements inside figure -->
   <xsl:template match="*[contains(@role, 'slideExclude')]">
     <xsl:message>
       <xsl:text>Excluding &lt;</xsl:text>
@@ -675,14 +686,14 @@
       <xsl:text>&gt; from slides</xsl:text>
     </xsl:message>
   </xsl:template>
-  
+
   <xsl:template match="d:figure/d:title">
     <h3>
       <xsl:apply-templates/>
     </h3>
   </xsl:template>
-  
-  <!-- Hack: Docbooxsl:tek XSL does not handle @valign in images-->  
+
+  <!-- Hack: Docbooxsl:tek XSL does not handle @valign in images-->
   <xsl:template match="d:mediaobject[d:imageobject/d:imagedata[@valign]]">
     <img>
       <xsl:attribute name="src">
@@ -695,10 +706,10 @@
         </xsl:if>
         <xsl:value-of select="d:imageobject/d:imagedata/@fileref"/>
       </xsl:attribute>
-      
+
       <xsl:attribute name="style">
         <xsl:variable name="dbValign" select="d:imageobject/d:imagedata/@valign"/>
-        
+
         <xsl:text>vertical-align: </xsl:text>
         <xsl:choose>
           <xsl:when test="$dbValign = 'top'">text-top</xsl:when>
@@ -713,27 +724,49 @@
         </xsl:choose>
       </xsl:attribute>
     </img>
-    
+
   </xsl:template>
-  
+
   <xsl:template match="d:videodata">
     <video controls="controls" preload="auto" width="50%">
       <xsl:attribute name="title">
         <xsl:value-of select="normalize-space(../../../d:title)"/>
       </xsl:attribute>
-      
-      <xsl:variable name="hdm_ImageFilename"> <!-- hdm_ prefix: do not mess with docbook! -->
+
+      <xsl:variable name="hdm_ImageFilename">
+        <!-- hdm_ prefix: do not mess with docbook! -->
         <xsl:call-template name="mediaobject.filename">
           <xsl:with-param name="object" select=".."/>
         </xsl:call-template>
       </xsl:variable>
-      
-      <source src="{$hdm_ImageFilename}" type='video/webm' />
-      <source src="{$hdm_ImageFilename}.mp4" type='video/mp4'/>
+
+      <source src="{$hdm_ImageFilename}" type="video/webm"/>
+      <source src="{$hdm_ImageFilename}.mp4" type="video/mp4"/>
       <xsl:text>Your Browser does not support the video tag</xsl:text>
     </video>
   </xsl:template>
-  
+
+
+  <xsl:template match="d:programlisting">
+    <pre class="programlisting">
+      
+      <xsl:choose>
+        
+        <xsl:when test="not(@language) or @language = 'none'">
+          <xsl:apply-templates/>
+        </xsl:when>
+            
+        <xsl:otherwise>
+          <code class="language-{@language}">
+            <xsl:apply-templates/>
+          </code>
+        </xsl:otherwise>
+             
+      </xsl:choose>
+      
+    </pre>
+  </xsl:template>
+
   <xsl:template match="*" mode="slideRootSections">
     <p>
       <xsl:text>No template defined for element '</xsl:text>
@@ -741,23 +774,23 @@
       <xsl:text>' in mode 'slideRootSections'.</xsl:text>
     </p>
   </xsl:template>
-  
+
   <xsl:template match="*" mode="slideRootHeaders">
     <xsl:message>
       <xsl:text>No template matching '</xsl:text>
       <xsl:value-of select="name(.)"/>
       <xsl:text>' in mode 'slideRootHeaders'</xsl:text>
-    </xsl:message>    
+    </xsl:message>
   </xsl:template>
-  
+
   <xsl:template match="*" mode="slideUnit">
     <xsl:message>
       <xsl:text>No template matching '</xsl:text>
       <xsl:value-of select="name(.)"/>
       <xsl:text>' in mode 'slideUnit'</xsl:text>
-    </xsl:message>    
+    </xsl:message>
   </xsl:template>
-  
+
   <xsl:template match="*" mode="footer">
     <xsl:message>
       <xsl:text>No template defined for element "</xsl:text>
@@ -765,5 +798,5 @@
       <xsl:text>" in mode "footer"</xsl:text>
     </xsl:message>
   </xsl:template>
-  
+
 </xsl:stylesheet>
diff --git a/ws/Docbook/CustomLayer/webhelp/hdmextensions.xsl b/ws/Docbook/CustomLayer/webhelp/hdmextensions.xsl
index a63b78fe6..52b2fcacc 100644
--- a/ws/Docbook/CustomLayer/webhelp/hdmextensions.xsl
+++ b/ws/Docbook/CustomLayer/webhelp/hdmextensions.xsl
@@ -26,6 +26,14 @@
         <xsl:comment>Self closing tags disallowed!</xsl:comment>
       </script>
     </xsl:if>
+    
+    <xsl:if test="//d:programlisting[@language and @language != 'none']|//d:screen[@language and @language != 'none']|//d:synopsis[@language and @language != 'none']">
+      <link rel="stylesheet" type="text/css" href="https://freedocs.mi.hdm-stuttgart.de/lib/highlight.js/styles/idea.css"/>
+      <script type="text/javascript" src="https://freedocs.mi.hdm-stuttgart.de/lib/highlight.js/highlight.js"></script>
+      <script type="text/javascript">hljs.initHighlightingOnLoad();</script>
+    </xsl:if>
+    
+    
   </xsl:template>
   
   <!-- No logo related parameter on offer, sigh! -->
@@ -321,4 +329,82 @@
     
   </xsl:template>
   
+  
+  <!--
+    Redefining for the sake of JavaScript based highlighting
+  -->
+  <xsl:template match="d:programlisting|d:screen|d:synopsis">
+    <xsl:param name="suppress-numbers" select="'0'"/>
+    
+    <xsl:call-template name="anchor"/>
+    
+    <xsl:variable name="div.element">pre</xsl:variable>
+    
+    <xsl:if test="$shade.verbatim != 0">
+      <xsl:message>
+        <xsl:text>The shade.verbatim parameter is deprecated. </xsl:text>
+        <xsl:text>Use CSS instead,</xsl:text>
+      </xsl:message>
+      <xsl:message>
+        <xsl:text>for example: pre.</xsl:text>
+        <xsl:value-of select="local-name(.)"/>
+        <xsl:text> { background-color: #E0E0E0; }</xsl:text>
+      </xsl:message>
+    </xsl:if>
+    
+    <xsl:choose>
+      <xsl:when test="$suppress-numbers = '0'                     and @linenumbering = 'numbered'                     and $use.extensions != '0'                     and $linenumbering.extension != '0'">
+        <xsl:variable name="rtf">
+          <xsl:choose>
+            <xsl:when test="$highlight.source != 0">
+              <xsl:call-template name="apply-highlighting"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:apply-templates/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml">
+          <xsl:apply-templates select="." mode="common.html.attributes"/>
+          <xsl:call-template name="id.attribute"/>
+          <xsl:if test="@width != ''">
+            <xsl:attribute name="width">
+              <xsl:value-of select="@width"/>
+            </xsl:attribute>
+          </xsl:if>
+          <xsl:call-template name="number.rtf.lines">
+            <xsl:with-param name="rtf" select="$rtf"/>
+          </xsl:call-template>
+        </xsl:element>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml">
+          <xsl:apply-templates select="." mode="common.html.attributes"/>
+          <xsl:call-template name="id.attribute"/>
+          <xsl:if test="@width != ''">
+            <xsl:attribute name="width">
+              <xsl:value-of select="@width"/>
+            </xsl:attribute>
+          </xsl:if>
+          <xsl:choose>
+            <xsl:when test="$highlight.source != 0">
+              <xsl:call-template name="apply-highlighting"/>
+            </xsl:when>
+
+            <xsl:when test="not(@language) or @language = 'none'">
+              <xsl:apply-templates/>
+            </xsl:when>
+            
+            <xsl:otherwise>
+              <code class="language-{@language}">
+                <xsl:apply-templates/>
+              </code>
+            </xsl:otherwise>
+
+          </xsl:choose>
+        </xsl:element>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+    
 </xsl:stylesheet>
diff --git a/ws/Docbook/CustomLayer/webhelp/webhelpHdm.xsl b/ws/Docbook/CustomLayer/webhelp/webhelpHdm.xsl
index 3c1b24b32..9b9d073ba 100644
--- a/ws/Docbook/CustomLayer/webhelp/webhelpHdm.xsl
+++ b/ws/Docbook/CustomLayer/webhelp/webhelpHdm.xsl
@@ -8,7 +8,9 @@
   exclude-result-prefixes="doc exsl set d">
   
   <xsl:import href="../../docbook-xsl/xhtml/chunk.xsl"/>
+  <!-- 
   <xsl:import href="../../docbook-xsl/xhtml/highlight.xsl"/>
+  -->
   <xsl:import href="../../docbook-xsl/webhelp/xsl/webhelp-common.xsl"/>
   <xsl:import href="../../docbook-xsl/webhelp/xsl/titlepage.templates.xsl"/>
 
diff --git a/ws/Docbook/Extensions/Tdata/Listing/doc.xml b/ws/Docbook/Extensions/Tdata/Listing/doc.xml
index c547ec63d..c623bb556 100644
--- a/ws/Docbook/Extensions/Tdata/Listing/doc.xml
+++ b/ws/Docbook/Extensions/Tdata/Listing/doc.xml
@@ -26,7 +26,7 @@
     <title>Part</title>
 
     <chapter annotations="slide" xml:id="listings">
-      <title/>
+      <title>Listing examples</title>
 
       <figure xml:id="simpleJavaClass">
         <title>A Java class</title>
diff --git a/ws/Docbook/Preprocess/make.rules b/ws/Docbook/Preprocess/make.rules
index 0890cefa3..fc20ead7b 100644
--- a/ws/Docbook/Preprocess/make.rules
+++ b/ws/Docbook/Preprocess/make.rules
@@ -27,7 +27,6 @@ callout.graphics=0 \
 callout.unicode=1 \
 generate.id.attributes=1 \
 graphicsize.use.img.src.path=1 \
-highlight.source=1 \
 id.warnings=1 \
 keep.relative.image.uris=0 \
 navig.graphics=0 \
@@ -43,7 +42,8 @@ suppress.header.navigation=1 \
 html.cleanup=1 \
 make.clean.html=1
 
-docbookXslPdfParam=
+docbookXslPdfParam=\
+highlight.source=1 
 
 
 # Pdf related Docbook transformation parameter
@@ -104,12 +104,9 @@ SAXONCMD=java -cp "${DBOOK_XSL}/tools/lib/saxon9he.jar:/usr/share/java/xercesImp
 	${SAXONCMD} -s:$(<F) -xsl:${DBOOK_XSL_PREPROCESS}/Xsl/docbook2docbook.xsl >  ${*}.xml
 	${SAXONCMD} -s:$*.xml -xsl:${DBOOK_XSL_PREPROCESS}/Xsl/docbook2topics.xsl ${dbookXslWebhelpParam} > ${@D}/topics.xml
 	if [ $(updateTopics) = 'yes' ]; then ${CMDID2TOPIC}  ${@D}/topics;fi # Only basename without .xml extension
-	${SAXONCMD} -s:$*.xml \
-           -xsl:${DBOOK_XSL_PREPROCESS}/Xsl/docbook2html.xsl > ${*}.html.xml
-	${SAXONCMD} -s:$*.xml \
-           -xsl:${DBOOK_XSL_PREPROCESS}/Xsl/docbook2slide.xsl > ${*}.slide.xml
-	 ${SAXONCMD} -s:$*.xml \
-            -xsl:${DBOOK_XSL_PREPROCESS}/Xsl/docbook2print.xsl > ${*}.print.xml
+	${SAXONCMD} -s:$*.xml -xsl:${DBOOK_XSL_PREPROCESS}/Xsl/docbook2html.xsl > ${*}.html.xml
+	${SAXONCMD} -s:$*.xml -xsl:${DBOOK_XSL_PREPROCESS}/Xsl/docbook2slide.xsl > ${*}.slide.xml
+	${SAXONCMD} -s:$*.xml -xsl:${DBOOK_XSL_PREPROCESS}/Xsl/docbook2print.xsl > ${*}.print.xml
 	tar cv- `find . -name Ref -and -type d|grep -v ^\./target`|tar -x -C $(@D) || echo
 	cd  $(@D); ${SAXONCMD} -s:$(<F) -xsl:${DBOOK_XSL_PREPROCESS}/Xsl/docbookExtractFig.xsl
 	cp -f ${DBOOK_XSL_PREPROCESS}/make.image ${DBOOK_XSL_PREPROCESS}/docbooksupplement.js $(@D)
-- 
GitLab