From 505523a140d2a80fbf2d863a49a395e41ddc612d Mon Sep 17 00:00:00 2001 From: Andy Alt Date: Thu, 11 Jan 2018 11:18:53 -0600 Subject: [PATCH] [#24]installdirs:update search result html, add css (#82) * [#24]installdirs:update search result html, add css This will copy the same style.css that the web site uses. That seems easier than maintaining 2 separate css files. I added a script that runs tidy-html5, but the user must install the program to use it. * hlsearch results html pages updated [#24] See notes in the (Changelog)[https://github.com/andy5995/hldig/blob/master/ChangeLog.md) There's still improvements that can be made to the html design, but this patch should make updates easier for contributors, and enables the use of a linked stylesheet --- .gitignore | 1 + CONTRIBUTING.md | 7 +-- ChangeLog.md | 23 +++++++++ TESTING.md | 22 +++++++++ docs/assets/css/style.css | 48 ++++++++++++++++++ installdir/HtFileType | 6 +-- installdir/Makefile.am | 7 +++ installdir/Makefile.in | 4 ++ installdir/footer.html | 12 ++--- installdir/header.html | 51 +++++++++---------- installdir/long.html | 13 ++--- installdir/nomatch.html | 79 +++++++++++++++-------------- installdir/search.html | 101 ++++++++++++++++++++++---------------- installdir/short.html | 2 +- installdir/syntax.html | 70 +++++++++++++------------- installdir/wrapper.html | 65 ++++++++++++------------ lighttpd.conf.sample | 3 +- samplesite/index.html | 7 +-- samplesite/page2.html | 7 +-- samplesite/page3.html | 7 +-- scripts/htmltidy.sh | 6 +++ 21 files changed, 341 insertions(+), 200 deletions(-) create mode 100755 scripts/htmltidy.sh diff --git a/.gitignore b/.gitignore index 513039ba..4f6e7bc9 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ ABOUT-NLS /po/POTFILES /po/stamp-po /po/remove-potcdate.sed +/samplesite/hldig diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f94ff6d0..d1af6ec0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,9 +23,10 @@ single from each other (i.e. a separate PR for each patch). ## Web site -Most of the files for the [web site][hldig_repo] are in +Most of the files for the [web site][hldig_website] are in [docs/infiles][site_infiles] and can be changed with a pull request -through GitHub. +through GitHub. To preview your changes, you can use +docs/src/simplecgen to generate new html files in docs/ Thank you! @@ -79,7 +80,7 @@ repo with the remote upstream. GitHub has instructions for doing this: 4 & 5 of **Syncing a Fork**). [GNU_style_guide]: https://www.gnu.org/prep/standards/html_node/Formatting.html -[hldig_repo]: https://andy5995.github.io/hldig/ +[hldig_website]: https://andy5995.github.io/hldig/ [site_infiles]: https://github.com/andy5995/hldig/blob/master/docs/infiles [authors]: https://github.com/andy5995/hldig/blob/master/AUTHORS.md [git-cola]: https://git-cola.github.io/ diff --git a/ChangeLog.md b/ChangeLog.md index 41f02a2d..37e815cb 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -3,6 +3,29 @@ This document contains information about changes after hl://Dig was forked. To see information about the original project, visit [ht://Dig on SourceForge](https://sourceforge.net/projects/htdig/) +### Thu Jan 11 2018 + +[#24](https://github.com/andy5995/hldig/issues/24) Added support for a +linked css stylesheet and reformatted the html code of the .html files +in installdir. Those are the files that are used for hlsearch results. +Instructions for +[testing](https://github.com/andy5995/hldig/blob/master/TESTING.md) +have been updated accordingly. + +If you've already installed lighttpd for testing (as outlined in +TESTING.md), you'll need to add ".css" to the mimetype.assign section +in ~/usr/etc/lighttpd.conf + +``` +mimetype.assign = ( + ".html" => "text/html", + ".txt" => "text/plain", + ".jpg" => "image/jpeg", + ".png" => "image/png", + ".css" => "text/css, +) +``` + ### Sun Jan 07 2018 ssl support is now enabled by default. Use `./configure --with-openssl=no` diff --git a/TESTING.md b/TESTING.md index cd77445e..79ebfc54 100644 --- a/TESTING.md +++ b/TESTING.md @@ -85,6 +85,11 @@ Copy `hlsearch.sh` from your $srcdir/scripts directory to your server root _Note: hlsearch.sh is a wrapper script that calls hlsearch._ +So lighttpd can find the web graphics and css stylesheet, in your +server root, make a symbolic link to testing/htdocs/hldig + + ln -s ../testing/hldig + Change back to the top level of your hldig source directory. Start the lighttpd server @@ -174,3 +179,20 @@ remove build files remove files created by ./configure make distclean + +## CSS and HTML changes + +The css file is located in docs/assets/css. The stylesheet used for the +main web site is the same one used for the samplesite and the hlsearch +results pages. It's copied from that directory to testing/htdocs/hldig/ +when `make install` is run. + +If you make changes to that css file, or the html files in installdir/, +you'll need to remove the files from **testing/share/hldig** and +**testing/htdocs/hldig** and then then run `make install` from +installdir. + +## Web site + +Please see [CONTRIBUTING -> Web site](https://github.com/andy5995/hldig/blob/master/CONTRIBUTING.md#web-site) for information +about making changes to the web site. diff --git a/docs/assets/css/style.css b/docs/assets/css/style.css index 5a597cfc..15d710a3 100644 --- a/docs/assets/css/style.css +++ b/docs/assets/css/style.css @@ -1,3 +1,43 @@ +/********************************************* + Default font settings and typography. +*********************************************/ +html { + font-size: 100%; +} +body { + color: #323848; + font-family: Arial, Helvetica, sans-serif; + font-size: 1em; + line-height: 1.2; +} +input, select, textarea { + font-family: Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; +} +pre, code, tt, kbd { + font-family: 'andale mono', 'lucida console', monospace; + font-size: 1em; + line-height: 1.5; +} +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +address, dfn, samp, ul, ol, dl { + margin-top: 1.5em; + margin-bottom: 1.5em; +} + +hr { + display: block; + margin-top: 0.5em; + margin-bottom: 0.5em; + margin-left: auto; + margin-right: auto; + border-style: inset; + border-width: 1px; +} + +a img { + margin: 0; +} + .plaintext { font-size: 18px; font-family: arial; @@ -36,3 +76,11 @@ h1 { text-align: center; } + +.form { +font-size: 10px; +} + +p.thick { + font-weight: bold; +} diff --git a/installdir/HtFileType b/installdir/HtFileType index e47d70e1..ca1c7d2b 100755 --- a/installdir/HtFileType +++ b/installdir/HtFileType @@ -4,10 +4,10 @@ # # Determine a file's MIME type from its contents. # -# +# -# Part of the ht://Dig package -# Copyright (c) 2003 The ht://Dig Group +# Part of the hl://Dig package +# Copyright (c) 2017 The hl://Dig Group # For copyright details, see the file COPYING in your distribution # or the GNU Public License version 2 or later # diff --git a/installdir/Makefile.am b/installdir/Makefile.am index 554aa997..884a3b30 100644 --- a/installdir/Makefile.am +++ b/installdir/Makefile.am @@ -10,8 +10,12 @@ IMAGES= button1.gif button2.gif button3.gif button4.gif button5.gif \ button1.png button2.png button3.png button4.png button5.png \ button6.png button7.png button8.png button9.png buttonl.png \ buttonr.png button10.png htdig.png star.png star_blank.png + COMMONHTML= header.html footer.html wrapper.html nomatch.html syntax.html \ long.html short.html + +COMMONCSS= style.css + COMMONDICT= bad_words english.0 english.aff synonyms EXTRA_DIST = $(IMAGES) $(COMMONHTML) $(COMMONDICT) rundig hldig.conf mime.types \ @@ -39,6 +43,9 @@ install-data-local: all @for i in $(IMAGES); do \ if [ ! -f $(DESTDIR)$(IMAGE_DIR)/$$i ]; then $(INSTALL_DATA) $(top_srcdir)/installdir/$$i $(DESTDIR)$(IMAGE_DIR)/$$i; echo $(DESTDIR)$(IMAGE_DIR)/$$i;fi; \ done && test -z "$$fail" + @for i in $(COMMONCSS); do \ + if [ ! -f $(DESTDIR)$(IMAGE_DIR)/$$i ]; then sed -e s%@\IMAGEDIR@%$(IMAGE_URL_PREFIX)% $(top_srcdir)/docs/assets/css/$$i >$(DESTDIR)$(IMAGE_DIR)/$$i; echo $(DESTDIR)$(IMAGE_DIR)/$$i;fi; \ + done && test -z "$$fail" @echo "Creating rundig script..." $(mkinstalldirs) $(DESTDIR)$(bindir) @if [ ! -f $(DESTDIR)$(bindir)/rundig ]; then \ diff --git a/installdir/Makefile.in b/installdir/Makefile.in index 1c9dcec4..e189e5f6 100644 --- a/installdir/Makefile.in +++ b/installdir/Makefile.in @@ -378,6 +378,7 @@ IMAGES = button1.gif button2.gif button3.gif button4.gif button5.gif \ COMMONHTML = header.html footer.html wrapper.html nomatch.html syntax.html \ long.html short.html +COMMONCSS = style.css COMMONDICT = bad_words english.0 english.aff synonyms EXTRA_DIST = $(IMAGES) $(COMMONHTML) $(COMMONDICT) rundig hldig.conf mime.types \ search.html HtFileType HtFileType-magic.mime cookies.txt @@ -714,6 +715,9 @@ install-data-local: all @for i in $(IMAGES); do \ if [ ! -f $(DESTDIR)$(IMAGE_DIR)/$$i ]; then $(INSTALL_DATA) $(top_srcdir)/installdir/$$i $(DESTDIR)$(IMAGE_DIR)/$$i; echo $(DESTDIR)$(IMAGE_DIR)/$$i;fi; \ done && test -z "$$fail" + @for i in $(COMMONCSS); do \ + if [ ! -f $(DESTDIR)$(IMAGE_DIR)/$$i ]; then sed -e s%@\IMAGEDIR@%$(IMAGE_URL_PREFIX)% $(top_srcdir)/docs/assets/css/$$i >$(DESTDIR)$(IMAGE_DIR)/$$i; echo $(DESTDIR)$(IMAGE_DIR)/$$i;fi; \ + done && test -z "$$fail" @echo "Creating rundig script..." $(mkinstalldirs) $(DESTDIR)$(bindir) @if [ ! -f $(DESTDIR)$(bindir)/rundig ]; then \ diff --git a/installdir/footer.html b/installdir/footer.html index 38d77847..08ad14b9 100644 --- a/installdir/footer.html +++ b/installdir/footer.html @@ -1,6 +1,6 @@ -$(PAGEHEADER) -$(PREVPAGE) $(PAGELIST) $(NEXTPAGE) -
- -ht://Dig $(VERSION) - + $(PAGEHEADER) $(PREVPAGE) $(PAGELIST) $(NEXTPAGE) +
+ hl://Dig $(VERSION) + + diff --git a/installdir/header.html b/installdir/header.html index 9f24dff7..9d2ee3ab 100644 --- a/installdir/header.html +++ b/installdir/header.html @@ -1,25 +1,26 @@ - -Search results for '$&(WORDS)' - -

htdig -Search results for '$&(LOGICAL_WORDS)'

-
-
- - - - -Match: $(METHOD) -Format: $(FORMAT) -Sort by: $(SORT) -
-Refine search: - - -
-
-
-Documents $(FIRSTDISPLAYED) - $(LASTDISPLAYED) of $(MATCHES) matches. -More *'s indicate a better match. - -
+ + + + + Search results for '$&(WORDS)' + + + +

hldigSearch results + for '$&(LOGICAL_WORDS)'

+
+
+ Match: $(METHOD) Format: $(FORMAT) Sort by: + $(SORT)
+ Refine search:
+
+
+ Documents $(FIRSTDISPLAYED) - $(LASTDISPLAYED) of + $(MATCHES) matches. More +'s indicate a better match. +
diff --git a/installdir/long.html b/installdir/long.html index 14a27233..64c82c1e 100644 --- a/installdir/long.html +++ b/installdir/long.html @@ -1,6 +1,7 @@ -
$&(TITLE)$(STARSLEFT) -
$(EXCERPT)
-$&(URL) -$(MODIFIED), $(SIZE) bytes -
- +
+
$&(TITLE)$(STARSLEFT)
+
$(EXCERPT)
+ $&(URL) $(MODIFIED), $(SIZE) bytes
+
diff --git a/installdir/nomatch.html b/installdir/nomatch.html index db937191..ace714d7 100644 --- a/installdir/nomatch.html +++ b/installdir/nomatch.html @@ -1,37 +1,42 @@ - -No match for '$&(LOGICAL_WORDS)' - -

ht://Dig -Search results

-
-

No matches were found for '$&(LOGICAL_WORDS)'

-

-Check the spelling of the search word(s) you used. -If the spelling is correct and you only used one word, -try using one or more similar search words with "Any." -

-If the spelling is correct and you used more than one -word with "Any," try using one or more similar search -words with "Any."

-If the spelling is correct and you used more than one -word with "All," try using one or more of the same words -with "Any."

-
-
- - - - -Match: $(METHOD) -Format: $(FORMAT) -Sort by: $(SORT) -
-Refine search: - - -
-
-
- -htdig $(VERSION) - + + + +No match for '$&(LOGICAL_WORDS)' + + + +

hl://Dig + Search results

+
+

No matches were found for '$&(LOGICAL_WORDS)'

+

+ Check the spelling of the search word(s) you used. + If the spelling is correct and you only used one word, + try using one or more similar search words with "Any." +

+ If the spelling is correct and you used more than one + word with "Any," try using one or more similar search + words with "Any."

+ If the spelling is correct and you used more than one + word with "All," try using one or more of the same words + with "Any."

+
+
+ + + + + Match: $(METHOD) + Format: $(FORMAT) + Sort by: $(SORT) +
+ Refine search: + + +
+
+
+ + hl://dig $(VERSION) + + diff --git a/installdir/search.html b/installdir/search.html index 12ab6c99..149b02dd 100644 --- a/installdir/search.html +++ b/installdir/search.html @@ -1,48 +1,63 @@ - + -htdig WWW Search + + htdig WWW Search + - -

-htdig -WWW Site Search

-
-This search will allow you to search the contents of -all the publicly available WWW documents at this site. -
-

-

- -Match: -Format: -Sort by: - - - - -
-Search: - - -
-
- -Powered by htdig $(VERSION) + +

hl://dig WWW Site + Search

+
+ This search will allow you to search the contents of all the + publicly available WWW documents at this site.
+
+
Match: Format: Sort by: +
+ Search: +
+
+
+ Powered by hl://dig + $(VERSION) - diff --git a/installdir/short.html b/installdir/short.html index e3e5e447..6cd963c8 100644 --- a/installdir/short.html +++ b/installdir/short.html @@ -1 +1 @@ -$(STARSRIGHT) $&(TITLE)
+ $(STARSRIGHT) $&(TITLE)
diff --git a/installdir/syntax.html b/installdir/syntax.html index a7844759..9466f0f0 100644 --- a/installdir/syntax.html +++ b/installdir/syntax.html @@ -1,34 +1,36 @@ - -Error in Boolean search for '$&(WORDS)' - -

ht://Dig -Error in Boolean search for '$&(LOGICAL_WORDS)'

-
-Boolean expressions need to be 'correct' in order for the search -system to use them. -The expression you entered has errors in it.

-Examples of correct expressions are: cat and dog, cat -not dog, cat or (dog not nose).
Note that -the operator not has the meaning of 'without'. -

-$(SYNTAXERROR) -
-
-
- - - - -Match: $(METHOD) -Format: $(FORMAT) -Sort: $(SORT) -
-Refine search: - - -
-
-
- -htdig $(VERSION) - + + + + + Error in Boolean search for '$&(WORDS)' + + + +

hl://Dig Error in + Boolean search for '$&(LOGICAL_WORDS)'

+
+ Boolean expressions need to be 'correct' in order for the search + system to use them. The expression you entered has errors in it. +

Examples of correct expressions are:

cat and + dog, cat not dog, cat or (dog not nose).

+ Note that the operator not has the meaning of + 'without'.

+
+

$(SYNTAXERROR)

+
+
+
+
Match: $(METHOD) Format: $(FORMAT) Sort: + $(SORT)
+ Refine search:
+
+
+ hl://dig $(VERSION) + + diff --git a/installdir/wrapper.html b/installdir/wrapper.html index 0afce593..18d1a016 100644 --- a/installdir/wrapper.html +++ b/installdir/wrapper.html @@ -1,32 +1,33 @@ - -Search results for '$&(WORDS)' - -

htdig -Search results for '$&(LOGICAL_WORDS)'

-
-
- - - - -Match: $(METHOD) -Format: $(FORMAT) -Sort by: $(SORT) -
-Refine search: - - -
-
-
-Documents $(FIRSTDISPLAYED) - $(LASTDISPLAYED) of $(MATCHES) matches. -More *'s indicate a better match. - -
-$(HTSEARCH_RESULTS) -$(PAGEHEADER) -$(PREVPAGE) $(PAGELIST) $(NEXTPAGE) -
- -htdig $(VERSION) - + + + + + Search results for '$&(WORDS)' + + + +

hl://dig Search + results for '$&(LOGICAL_WORDS)'

+
+
+
Match: $(METHOD) Format: $(FORMAT) Sort by: + $(SORT)
+ Refine search:
+
+
+

Documents $(FIRSTDISPLAYED) - $(LASTDISPLAYED) of + $(MATCHES) matches. More +'s indicate a better match.

+
+ $(HTSEARCH_RESULTS) $(PAGEHEADER) $(PREVPAGE) $(PAGELIST) + $(NEXTPAGE) +
+ hl://dig $(VERSION) + + diff --git a/lighttpd.conf.sample b/lighttpd.conf.sample index b4c6b5d8..a55738b6 100644 --- a/lighttpd.conf.sample +++ b/lighttpd.conf.sample @@ -11,7 +11,8 @@ mimetype.assign = ( ".html" => "text/html", ".txt" => "text/plain", ".jpg" => "image/jpeg", - ".png" => "image/png" + ".png" => "image/png", + ".css" => "text/css, ) static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc" ) diff --git a/samplesite/index.html b/samplesite/index.html index 2b88bab6..c5f2d1af 100644 --- a/samplesite/index.html +++ b/samplesite/index.html @@ -1,12 +1,13 @@ - + -htdig local test site | page 1 +hldig local test site | page 1 + -

htdig local test site

+

hldig local test site

Enter keywords

Quick Search:
diff --git a/samplesite/page2.html b/samplesite/page2.html index b841a960..9adb2f96 100644 --- a/samplesite/page2.html +++ b/samplesite/page2.html @@ -1,12 +1,13 @@ - + -htdig local test site | page 2 +hldig local test site | page 2 + -

htdig local test site | page 2

+

hldig local test site | page 2

For the complete story, visit http://www.gutenberg.org/ebooks/43936

diff --git a/samplesite/page3.html b/samplesite/page3.html index 441f12a4..253138c0 100644 --- a/samplesite/page3.html +++ b/samplesite/page3.html @@ -1,12 +1,13 @@ - + -htdig local test site | page 3 +hldig local test site | page 3 + -

htdig local test site | page 3

+

hldig local test site | page 3

For the complete story, visit http://www.gutenberg.org/ebooks/43936

diff --git a/scripts/htmltidy.sh b/scripts/htmltidy.sh new file mode 100755 index 00000000..166c96f8 --- /dev/null +++ b/scripts/htmltidy.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# +# You can get "tidy" from your OS distribution or by going to +# its web site @ http://www.htacg.org/ + +tidy --indent auto --indent-spaces 2 --char-encoding utf8 -m --quiet yes $1