From 2818359075444e70eeabf0c55ea15ff745a6dcb6 Mon Sep 17 00:00:00 2001 From: Martin Kletzander Date: Wed, 1 Aug 2012 15:29:27 +0200 Subject: [PATCH] docs: autogenerate search.php This patch makes search.php autogenerated from search.php.in, thus removing hardcoded menus, footer etc. and the search.php is added to .gitignore. There is new rule added for *.php files (to make it bit less hardcoded) that takes *.php.code.in and injects it inside the generated *.php (xslt was not happy about php code in the source xml). --- .gitignore | 1 + docs/Makefile.am | 23 ++++++- docs/{search.php => search.php.code.in} | 90 ++----------------------- docs/search.php.in | 17 +++++ 4 files changed, 43 insertions(+), 88 deletions(-) rename docs/{search.php => search.php.code.in} (66%) create mode 100644 docs/search.php.in diff --git a/.gitignore b/.gitignore index cd8a85ccde..17dcae4d72 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,7 @@ /docs/libvirt-api.xml /docs/libvirt-qemu-*.xml /docs/libvirt-refs.xml +/docs/search.php /docs/todo.html.in /examples/domain-events/events-c/event-test /examples/dominfo/info1 diff --git a/docs/Makefile.am b/docs/Makefile.am index 88407b1b9a..fad8979bac 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -75,6 +75,10 @@ dot_html_in = $(notdir $(wildcard $(srcdir)/*.html.in)) todo.html.in hvsupport.h $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/internals/*.html.in)) dot_html = $(dot_html_in:%.html.in=%.html) +dot_php_in = $(notdir $(wildcard $(srcdir)/*.php.in)) +dot_php_code_in = $(dot_php_in:%.php.in=%.php.code.in) +dot_php = $(dot_php_in:%.php.in=%.php) + patches = $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/api_extension/*.patch)) xml = \ @@ -107,21 +111,22 @@ EXTRA_DIST= \ $(dot_html) $(dot_html_in) $(gif) $(apihtml) $(apipng) \ $(devhelphtml) $(devhelppng) $(devhelpcss) $(devhelpxsl) \ $(xml) $(qemu_xml) $(fig) $(png) $(css) \ - $(patches) \ + $(patches) $(dot_php_in) $(dot_php_code_in) $(dot_php)\ sitemap.html.in \ todo.pl hvsupport.pl todo.cfg-example MAINTAINERCLEANFILES = \ $(addprefix $(srcdir)/,$(dot_html)) \ $(addprefix $(srcdir)/,$(apihtml)) \ - $(addprefix $(srcdir)/,$(devhelphtml)) + $(addprefix $(srcdir)/,$(devhelphtml)) \ + $(addprefix $(srcdir)/,$(dot_php)) all-am: web api: $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml qemu_api: $(srcdir)/libvirt-qemu-api.xml $(srcdir)/libvirt-qemu-refs.xml -web: $(dot_html) html/index.html devhelp/index.html +web: $(dot_html) html/index.html devhelp/index.html $(dot_php) todo.html.in: todo.pl if [ -f todo.cfg ]; then \ @@ -173,6 +178,18 @@ internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in || { rm $(srcdir)/$@ && exit 1; }; \ else echo "missing XHTML1 DTD" ; fi ; fi +%.php.tmp: %.php.in site.xsl page.xsl sitemap.html.in + @if [ -x $(XSLTPROC) ] ; then \ + echo "Generating $@"; \ + $(XSLTPROC) --stringparam pagename $(@:.tmp=) --nonet --html \ + $(top_srcdir)/docs/site.xsl $< > $@ \ + || { rm $@ && exit 1; }; fi + +%.php: %.php.tmp %.php.code.in + @echo "Scripting $@"; \ + sed -e '/<\/a>/r '"$(srcdir)/$@.code.in" \ + -e /php_placeholder/d < $@.tmp > $(srcdir)/$@ \ + || { rm $(srcdir)/$@ && exit 1; } html/index.html: libvirt-api.xml newapi.xsl page.xsl sitemap.html.in $(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \ diff --git a/docs/search.php b/docs/search.php.code.in similarity index 66% rename from docs/search.php rename to docs/search.php.code.in index 768e06fca3..df25cd6578 100644 --- a/docs/search.php +++ b/docs/search.php.code.in @@ -1,49 +1,28 @@ - - - - - - - - Search the documentation on Libvir.org - - - - -
-
Search the documentation on Libvir.org"; - } + $scope = $_GET['scope']; if ($scope == NULL) $scope = "any"; $scope = ltrim ($scope); if ($scope == "") $scope = "any"; - ?> -

The search service indexes the libvirt APIs and documentation as well as the libvir-list@redhat.com mailing-list archives. To use it simply provide a set of keywords:

+
+ - libvirt Logo -
-
-
- - - diff --git a/docs/search.php.in b/docs/search.php.in new file mode 100644 index 0000000000..ee8f4a3eda --- /dev/null +++ b/docs/search.php.in @@ -0,0 +1,17 @@ + + + +

Search the documentation on Libvirt.org

+ +

+ The search service indexes the libvirt APIs and documentation as + well as the libvir-list@redhat.com mailing-list archives. To use + it simply provide a set of keywords: +

+ + + + libvirt Logo + + + -- GitLab