[Libreoffice-commits] help.git: 3 commits - help3xsl/default.css help3xsl/get_bookmark.sh help3xsl/get_bookmark.xsl help3xsl/help.js help3xsl/index.html help3xsl/jquery-3.1.1.min.js help3xsl/online_transform.xsl source/default.css source/get_bookmark.sh source/get_bookmark.xsl source/help.js source/index.html source/jquery-3.1.1.min.js source/online_transform.xsl
Jan Holesovsky
kendy at collabora.com
Mon Nov 7 12:20:41 UTC 2016
help3xsl/default.css | 175 -------
help3xsl/get_bookmark.sh | 64 --
help3xsl/get_bookmark.xsl | 118 ----
help3xsl/help.js | 106 ----
help3xsl/index.html | 48 --
help3xsl/jquery-3.1.1.min.js | 4
help3xsl/online_transform.xsl | 992 ------------------------------------------
source/default.css | 175 +++++++
source/get_bookmark.sh | 64 ++
source/get_bookmark.xsl | 128 +++++
source/help.js | 124 +++++
source/index.html | 48 ++
source/jquery-3.1.1.min.js | 4
source/online_transform.xsl | 990 +++++++++++++++++++++++++++++++++++++++++
14 files changed, 1533 insertions(+), 1507 deletions(-)
New commits:
commit 433c4c0477c6dfcde68ed5b1eb98f1811095f050
Author: Jan Holesovsky <kendy at collabora.com>
Date: Mon Nov 7 13:17:11 2016 +0100
Change '/text' to just 'text' on many places.
With this, the pages start appearing even locally with just pointing the
browser to file:///.../help_git_repo/source/index.html
diff --git a/source/get_bookmark.sh b/source/get_bookmark.sh
index a64ee24..af2edd8 100755
--- a/source/get_bookmark.sh
+++ b/source/get_bookmark.sh
@@ -11,54 +11,54 @@ stub2='</ul></body></html>'
ffile=bookmark_calc.html
rm -f $ffile
echo $stub1 > $ffile
-find ../source/text/scalc -type f -name "*.xhp" -exec xsltproc get_bookmark.xsl {} + >> $ffile
+find text/scalc -type f -name "*.xhp" -exec xsltproc get_bookmark.xsl {} + >> $ffile
echo $stub2 >> $ffile
ffile=bookmark_writer.html
rm -f $ffile
echo $stub1 > $ffile
-find ../source/text/swriter -type f -name "*.xhp" -exec xsltproc get_bookmark.xsl {} + >> $ffile
+find text/swriter -type f -name "*.xhp" -exec xsltproc get_bookmark.xsl {} + >> $ffile
echo $stub2 >> $ffile
ffile=bookmark_draw.html
rm -f $ffile
echo $stub1 > $ffile
-find ../source/text/sdraw -type f -name "*.xhp" -exec xsltproc get_bookmark.xsl {} + >> $ffile
+find text/sdraw -type f -name "*.xhp" -exec xsltproc get_bookmark.xsl {} + >> $ffile
echo $stub2 >> $ffile
ffile=bookmark_impress.html
rm -f $ffile
echo $stub1 > $ffile
-find ../source/text/simpress -type f -name "*.xhp" -exec xsltproc get_bookmark.xsl {} + >> $ffile
+find text/simpress -type f -name "*.xhp" -exec xsltproc get_bookmark.xsl {} + >> $ffile
echo $stub2 >> $ffile
ffile=bookmark_shared.html
rm -f $ffile
echo $stub1 > $ffile
-find ../source/text/shared -type f -name "*.xhp" -exec xsltproc get_bookmark.xsl {} + >> $ffile
+find text/shared -type f -name "*.xhp" -exec xsltproc get_bookmark.xsl {} + >> $ffile
echo $stub2 >> $ffile
ffile=bookmark_chart.html
rm -f $ffile
echo $stub1 > $ffile
-find ../source/text/schart -type f -name "*.xhp" -exec xsltproc get_bookmark.xsl {} + >> $ffile
+find text/schart -type f -name "*.xhp" -exec xsltproc get_bookmark.xsl {} + >> $ffile
echo $stub2 >> $ffile
ffile=bookmark_math.html
rm -f $ffile
echo $stub1 > $ffile
-find ../source/text/smath -type f -name "*.xhp" -exec xsltproc get_bookmark.xsl {} + >> $ffile
+find text/smath -type f -name "*.xhp" -exec xsltproc get_bookmark.xsl {} + >> $ffile
echo $stub2 >> $ffile
ffile=bookmark_basic.html
rm -f $ffile
echo $stub1 > $ffile
-find ../source/text/sbasic -type f -name "*.xhp" -exec xsltproc get_bookmark.xsl {} + >> $ffile
+find text/sbasic -type f -name "*.xhp" -exec xsltproc get_bookmark.xsl {} + >> $ffile
echo $stub2 >> $ffile
ffile=bookmark_base.html
rm -f $ffile
echo $stub1 > $ffile
-find ../source/text/shared/explorer/database -type f -name "*.xhp" -exec xsltproc get_bookmark.xsl {} + >> $ffile
+find text/shared/explorer/database -type f -name "*.xhp" -exec xsltproc get_bookmark.xsl {} + >> $ffile
echo $stub2 >> $ffile
diff --git a/source/get_bookmark.xsl b/source/get_bookmark.xsl
index b3e65eb..3b1be23 100644
--- a/source/get_bookmark.xsl
+++ b/source/get_bookmark.xsl
@@ -23,7 +23,17 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
# Variables and Parameters #
############################
//-->
-<xsl:variable name="filename" select="/helpdocument/meta/topic/filename"/>
+<xsl:variable name="fname" select="/helpdocument/meta/topic/filename"/>
+<xsl:variable name="filename">
+ <xsl:choose>
+ <xsl:when test="starts-with($fname, '/')">
+ <xsl:value-of select="substring($fname, 2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$fname"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
<!-- Product brand variables used in the help files -->
<xsl:variable name="brand1" select="'$[officename]'"/>
<xsl:variable name="brand2" select="'$[officeversion]'"/>
diff --git a/source/index.html b/source/index.html
index 11e3020..90b5726 100644
--- a/source/index.html
+++ b/source/index.html
@@ -19,15 +19,15 @@
<div id="TopLeft">
<table>
<tr>
- <td class="topmenu"><p onclick="displayResult('../source/text/scalc/main0000.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=calc','calc')">Calc</p></td>
- <td class="topmenu"><p onclick="displayResult('../source/text/swriter/main0000.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=writer','writer')">Writer</p></td>
- <td class="topmenu"><p onclick="displayResult('../source/text/simpress/main0000.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=simpress','impress')">Impress</p></td>
- <td class="topmenu"><p onclick="displayResult('../source/text/sdraw/main0000.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=sdraw','draw')">Draw</p></td>
- <td class="topmenu"><p onclick="displayResult('../source/text/schart/main0000.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=schart','chart')">Chart</p></td>
- <td class="topmenu"><p onclick="displayResult('../source/text/sbasic/shared/main0001.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=sbasic','basic')">Basic</p></td>
- <td class="topmenu"><p onclick="displayResult('../source/text/smath/main0000.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=smath','math')">Math</p></td>
- <td class="topmenu"><p onclick="displayResult('../source/text/shared/explorer/database/main.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=shared','shared')">Base</p></td>
- <td class="topmenu"><p onclick="displayResult('../source/text/shared/guide/main.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=shared','shared')">Guide</p></td>
+ <td class="topmenu"><p onclick="displayResult('text/scalc/main0000.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=calc','calc')">Calc</p></td>
+ <td class="topmenu"><p onclick="displayResult('text/swriter/main0000.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=writer','writer')">Writer</p></td>
+ <td class="topmenu"><p onclick="displayResult('text/simpress/main0000.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=simpress','impress')">Impress</p></td>
+ <td class="topmenu"><p onclick="displayResult('text/sdraw/main0000.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=sdraw','draw')">Draw</p></td>
+ <td class="topmenu"><p onclick="displayResult('text/schart/main0000.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=schart','chart')">Chart</p></td>
+ <td class="topmenu"><p onclick="displayResult('text/sbasic/shared/main0001.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=sbasic','basic')">Basic</p></td>
+ <td class="topmenu"><p onclick="displayResult('text/smath/main0000.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=smath','math')">Math</p></td>
+ <td class="topmenu"><p onclick="displayResult('text/shared/explorer/database/main.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=shared','shared')">Base</p></td>
+ <td class="topmenu"><p onclick="displayResult('text/shared/guide/main.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=shared','shared')">Guide</p></td>
</tr>
</table>
</div>
@@ -39,9 +39,9 @@ if (window.location.href.indexOf('?') && getParameterByName('page')) {
var language = getParameterByName("Language");
var system = getParameterByName("System");
var usedb = getParameterByName("UseDB");
- displayResult('../source/text/' + getParameterByName('page') + '&DbPAR='+module+'&Language='+language+'&System='+system+'&UseDB='+usedb);
+ displayResult('text/' + getParameterByName('page') + '&DbPAR='+module+'&Language='+language+'&System='+system+'&UseDB='+usedb);
} else {
- displayResult('../source/text/shared/main0108.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=shared','shared');
+ displayResult('text/shared/main0108.xhp?Language=en-US&System=WIN&UseDB=no&DbPAR=shared','shared');
}
</script>
</body>
diff --git a/source/online_transform.xsl b/source/online_transform.xsl
index 2d18765..b5f1157 100644
--- a/source/online_transform.xsl
+++ b/source/online_transform.xsl
@@ -110,7 +110,7 @@
<!-- parts of help and image urls -->
<!--<xsl:variable name="help_url_prefix" select="'vnd.sun.star.help://'"/>-->
-<xsl:variable name="help_url_prefix" select="'/'"/>
+<xsl:variable name="help_url_prefix" select="''"/>
<xsl:variable name="img_url_prefix" select="concat('/media',$imgtheme,'/')"/>
<!-- <xsl:variable name="img_url_prefix" select="concat('vnd.libreoffice.image://',$imgtheme,'/')"/> -->
<!--<xsl:variable name="urlpost" select=""/>-->
@@ -159,15 +159,15 @@
<div id="TopLeft" style="display:none; position: fixed;top: 5px;left: 5px;">
<table>
<tr>
- <td class="topmenu"><a href="/text/scalc/main0000.xhp">Calc</a></td>
- <td class="topmenu"><a href="/text/swriter/main0000.xhp">Writer</a></td>
- <td class="topmenu"><a href="/text/simpress/main0000.xhp">Impress</a></td>
- <td class="topmenu"><a href="/text/sdraw/main0000.xhp">Draw</a></td>
- <td class="topmenu"><a href="/text/schart/main0000.xhp">Chart</a></td>
- <td class="topmenu"><a href="/text/sbasic/shared/main0601.xhp">Basic</a></td>
- <td class="topmenu"><a href="/text/smath/main0000.xhp">Math</a></td>
- <td class="topmenu"><a href="/text/shared/explorer/database/main.xhp">Base</a></td>
- <td class="topmenu"><a href="/text/shared/guide/main.xhp">Guide</a></td>
+ <td class="topmenu"><a href="text/scalc/main0000.xhp">Calc</a></td>
+ <td class="topmenu"><a href="text/swriter/main0000.xhp">Writer</a></td>
+ <td class="topmenu"><a href="text/simpress/main0000.xhp">Impress</a></td>
+ <td class="topmenu"><a href="text/sdraw/main0000.xhp">Draw</a></td>
+ <td class="topmenu"><a href="text/schart/main0000.xhp">Chart</a></td>
+ <td class="topmenu"><a href="text/sbasic/shared/main0601.xhp">Basic</a></td>
+ <td class="topmenu"><a href="text/smath/main0000.xhp">Math</a></td>
+ <td class="topmenu"><a href="text/shared/explorer/database/main.xhp">Base</a></td>
+ <td class="topmenu"><a href="text/shared/guide/main.xhp">Guide</a></td>
</tr>
</table>
<div id="xmfile"><p class="infopage">This page is: <xsl:value-of select="$filename"/></p></div>
@@ -433,7 +433,6 @@
<xsl:when test="@id='relatedtopics'">
<div class="relatedtopics">
- <!--<xsl:variable name="href"><xsl:value-of select="concat($urlpre,'shared/text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable>-->
<xsl:variable name="href"><xsl:value-of select="concat($urlpre,'text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable>
<xsl:variable name="anchor"><xsl:value-of select="'related'"/></xsl:variable>
<xsl:variable name="doc" select="document($href)"/>
@@ -613,7 +612,6 @@
<xsl:template name="insert_howtoget">
<xsl:param name="linkhref" />
<xsl:variable name="archive" select="'shared'"/>
- <!--<xsl:variable name="tmp_href"><xsl:value-of select="concat($urlpre,'shared/text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable>-->
<xsl:variable name="tmp_href"><xsl:value-of select="concat($urlpre,'text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable>
<xsl:variable name="tmp_doc" select="document($tmp_href)"/>
<table class="howtoget" width="100%" border="1" cellpadding="3" cellspacing="0">
commit 677759f9f3b94cc73b78f4fd21d10e36a96fc59b
Author: Jan Holesovsky <kendy at collabora.com>
Date: Mon Nov 7 12:45:23 2016 +0100
Move the JavaScript pieces directly to 'source'.
This avoids problems with tryint to access stuff via '..'.
diff --git a/help3xsl/default.css b/source/default.css
similarity index 100%
rename from help3xsl/default.css
rename to source/default.css
diff --git a/help3xsl/get_bookmark.sh b/source/get_bookmark.sh
similarity index 100%
rename from help3xsl/get_bookmark.sh
rename to source/get_bookmark.sh
diff --git a/help3xsl/get_bookmark.xsl b/source/get_bookmark.xsl
similarity index 100%
rename from help3xsl/get_bookmark.xsl
rename to source/get_bookmark.xsl
diff --git a/help3xsl/help.js b/source/help.js
similarity index 100%
rename from help3xsl/help.js
rename to source/help.js
diff --git a/help3xsl/index.html b/source/index.html
similarity index 100%
rename from help3xsl/index.html
rename to source/index.html
diff --git a/help3xsl/jquery-3.1.1.min.js b/source/jquery-3.1.1.min.js
similarity index 100%
rename from help3xsl/jquery-3.1.1.min.js
rename to source/jquery-3.1.1.min.js
diff --git a/help3xsl/online_transform.xsl b/source/online_transform.xsl
similarity index 100%
rename from help3xsl/online_transform.xsl
rename to source/online_transform.xsl
commit d8383b5e3a447c32257eb0fd206fcb2f23e8cc34
Author: Jan Holesovsky <kendy at collabora.com>
Date: Mon Nov 7 12:32:51 2016 +0100
Reformat for readability + add modelines.
diff --git a/help3xsl/help.js b/help3xsl/help.js
index bb7c69b..03b7e6f 100644
--- a/help3xsl/help.js
+++ b/help3xsl/help.js
@@ -1,106 +1,124 @@
-//* This file is part of the LibreOffice project.
-//*
-//* This Source Code Form is subject to the terms of the Mozilla Public
-//* License, v. 2.0. If a copy of the MPL was not distributed with this
-//* file, You can obtain one at http://mozilla.org/MPL/2.0/.
-//*
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
function loadXMLDoc(filename, response)
{
-if (window.ActiveXObject)
- {
- xhttp = new ActiveXObject("Msxml2.XMLHTTP");
- }
-else
- {
- xhttp = new XMLHttpRequest();
- }
-xhttp.open("GET", filename, false);
-try {xhttp.responseType = "msxml-document"} catch(err) {} // Helping IE11
-xhttp.send("");
-if (response == 1){return xhttp.responseXML;}
-return xhttp.responseText;
+ if (window.ActiveXObject)
+ {
+ xhttp = new ActiveXObject("Msxml2.XMLHTTP");
+ }
+ else
+ {
+ xhttp = new XMLHttpRequest();
+ }
+
+ xhttp.open("GET", filename, false);
+ try {
+ xhttp.responseType = "msxml-document"
+ } catch(err) {} // Helping IE11
+
+ xhttp.send("");
+ if (response == 1) {
+ return xhttp.responseXML;
+ }
+
+ return xhttp.responseText;
}
function getParameterByName(name, url) {
if (!url) {
- url = window.location.href;
+ url = window.location.href;
}
+
name = name.replace(/[\[\]]/g, "\\$&");
- var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
- results = regex.exec(url);
- if (!results) return null;
- if (!results[2]) return '';
+ var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)");
+ var results = regex.exec(url);
+
+ if (!results) {
+ return null;
+ }
+
+ if (!results[2]) {
+ return '';
+ }
+
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
function displayResult(file, moduleName, language, system)
{
-var xml = loadXMLDoc(file, 1);
-var xsl = loadXMLDoc('online_transform.xsl', 1);
-var xsltProcessor;
-var resultDocument;
-var bookmarkHTML;
-var urlVars = getUrlVars(file);
- var module = urlVars["DbPAR"];
- moduleName = moduleName || module;
- var language = urlVars["Language"];
- var system = urlVars["System"];
- var usedb = urlVars["UseDB"];
- document.getElementById("DisplayArea").innerHTML= null;
- document.getElementById("BottomLeft").innerHTML= null;
-// code for IE
-if (window.ActiveXObject || xhttp.responseType == "msxml-document")
- {
- ex = xml.transformNode(xsl);
- document.getElementById("DisplayArea").innerHTML = ex;
- }
-// code for Chrome, Firefox, Opera, etc.
-else if (document.implementation && document.implementation.createDocument)
- {
- xsltProcessor = new XSLTProcessor();
-
- if (module){xsltProcessor.setParameter(null, "appl", module);}
- if (language){xsltProcessor.setParameter(null, "Language", language);}
- if (system){xsltProcessor.setParameter(null, "System", system);}
-
- $(document).on('click', '#BottomLeft a, #DisplayArea a', function(e) {
- e.preventDefault();
- $('#search-bar').val('');
- var xml = loadXMLDoc($(this).attr('href'), 1);
- var resultDocument = xsltProcessor.transformToFragment(xml, document);
- $("#DisplayArea").html($(resultDocument).find('#DisplayArea').html());
- return false;
- });
-
- xsltProcessor.importStylesheet(xsl);
- resultDocument = xsltProcessor.transformToFragment(xml, document);
- $("#DisplayArea").html($(resultDocument).find('#DisplayArea').html());
- // Handle bookmar panel
- $("#BottomLeft").load('bookmark_'+moduleName+'.html');
- }
+ var xml = loadXMLDoc(file, 1);
+ var xsl = loadXMLDoc('online_transform.xsl', 1);
+ var xsltProcessor;
+ var resultDocument;
+ var bookmarkHTML;
+ var urlVars = getUrlVars(file);
+ var module = urlVars["DbPAR"];
+ moduleName = moduleName || module;
+ var language = urlVars["Language"];
+ var system = urlVars["System"];
+ var usedb = urlVars["UseDB"];
+ document.getElementById("DisplayArea").innerHTML= null;
+ document.getElementById("BottomLeft").innerHTML= null;
+
+ if (window.ActiveXObject || xhttp.responseType == "msxml-document") {
+ // code for IE
+ ex = xml.transformNode(xsl);
+ document.getElementById("DisplayArea").innerHTML = ex;
+ }
+ else if (document.implementation && document.implementation.createDocument) {
+ // code for Chrome, Firefox, Opera, etc.
+ xsltProcessor = new XSLTProcessor();
+
+ if (module){xsltProcessor.setParameter(null, "appl", module);}
+ if (language){xsltProcessor.setParameter(null, "Language", language);}
+ if (system){xsltProcessor.setParameter(null, "System", system);}
+
+ $(document).on('click', '#BottomLeft a, #DisplayArea a', function(e) {
+ e.preventDefault();
+ $('#search-bar').val('');
+ var xml = loadXMLDoc($(this).attr('href'), 1);
+ var resultDocument = xsltProcessor.transformToFragment(xml, document);
+ $("#DisplayArea").html($(resultDocument).find('#DisplayArea').html());
+ return false;
+ });
+
+ xsltProcessor.importStylesheet(xsl);
+ resultDocument = xsltProcessor.transformToFragment(xml, document);
+ $("#DisplayArea").html($(resultDocument).find('#DisplayArea').html());
+ // Handle bookmar panel
+ $("#BottomLeft").load('bookmark_'+moduleName+'.html');
+ }
}
var debouncer = null;
$(document).ready(function() {
- $('#search-bar').keyup(function() {
- if(debouncer) {
- clearTimeout(debouncer);
- }
- debouncer = setTimeout(function(){
- $("#BottomLeft ul li" ).show();
- if($('#search-bar').val()) {
- $("#BottomLeft ul a:not(:contains('" + $('#search-bar').val() + "'))" ).parent().hide();
- }
- }, 500);
- });
-});
+ $('#search-bar').keyup(function() {
+ if(debouncer) {
+ clearTimeout(debouncer);
+ }
+ debouncer = setTimeout(function(){
+ $("#BottomLeft ul li" ).show();
+ if($('#search-bar').val()) {
+ $("#BottomLeft ul a:not(:contains('" + $('#search-bar').val() + "'))" ).parent().hide();
+ }
+ }, 500);
+ });
+ });
//http://papermashup.com/read-url-get-variables-withjavascript/
function getUrlVars(file) {
-var vars = {};
-var parts = file.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {vars[key] = value;});
-//var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {vars[key] = value;});
-return vars;
+ var vars = {};
+ var parts = file.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {vars[key] = value;});
+ //var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {vars[key] = value;});
+ return vars;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
More information about the Libreoffice-commits
mailing list