summaryrefslogtreecommitdiff
path: root/CustomTarget_html.mk
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 /CustomTarget_html.mk
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>
Diffstat (limited to 'CustomTarget_html.mk')
-rw-r--r--CustomTarget_html.mk29
1 files changed, 23 insertions, 6 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: