Skip to content

Commit

Permalink
Merge pull request #2172 from jimklimov/spellcheck-more
Browse files Browse the repository at this point in the history
Spellcheck and asciidoc more
  • Loading branch information
jimklimov authored Nov 14, 2023
2 parents 6f0689e + d72b3fa commit 963c101
Show file tree
Hide file tree
Showing 43 changed files with 955 additions and 380 deletions.
11 changes: 11 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@ spellcheck spellcheck-interactive:
(cd $(builddir)/docs/man && $(MAKE) -s $@) || RES=$$? ; \
(cd $(builddir)/conf && $(MAKE) -s $@) || RES=$$? ; \
(cd $(builddir)/data && $(MAKE) -s $@) || RES=$$? ; \
(cd $(builddir)/data/html && $(MAKE) -s $@) || RES=$$? ; \
(cd $(builddir)/scripts && $(MAKE) -s $@) || RES=$$? ; \
(cd $(builddir)/scripts/Solaris && $(MAKE) -s $@) || RES=$$? ; \
(cd $(builddir)/scripts/Windows && $(MAKE) -s $@) || RES=$$? ; \
(cd $(builddir)/scripts/devd && $(MAKE) -s $@) || RES=$$? ; \
(cd $(builddir)/scripts/hotplug && $(MAKE) -s $@) || RES=$$? ; \
(cd $(builddir)/scripts/python && $(MAKE) -s $@) || RES=$$? ; \
(cd $(builddir)/scripts/systemd && $(MAKE) -s $@) || RES=$$? ; \
(cd $(builddir)/scripts/udev && $(MAKE) -s $@) || RES=$$? ; \
(cd $(builddir)/scripts/upsdrvsvcctl && $(MAKE) -s $@) || RES=$$? ; \
(cd $(builddir)/tests/NIT && $(MAKE) -s $@) || RES=$$? ; \
exit $$RES

# Note: the "all-docs" and "check-docs" targets may require tools not
Expand Down
23 changes: 22 additions & 1 deletion data/html/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,28 @@ if WITH_CGI
dist_html_DATA = index.html bottom.html nut-banner.png
nodist_html_DATA = header.html
endif
EXTRA_DIST = README
EXTRA_DIST = README.adoc

SPELLCHECK_SRC = README.adoc

# NOTE: Due to portability, we do not use a GNU percent-wildcard extension:
#%-spellchecked: % Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT)
# $(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@

# NOTE: Portable suffix rules do not allow prerequisites, so we shim them here
# by a wildcard target in case the make implementation can put the two together.
*-spellchecked: Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT)

.sample.sample-spellchecked:
$(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@

.in.in-spellchecked:
$(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@

spellcheck spellcheck-interactive spellcheck-sortdict:
$(MAKE) -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC="$(SPELLCHECK_SRC)" SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@

CLEANFILES = *-spellchecked

MAINTAINERCLEANFILES = Makefile.in .dirstamp
# Generated by configure script:
Expand Down
97 changes: 0 additions & 97 deletions data/html/README

This file was deleted.

103 changes: 103 additions & 0 deletions data/html/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
NUT HTML complementary information
==================================
Arnaud Quette <arnaud.quette@free.fr>, Dave Breiland <superdave@dynamicis.com>
v1.0, 27 Jul 2005 (start date)

This file provides some complementary information
about the use and integration of NUT HTML pages.

1) Introduction
---------------

NUT HTML pages have been created as a central point
that ease the access to the various CGI scripts
providing the NUT web interface.

It consists of three HTML files:

* `index.html`: defines the two container frames,
`topFrame` and `mainFrame`
* `header.html`: contains the header including links
to NUT website, and `upsstats.cgi`/`upsset.cgi`
* `bottom.html`: empty frame that will be replaced
with the content of `upsstats.cgi` or `upsset.cgi`.
2) Integration
--------------

You first need to install NUT CGI, i.e. using
----
:; ./configure --with-cgi
----

Refer to the NUT documentation for more information.

There are two ways to integrate NUT HTML with your
webserver, with the same results:

a) take advantage of the existing tree
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- the cgi programs are (for example) installed in `/usr/lib/cgi-bin`,
which is already configured in your webserver as the default CGI path
- in the same spirit, we will use the existing `DocumentRoot` (in terms
of Apache webserver) and create a `nut` subdirectory, and copy the
three `.html` files (`index`, `header` and `bottom`)
Note that the links to cgi programs in `header.html` are pre-configured
to work in this situation, which eases the packagers' work.

b) configure manually
~~~~~~~~~~~~~~~~~~~~~

- copy the `data/html` directory to some path (i.e. `/usr/local/nut`
for a standard installation from source)
- Now edit your webserver configuration file, adding for
example (for Apache):
----
#Begin Section
ScriptAlias /nut/cgi-bin/ /usr/local/nut/cgi-bin/
<Directory "/usr/local/nut/cgi-bin/">
AllowOverride AuthConfig
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
Alias /nut/ /usr/local/nut/html/
<Directory "/usr/local/nut/html/">
Options None
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
#End Section
----

- Make sure to change the links path in `header.html` according to your
configuration and installation.
3) Conclusion
-------------

- Make sure to restart your webserver.
- Configure the CGI scripts. Manpages can be found from:
----
:; man -M /usr/local/nut/man/ upsstats.cgi
:; man -M /usr/local/nut/man/ upsset.cgi
:; man -M /usr/local/nut/man/ upsimage.cgi
:; man -M /usr/local/nut/man/ hosts.conf
----
- It is recommended that you use `.htaccess` files in the `cgi-bin` folder
and the `html` folder. Please reference:
http://httpd.apache.org/docs/howto/htaccess.html
- You will then be able to access the NUT HTML page at:
http://localhost/nut
- Further protection with HTTPS is recommended, especially for installations
on networks accessible by someone other than yourself.
33 changes: 32 additions & 1 deletion docs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -420,12 +420,43 @@ ASPELL_OUT_NOTERRORS = (^[ \t]*[\*\@]|^$$)
#
# NOTE: This portable rule RELIES on just one SPELLCHECK_SRC defined
# at a time, with an outer Makefile caller ensuring the looping:

SPELLCHECK_RECIPE_DEBUG_STREAM = /dev/null
#SPELLCHECK_RECIPE_DEBUG_STREAM = &2

$(SPELLCHECK_BUILDDIR)/$(SPELLCHECK_SRC_ONE)-spellchecked: $(SPELLCHECK_SRCDIR)/$(SPELLCHECK_SRC_ONE) $(abs_top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT)
@LANG=C; LC_ALL=C; export LANG; export LC_ALL; \
if test x"$(SPELLCHECK_SRC_ONE)" = x ; then echo "SKIP: Bogus spellcheck call for empty target filename (with make target $@)" >&2 ; exit 0; fi; \
case "$@" in *-spellchecked) ;; *) echo "SKIP: Bogus spellcheck call for non '*-spellchecked' target filename (with make target $@)" >&2 ; exit 0;; esac; \
rm -f "$@" || true ; \
echo " ASPELL Spell checking on $(SPELLCHECK_SRCDIR)/$(SPELLCHECK_SRC_ONE)"; \
REPORT_SRCDIR="$(SPELLCHECK_SRCDIR)"; \
REPORT_SRC_ONE="$(SPELLCHECK_SRC_ONE)"; \
REPORT_PREFIX="" ; \
case "$(SPELLCHECK_SRC_ONE)" in \
/*) ;; \
*/*) if [ x"$${REPORT_SRCDIR}" = x ] ; then \
echo EMPTY >$(SPELLCHECK_RECIPE_DEBUG_STREAM) ; \
REPORT_SRCDIR="`dirname "$(SPELLCHECK_SRC_ONE)"`"; \
else \
echo "APPEND: SPELLCHECK_SRCDIR='$(SPELLCHECK_SRCDIR)' SPELLCHECK_SRC_ONE='$(SPELLCHECK_SRC_ONE)' dirname='`dirname "$(SPELLCHECK_SRC_ONE)"`'" >$(SPELLCHECK_RECIPE_DEBUG_STREAM) ; \
REPORT_SRCDIR="$${REPORT_SRCDIR}/`dirname "$(SPELLCHECK_SRC_ONE)"`"; \
fi ; \
REPORT_SRC_ONE="`basename "$(SPELLCHECK_SRC_ONE)"`"; \
;; \
*) ;; \
esac; \
if [ x"$${REPORT_SRCDIR}" != x ] ; then \
tmpREPORT_PREFIX="NUT source root :: $${REPORT_SRCDIR} :: " ; \
REPORT_SRCDIR="`cd "$${REPORT_SRCDIR}" && { pwd >$(SPELLCHECK_RECIPE_DEBUG_STREAM) ; pwd | sed 's|^'"$(abs_top_srcdir)"'/*||' ; }`" \
|| { REPORT_SRCDIR="$(SPELLCHECK_SRCDIR)" ; REPORT_SRC_ONE="$(SPELLCHECK_SRC_ONE)" ; REPORT_PREFIX="" ; } ; \
fi ; \
echo "=== Got REPORT_SRCDIR='$${REPORT_SRCDIR}'" >$(SPELLCHECK_RECIPE_DEBUG_STREAM) ; \
case "$${REPORT_SRCDIR}" in \
"") ;; \
*/) ;; \
*) REPORT_SRCDIR="$${REPORT_SRCDIR}/" ;; \
esac ; \
echo " ASPELL Spell checking on $${REPORT_PREFIX}$${REPORT_SRCDIR}$${REPORT_SRC_ONE}"; \
OUT="`(sed 's,^\(.*\)$$, \1,' | $(ASPELL) -a $(ASPELL_NUT_TEXMODE_ARGS) $(ASPELL_NUT_COMMON_ARGS) 2>&1) < "$(SPELLCHECK_SRCDIR)/$(SPELLCHECK_SRC_ONE)"`" \
&& { if test -n "$$OUT" ; then OUT="`echo "$$OUT" | $(EGREP) -b -v '$(ASPELL_OUT_NOTERRORS)' `" ; fi; \
test -z "$$OUT" ; } \
Expand Down
Loading

0 comments on commit 963c101

Please sign in to comment.