From aa45ded698f25e8d3bc8eef621d727186fe18dd2 Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Fri, 23 Aug 2019 06:50:58 -0300 Subject: redmine#2555 replace Help online Google search This is the helpcontent2/ part of the patch. Add xapian-omega search to online Help. The patch replaces Google custom search with xapian-omega search. A new build key is introduced. --with-omindex=server : Localizes and adds the xapian result page template, adds the xapian form to each Help page. --with-omindex=noxap : do not localize the result template and do not add a form in the Help page. --with-omindex= will force Online Help build. Default is noxap NOTES: - xapian-omega databases are built in the server. - searches returns results only on localized Help pages, avoiding same resulis in many languages. TODO: - Tweak the xapian-omega result page CSS and markup. Change-Id: I3dc2b79c4111f61fd5fea01b1f8c95bfacab1e8f Reviewed-on: https://gerrit.libreoffice.org/79366 Tested-by: Jenkins Reviewed-by: Guilhem Moulin Tested-by: Guilhem Moulin --- CustomTarget_html.mk | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'CustomTarget_html.mk') diff --git a/CustomTarget_html.mk b/CustomTarget_html.mk index de972bb73e..e43c17a48a 100644 --- a/CustomTarget_html.mk +++ b/CustomTarget_html.mk @@ -20,6 +20,7 @@ $(eval $(call gb_CustomTarget_register_targets,helpcontent2/help3xsl,\ $(foreach lang,$(gb_HELP_LANGS),\ $(lang)/bookmarks.js \ $(lang)/contents.js \ + $(if $(HELP_OMINDEX_PAGE),$(lang)/xap_tpl) \ $(lang)/html.text \ $(lang)/langnames.js \ $(foreach module,$(html_TREE_MODULES),$(module)/$(lang)/contents.part) \ @@ -53,6 +54,24 @@ $(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/hid2file.js : \ ) > $@ \ ) +# Xapian localized templates +ifeq ($(HELP_OMINDEX_PAGE),TRUE) + +$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/%/xap_tpl : \ + $(SRCDIR)/helpcontent2/help3xsl/xap_templ_query.xsl \ + $(call gb_ExternalExecutable_get_dependencies,xsltproc) \ + $(SRCDIR)/helpcontent2/CustomTarget_html.mk + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),XAT,1) + $(call gb_Helper_abbreviate_dirs,\ + $(call gb_ExternalExecutable_get_command,xsltproc) \ + --stringparam lang $* \ + -o $@ \ + $(SRCDIR)/helpcontent2/help3xsl/xap_templ_query.xsl \ + $(SRCDIR)/helpcontent2/source/text/shared/help/browserhelp.xhp \ + ) + +endif + # set of installed languages - has to be language independent $(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/languages.js : \ $(SRCDIR)/helpcontent2/CustomTarget_html.mk @@ -62,6 +81,7 @@ $(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 @@ -152,6 +172,7 @@ $(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/%/html.text : \ --stringparam root $(if $(filter WNT,$(OS)),$$(cygpath -m `pwd`),`pwd`)/ \ --stringparam productname "$(PRODUCTNAME)" \ --stringparam productversion "$(PRODUCTVERSION)" \ + --stringparam xapian $(if $(filter TRUE, $(HELP_OMINDEX_PAGE)),'yes','no') \ -o $(dir $@)$${xhp%.xhp}.html \ $(SRCDIR)/helpcontent2/help3xsl/online_transform.xsl \ $(if $(filter WNT,$(OS)),$$(cygpath -m `pwd`),`pwd`)/$$xhp \ @@ -160,7 +181,7 @@ $(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/%/html.text : \ && rm "$$RESPONSEFILE" \ && touch $@ \ ) - + $(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/%/bookmarks.js : $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CAT,2) $(call gb_Helper_abbreviate_dirs,\ -- cgit