summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>2022-01-18 09:34:15 +0200
committerIlmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>2022-01-25 16:40:00 +0100
commit919def267b89cfe03f40218baa8c16cf65526448 (patch)
treed7be260ec34a9ca56256b395a1be7170effede93
parente1da23a649197d960c8492373326e11286b3239e (diff)
tdf#123318 tdf#129697 Don't hardcode product name in CSS and JS
Change-Id: I0ef315146fed188eb1cf33c416ff5f3e9899bbae Reviewed-on: https://gerrit.libreoffice.org/c/help/+/128524 Tested-by: Jenkins Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
-rw-r--r--CustomTarget_html.mk29
-rw-r--r--Package_html_dynamic.mk2
-rw-r--r--Package_html_static.mk2
-rw-r--r--help3xsl/default.css22
-rw-r--r--help3xsl/help2.js2
-rw-r--r--help3xsl/online_transform.xsl8
6 files changed, 41 insertions, 24 deletions
diff --git a/CustomTarget_html.mk b/CustomTarget_html.mk
index 56224a7d90..d94b85f2c3 100644
--- a/CustomTarget_html.mk
+++ b/CustomTarget_html.mk
@@ -14,9 +14,17 @@ html_TREE_MODULES := swriter scalc simpress sdraw sdatabase smath schart sbasic
html_TEXT_MODULES := $(html_TREE_MODULES)
html_BMARK_MODULES := swriter:WRITER scalc:CALC simpress:IMPRESS sdraw:DRAW sdatabase:BASE smath:MATH schart:CHART sbasic:BASIC shared:SHARED
+# In case someone has a product name containing quotes, use Unicode
+# code points for ' (27) and " (22) in JS, CSS and entities for HTML.
+gb_PRODUCTNAME_JS := $(subst ',\\\u{27},$(subst ",\\\u{22},$(PRODUCTNAME)))
+gb_PRODUCTNAME_CSS := $(subst ',\\\27,$(subst ",\\\22,$(PRODUCTNAME)))
+gb_PRODUCTNAME_HTML := $(subst ',&apos;,$(subst ",&quot;,$(PRODUCTNAME)))
+
$(eval $(call gb_CustomTarget_register_targets,helpcontent2/help3xsl,\
hid2file.js \
languages.js \
+ default.css \
+ help2.js \
$(foreach lang,$(gb_HELP_LANGS),\
$(lang)/bookmarks.js \
$(lang)/contents.js \
@@ -75,7 +83,7 @@ $(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/%/xap_tpl : \
$(call gb_Helper_abbreviate_dirs,\
$(call gb_ExternalExecutable_get_command,xsltproc) \
--stringparam lang $* \
- --stringparam productname "$(PRODUCTNAME)" \
+ --stringparam productname "$(gb_PRODUCTNAME_HTML)" \
--stringparam productversion "$(PRODUCTVERSION)" \
-o $@ \
$(SRCDIR)/helpcontent2/help3xsl/xap_templ_query.xsl \
@@ -103,7 +111,7 @@ $(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/%/noscript.html : \
$(call gb_Helper_abbreviate_dirs,\
$(call gb_ExternalExecutable_get_command,xsltproc) \
--stringparam lang $* \
- --stringparam productname "$(PRODUCTNAME)" \
+ --stringparam productname "$(gb_PRODUCTNAME_HTML)" \
--stringparam productversion "$(PRODUCTVERSION)" \
-o $@ \
$(SRCDIR)/helpcontent2/help3xsl/noscript.xsl \
@@ -120,7 +128,6 @@ $(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/languages.js : \
printf ']);\n' \
) > $@
-
define html_gen_langnames_js_dep
$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/$(1)/langnames.js : \
$(if $(filter en-US,$(1)),$(SRCDIR),$(call gb_HelpTranslatePartTarget_get_workdir,$(1)))/helpcontent2/source/text/shared/help/browserhelp.xhp
@@ -177,7 +184,7 @@ $(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/%/contents.part : \
--stringparam lang $(LANGUAGE) \
--stringparam local $(if $(HELP_ONLINE),'no','yes') \
--stringparam module $(MODULE) \
- --stringparam productname "$(PRODUCTNAME)" \
+ --stringparam productname "$(gb_PRODUCTNAME_HTML)" \
--stringparam productversion "$(PRODUCTVERSION)" \
-o $@ \
$(SRCDIR)/helpcontent2/help3xsl/get_tree.xsl \
@@ -224,7 +231,7 @@ $(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/%/html.text : \
--stringparam Language $* \
--stringparam local $(if $(HELP_ONLINE),'no','yes') \
--stringparam root $(if $(filter WNT,$(OS)),$$(cygpath -m `pwd`),`pwd`)/ \
- --stringparam productname "$(PRODUCTNAME)" \
+ --stringparam productname "$(gb_PRODUCTNAME_HTML)" \
--stringparam productversion "$(PRODUCTVERSION)" \
--stringparam xapian $(if $(filter TRUE, $(HELP_OMINDEX_PAGE)),'yes','no') \
-o $(dir $@)$${xhp%.xhp}.html \
@@ -293,7 +300,7 @@ $(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/%/bookmarks.part : \
--stringparam app $(APP) \
--stringparam Language $(HELP_LANG) \
--stringparam local $(if $(HELP_ONLINE),'no','yes') \
- --stringparam productname "$(PRODUCTNAME)" \
+ --stringparam productname "$(gb_PRODUCTNAME_HTML)" \
--stringparam productversion "$(PRODUCTVERSION)" \
$(SRCDIR)/helpcontent2/help3xsl/get_bookmark.xsl \
$$xhp \
@@ -328,4 +335,14 @@ endef
$(eval $(foreach lang,$(gb_HELP_LANGS),$(foreach module,$(html_TEXT_MODULES),$(call html__filelist,$(lang),$(module)))))
+$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/default.css : \
+ $(SRCDIR)/helpcontent2/help3xsl/default.css \
+ $(BUILDDIR)/config_host.mk
+ sed -e "s/%PRODUCTNAME/$(gb_PRODUCTNAME_CSS)/g" $< > $@
+
+$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/help2.js : \
+ $(SRCDIR)/helpcontent2/help3xsl/help2.js \
+ $(BUILDDIR)/config_host.mk
+ sed -e "s/%PRODUCTNAME/$(gb_PRODUCTNAME_JS)/g" $< > $@
+
# vim: set noet sw=4 ts=4:
diff --git a/Package_html_dynamic.mk b/Package_html_dynamic.mk
index 8c0c2fe5b4..6e23cf892e 100644
--- a/Package_html_dynamic.mk
+++ b/Package_html_dynamic.mk
@@ -14,6 +14,8 @@ $(eval $(call gb_Package_use_customtarget,helpcontent2_html_dynamic,helpcontent2
$(eval $(call gb_Package_add_files,helpcontent2_html_dynamic,$(LIBO_SHARE_HELP_FOLDER)$(if $(HELP_ONLINE),/$(PRODUCTVERSION)), \
hid2file.js \
languages.js \
+ default.css \
+ help2.js \
))
# vim: set noet sw=4 ts=4:
diff --git a/Package_html_static.mk b/Package_html_static.mk
index f4cfd2c74a..4ef37566d1 100644
--- a/Package_html_static.mk
+++ b/Package_html_static.mk
@@ -18,10 +18,8 @@ $(eval $(call gb_Package_add_file,helpcontent2_html_static,$(LIBO_SHARE_HELP_FOL
$(eval $(call gb_Package_add_files,helpcontent2_html_static,$(LIBO_SHARE_HELP_FOLDER)$(if $(HELP_ONLINE),/$(PRODUCTVERSION)),\
a11y-toggle.js \
- default.css \
flexsearch.debug.js \
help.js \
- help2.js \
normalize.css \
paginathing.js \
polyfills.js \
diff --git a/help3xsl/default.css b/help3xsl/default.css
index 2f770c6114..a90644025f 100644
--- a/help3xsl/default.css
+++ b/help3xsl/default.css
@@ -468,63 +468,63 @@ aside input[type=checkbox]:checked ~ .contents-treeview {
color: #148603;
}
#WRITER::before {
- content: "WRITER";
+ content: "Writer";
display: block;
font-size: 22px;
font-weight: bold;
color: #0369a3;
}
#CALC::before {
- content: "CALC";
+ content: "Calc";
display: block;
font-size: 22px;
font-weight: bold;
color: #43c330;
}
#IMPRESS::before {
- content: "IMPRESS";
+ content: "Impress";
display: block;
font-size: 22px;
font-weight: bold;
color: #a33e03;
}
#DRAW::before {
- content: "DRAW";
+ content: "Draw";
display: block;
font-size: 22px;
font-weight: bold;
color: #c99c00;
}
#BASE::before {
- content: "BASE";
+ content: "Base";
display: block;
font-size: 22px;
font-weight: bold;
color: #8e03a3;
}
#MATH::before {
- content: "MATH";
+ content: "Math";
display: block;
font-size: 22px;
font-weight: bold;
color: darkslategray;
}
#CHART::before {
- content: "CHART";
+ content: "Chart";
display: block;
font-size: 22px;
font-weight: bold;
color: darkcyan;
}
#BASIC::before {
- content: "BASIC";
+ content: "Basic";
display: block;
font-size: 22px;
font-weight: bold;
color: black;
}
#SHARED::before {
- content: "LIBREOFFICE";
+ content: "%PRODUCTNAME";
display: block;
font-size: 22px;
font-weight: bold;
@@ -630,7 +630,7 @@ li.disabled a {
display: none;
}
-.libreoffice-icon,
+.office-icon,
.calc-icon,
.chart-icon,
.writer-icon,
@@ -644,7 +644,7 @@ li.disabled a {
position: relative;
margin-right: 5px;
}
-.libreoffice-icon {
+.office-icon {
background-image: url(media/navigation/libo-symbol-black.svg);
}
.calc-icon {
diff --git a/help3xsl/help2.js b/help3xsl/help2.js
index 3a45f7f601..a0cd884470 100644
--- a/help3xsl/help2.js
+++ b/help3xsl/help2.js
@@ -187,7 +187,7 @@ function setupModules(lang) {
var modulesNav = document.getElementById('modules-nav');
if (!modulesNav.classList.contains('loaded')) {
var html =
- '<a href="' + lang + '/text/shared/05/new_help.html?DbPAR=SHARED"><div class="libreoffice-icon"></div>LibreOffice</a>' +
+ '<a href="' + lang + '/text/shared/05/new_help.html?DbPAR=SHARED"><div class="office-icon"></div>%PRODUCTNAME</a>' +
'<a href="' + lang + '/text/swriter/main0000.html?DbPAR=WRITER"><div class="writer-icon"></div>Writer</a>' +
'<a href="' + lang + '/text/scalc/main0000.html?DbPAR=CALC"><div class="calc-icon"></div>Calc</a>' +
'<a href="' + lang + '/text/simpress/main0000.html?DbPAR=IMPRESS"><div class="impress-icon"></div>Impress</a>' +
diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl
index 7ccb97b766..c9b9a80928 100644
--- a/help3xsl/online_transform.xsl
+++ b/help3xsl/online_transform.xsl
@@ -139,7 +139,7 @@
<xsl:if test="$online">
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline' 'unsafe-eval' piwik.documentfoundation.org"/>
</xsl:if>
- <title><xsl:value-of select="$titleL10N"/></title>
+ <title><xsl:value-of disable-output-escaping="yes" select="$titleL10N"/></title>
<link rel="shortcut icon" href="media/navigation/favicon.ico"/>
<link type="text/css" href="normalize.css" rel="Stylesheet"/>
<link type="text/css" href="default.css" rel="Stylesheet"/>
@@ -164,7 +164,7 @@
<div></div>
</a>
<a class="logo" href="{$lang}/text/shared/05/new_help.html">
- <p><xsl:value-of select="$ui_logo"/></p>
+ <p><xsl:value-of disable-output-escaping="yes" select="$ui_logo"/></p>
</a>
<div class="dropdowns">
<div class="modules">
@@ -256,7 +256,7 @@
<div id="DEBUG" class="debug">
<h3 class="bug">Help content debug info:</h3>
<p>This page is: <a href="https://opengrok.libreoffice.org/xref/help/source{$filename}" target="_blank"><xsl:value-of select="$filename"/></a></p>
- <p>Title is: <xsl:value-of select="$title"/></p>
+ <p>Title is: <xsl:value-of disable-output-escaping="yes" select="$title"/></p>
<p id="bm_module"></p>
<p id="bm_system"></p>
<p id="bm_HID"></p>
@@ -915,7 +915,7 @@
</xsl:when>
<xsl:otherwise>
- <xsl:value-of select="$string"/>
+ <xsl:value-of disable-output-escaping="yes" select="$string"/>
</xsl:otherwise>
</xsl:choose>