help3xsl/default.css          |    2 +-
 help3xsl/help.js              |    3 ++-
 help3xsl/online_transform.xsl |   18 +++++++++++++++---
 helpers/xmlhelp.dtd           |   11 +++++++----
 4 files changed, 25 insertions(+), 9 deletions(-)

New commits:
commit cfa7975316e7fa8e88a2c2e06ad37240d1b6e057
Author:     Olivier Hallot <olivier.hal...@libreoffice.org>
AuthorDate: Sat May 14 15:19:49 2022 -0300
Commit:     Olivier Hallot <olivier.hal...@libreoffice.org>
CommitDate: Sun May 15 13:56:18 2022 +0200

    Add SQL code colorization to Help pages
    
    Change-Id: I2c74e63c67a323a6e6b726da352dd23e1a88d886
    Reviewed-on: https://gerrit.libreoffice.org/c/help/+/134329
    Tested-by: Jenkins
    Reviewed-by: Olivier Hallot <olivier.hal...@libreoffice.org>

diff --git a/help3xsl/default.css b/help3xsl/default.css
index 69d86fb2c..bb3a2bc7d 100644
--- a/help3xsl/default.css
+++ b/help3xsl/default.css
@@ -314,7 +314,7 @@ h6 {
     color: red;
     text-align: left;
 }
-
+.sqlcode,
 .pycode,
 .bascode {
     border: solid 5px transparent;
diff --git a/help3xsl/help.js b/help3xsl/help.js
index 65493ab0c..3e9c0fe11 100644
--- a/help3xsl/help.js
+++ b/help3xsl/help.js
@@ -148,10 +148,11 @@ function debounce(fn, wait, indexList) {
     };
 }
 
-// copy pycode and bascode to clipboard on mouse click
+// copy pycode, sqlcode and bascode to clipboard on mouse click
 // Show border when copy is done
 divcopyable(document.getElementsByClassName("bascode"));
 divcopyable(document.getElementsByClassName("pycode"));
+divcopyable(document.getElementsByClassName("sqlcode"));
 
 function divcopyable(itemcopyable){
 for (var i = 0, len = itemcopyable.length; i < len; i++) {
diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl
index a9de0d4f5..ab703aaca 100644
--- a/help3xsl/online_transform.xsl
+++ b/help3xsl/online_transform.xsl
@@ -490,7 +490,7 @@
             </xsl:call-template>
         </xsl:when>
 
-        <xsl:when test="@role='bascode' or @role='pycode'">
+        <xsl:when test="@role='bascode' or @role='pycode' or @role='sqlcode'">
             <xsl:call-template name="brand">
                 <xsl:with-param name="string" select="."/>
             </xsl:call-template>
@@ -533,7 +533,7 @@
             </xsl:call-template>
         </xsl:when>
 
-        <xsl:when test="@role='bascode' or @role='pycode'">
+        <xsl:when test="@role='bascode' or @role='pycode' or @role='sqlcode'">
             <xsl:call-template name="brand">
                 <xsl:with-param name="string" select="."/>
             </xsl:call-template>
@@ -989,7 +989,6 @@
         <pre dir="auto"><code class="language-visual-basic 
line-numbers"><xsl:apply-templates mode="embedded" /></code></pre>
     </div>
 </xsl:template>
-
 <xsl:template match="pycode">
     <div class="pycode" itemscope="true" 
itemtype="http://schema.org/SoftwareSourceCode"; itemprop="codeSampleType" 
content="snippet">
         <xsl:attribute name="data-tooltip"><xsl:value-of 
select="$ui_copyclip"/></xsl:attribute>
@@ -1003,6 +1002,19 @@
     </div>
 </xsl:template>
 
+<xsl:template match="sqlcode">
+    <div class="sqlcode" itemscope="true" 
itemtype="http://schema.org/SoftwareSourceCode"; itemprop="codeSampleType" 
content="snippet">
+        <xsl:attribute name="data-tooltip"><xsl:value-of 
select="$ui_copyclip"/></xsl:attribute>
+        <pre dir="auto"><code class="language-sql"><xsl:apply-templates 
/></code></pre>
+    </div>
+</xsl:template>
+<xsl:template match="sqlcode" mode="embedded">
+    <div class="sqlcode" itemscope="true" 
itemtype="http://schema.org/SoftwareSourceCode"; itemprop="codeSampleType" 
content="snippet">
+        <xsl:attribute name="data-tooltip"><xsl:value-of 
select="$ui_copyclip"/></xsl:attribute>
+        <pre dir="auto"><code class="language-sql"><xsl:apply-templates 
mode="embedded" /></code></pre>
+    </div>
+</xsl:template>
+
 <!-- Insert Logo code snippet  -->
 <xsl:template name="insertlogocode">
     <pre dir="auto"><xsl:apply-templates /></pre>
diff --git a/helpers/xmlhelp.dtd b/helpers/xmlhelp.dtd
index fcb1076b5..99eac47f9 100644
--- a/helpers/xmlhelp.dtd
+++ b/helpers/xmlhelp.dtd
@@ -24,6 +24,7 @@ Version 06-Jun-2017
 
 Version Nov 2018
   Added extensions: H1, .. H6, menuitem, keycode, literal input, widget, note, 
tip, warning
+  Added extensions: pycode, sqlcode, bascode
 -->
 
 <!ELEMENT ahelp (#PCDATA | embedvar | br | comment | emph | menuitem | widget 
| keycode | input | literal | sub | sup | item | link | switchinline | 
variable)*>
@@ -43,7 +44,9 @@ Version Nov 2018
 
 <!ELEMENT pycode (paragraph+)>
 
-<!ELEMENT body (h1 | h2 | h3 | h4 | h5 | h6 | section | paragraph | table | 
comment | bookmark | switch | embed | list | sort | bascode | pycode | note | 
warning |tip)*>
+<!ELEMENT sqlcode (paragraph+)>
+
+<!ELEMENT body (h1 | h2 | h3 | h4 | h5 | h6 | section | paragraph | table | 
comment | bookmark | switch | embed | list | sort | bascode | pycode | sqlcode 
| note | warning | tip)*>
 
 <!ELEMENT bookmark (bookmark_value)*>
 <!ATTLIST bookmark
@@ -64,7 +67,7 @@ Version Nov 2018
   localize CDATA #IMPLIED
 >
 
-<!ELEMENT case (h1 | h2 | h3 | h4 | h5 | h6 | note | warning |tip | paragraph 
| table | comment | bookmark | embed | link | list | switch | section | sort | 
bascode | pycode)*>
+<!ELEMENT case (h1 | h2 | h3 | h4 | h5 | h6 | note | warning |tip | paragraph 
| table | comment | bookmark | embed | link | list | switch | section | sort | 
bascode | pycode | sqlcode )*>
 <!ATTLIST case
   select CDATA #REQUIRED
 >
@@ -81,7 +84,7 @@ Version Nov 2018
   date CDATA #REQUIRED
 >
 
-<!ELEMENT default (h1 | h2 | h3 | h4 | h5 | h6 | note | warning |tip | 
paragraph | table | comment | bookmark | embed | link | list | switch | section 
| sort | bascode | pycode)*>
+<!ELEMENT default (h1 | h2 | h3 | h4 | h5 | h6 | note | warning |tip | 
paragraph | table | comment | bookmark | embed | link | list | switch | section 
| sort | bascode | pycode | sqlcode)*>
 
 <!ELEMENT defaultinline (#PCDATA | image | embedvar | br | emph | sub | sup | 
item | link | switchinline | variable | ahelp | object | keycode | menuitem | 
input | literal | widget)*>
 
@@ -207,7 +210,7 @@ Version Nov 2018
   localize CDATA #IMPLIED
 >
 
-<!ELEMENT section (section | h1 | h2 | h3 | h4 | h5 | h6 | paragraph | table | 
list | comment | bookmark | embed | switch | sort | bascode | pycode | note 
|warning | tip)*>
+<!ELEMENT section (section | h1 | h2 | h3 | h4 | h5 | h6 | paragraph | table | 
list | comment | bookmark | embed | switch | sort | bascode | pycode | sqlcode 
| note |warning | tip)*>
 <!ATTLIST section
   id CDATA #REQUIRED
 >

Reply via email to