doc/Makefile
author Alexander Plavin <me@aplavin.ru>
Thu, 04 Jul 2013 14:18:44 +0400
changeset 19387 f2e4fdb3dd27
parent 14459 323c11dad9c6
child 19425 81fbd4e66ff5
permissions -rw-r--r--
hgweb: code selection without line numbers in file source view All the source lines are put in a <pre> tag, which gives correct display and copy&paste in both Chromium (WebKit) and FireFox: line numbers are not copied, all the tabs and spaces are kept. This doesn't change the visual appearance of the view compared to current hgweb version and doesn't use any JS code. Also, stripes in this view are now generated clientside with CSS. This implementation is chosen because other variants have important issues: Strategy FF Chrome current D,LT,E,T,L D,L pre S,NW S,NW pre/div/nbsp LT,E,T,TS,NW TS,NW pre/div/br LT,E,T,NW NW ol/li/nbsp LT,E,T,TS,AJ TS,AJ ol/li/br LT,E,T,AJ AJ pre/span LV LV Legend Strategies: - current: implemented in hgweb before this patch, i.e. divs for each line, and line numbers links in the div too - pre: the whole code in one pre tag with newlines, all line numbers in another one with 'float: left' - pre/div/{nbsp,br}: same as just 'pre', but separate divs for each line and &nbsp; or <br> instead of empty lines (otherwise they are not copied at all) - ol/li/{nbsp,br}: a single ol with li's and divs for each line, &nbsp; or <br> same as in previous strategy - pre/span: this patch Problems: D = (very minor) display problems, like wrong width of leading tabs LT = loses leading/trailing whitespace E = loses embedded whitespace B = loses blank lines T = loses tabs L = selects line numbers LV = (only) visually selects line numbers LVE = (only) visually selects line numbers at empty lines S = no stripes (and no ability to easily highlight lines-which-are-linked-at in the future) TS = space copied instead of empty line AJ = get anchor links only with JS (they work even without) NW = no linewrap easily possible (in future) As for browser versions compatibility, the CSS tricks used are supported in (according to caniuse.com): a) line numbers generation with 'content:' property and CSS counters: IE 8+, all other popular browsers (in pre-WebKit Opera numbers are being copied) b) stripes ('nth-child' selector): IE 8+, FF 3.5+, Safari 3.2+, Opera 9.5+, all other popular browsers c) line numbers are not visually selected ('user-select:' property): IE 10+, Opera 15.0+, all other popular browsers This patch is based on a demo implementation by Martin Geisler <martin@geisler.net>.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
671
efa4a7e2f322 Move hgrc documentation out to its own man page, hgrc(5).
Bryan O'Sullivan <bos@serpentine.com>
parents: 465
diff changeset
     1
SOURCES=$(wildcard *.[0-9].txt)
efa4a7e2f322 Move hgrc documentation out to its own man page, hgrc(5).
Bryan O'Sullivan <bos@serpentine.com>
parents: 465
diff changeset
     2
MAN=$(SOURCES:%.txt=%)
efa4a7e2f322 Move hgrc documentation out to its own man page, hgrc(5).
Bryan O'Sullivan <bos@serpentine.com>
parents: 465
diff changeset
     3
HTML=$(SOURCES:%.txt=%.html)
12921
6b6e7da9bccd doc/Makefile: docs now also depend on extensions
Martin Geisler <mg@aragost.com>
parents: 12841
diff changeset
     4
GENDOC=gendoc.py ../mercurial/commands.py ../mercurial/help.py \
6b6e7da9bccd doc/Makefile: docs now also depend on extensions
Martin Geisler <mg@aragost.com>
parents: 12841
diff changeset
     5
	../mercurial/help/*.txt ../hgext/*.py ../hgext/*/__init__.py
2233
3840cefa5222 Added install target.
wilde@trapperkeeper.sha-bang.de
parents: 1879
diff changeset
     6
PREFIX=/usr/local
4030
a48971ae1387 install man pages by default into $(PREFIX)/share/man not $(PREFIX)/man since the FHS puts them there
Jonathan Smith <https://issues.rpath.com/>
parents: 3908
diff changeset
     7
MANDIR=$(PREFIX)/share/man
7686
fa584d23e3cc Do not install executable man pages
Christian Ebert <blacktrash@gmx.net>
parents: 7660
diff changeset
     8
INSTALL=install -c -m 644
6724
2e58f1a36046 use ${PYTHON} var in doc/Makefile as well
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6486
diff changeset
     9
PYTHON=python
13054
25200c7efe0f runrst: add RSTARGS Makefile variable to allow customization
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12921
diff changeset
    10
RSTARGS=
465
f8cb8d082d40 Add a doc makefile
mpm@selenic.com
parents:
diff changeset
    11
10555
091dddf05764 doc/Makefile: fix doc generation when LANGUAGE is set
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 10093
diff changeset
    12
export LANGUAGE=C
9971
fa99480d5135 doc/Makefile: ensure C locale
Martin Geisler <mg@lazybytes.net>
parents: 9703
diff changeset
    13
export LC_ALL=C
fa99480d5135 doc/Makefile: ensure C locale
Martin Geisler <mg@lazybytes.net>
parents: 9703
diff changeset
    14
1006
b0e581438835 Generate html documentation by default, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 671
diff changeset
    15
all: man html
465
f8cb8d082d40 Add a doc makefile
mpm@selenic.com
parents:
diff changeset
    16
f8cb8d082d40 Add a doc makefile
mpm@selenic.com
parents:
diff changeset
    17
man: $(MAN)
f8cb8d082d40 Add a doc makefile
mpm@selenic.com
parents:
diff changeset
    18
f8cb8d082d40 Add a doc makefile
mpm@selenic.com
parents:
diff changeset
    19
html: $(HTML)
f8cb8d082d40 Add a doc makefile
mpm@selenic.com
parents:
diff changeset
    20
1814
7956893e8458 generate hg manpage from commands.py docstring
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1689
diff changeset
    21
hg.1.txt: hg.1.gendoc.txt
7956893e8458 generate hg manpage from commands.py docstring
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1689
diff changeset
    22
	touch hg.1.txt
7956893e8458 generate hg manpage from commands.py docstring
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1689
diff changeset
    23
9703
8374f26727de doc/Makefile: add help/*.txt as a dependency
Martin Geisler <mg@lazybytes.net>
parents: 9626
diff changeset
    24
hg.1.gendoc.txt: $(GENDOC)
9444
2f7f6e43d52b doc/Makefile: do not create files in case of errors
Martin Geisler <mg@lazybytes.net>
parents: 9422
diff changeset
    25
	${PYTHON} gendoc.py > $@.tmp
2f7f6e43d52b doc/Makefile: do not create files in case of errors
Martin Geisler <mg@lazybytes.net>
parents: 9422
diff changeset
    26
	mv $@.tmp $@
1814
7956893e8458 generate hg manpage from commands.py docstring
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1689
diff changeset
    27
14459
323c11dad9c6 doc: rebuild hgrc.5 man and HTML page when help/config changes
Martin Geisler <mg@lazybytes.net>
parents: 13054
diff changeset
    28
hgrc.5: ../mercurial/help/config.txt
323c11dad9c6 doc: rebuild hgrc.5 man and HTML page when help/config changes
Martin Geisler <mg@lazybytes.net>
parents: 13054
diff changeset
    29
323c11dad9c6 doc: rebuild hgrc.5 man and HTML page when help/config changes
Martin Geisler <mg@lazybytes.net>
parents: 13054
diff changeset
    30
hgrc.5.html: ../mercurial/help/config.txt
323c11dad9c6 doc: rebuild hgrc.5 man and HTML page when help/config changes
Martin Geisler <mg@lazybytes.net>
parents: 13054
diff changeset
    31
9162
2399362b3bb0 doc: link man pages to one another
Martin Geisler <mg@lazybytes.net>
parents: 9161
diff changeset
    32
%: %.txt common.txt
13054
25200c7efe0f runrst: add RSTARGS Makefile variable to allow customization
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12921
diff changeset
    33
	$(PYTHON) runrst hgmanpage $(RSTARGS) --halt warning \
9445
f0105f2c424c doc/Makefile: make rst2html and rst2man halt on warnings
Martin Geisler <mg@lazybytes.net>
parents: 9444
diff changeset
    34
	  --strip-elements-with-class htmlonly $*.txt $*
465
f8cb8d082d40 Add a doc makefile
mpm@selenic.com
parents:
diff changeset
    35
9162
2399362b3bb0 doc: link man pages to one another
Martin Geisler <mg@lazybytes.net>
parents: 9161
diff changeset
    36
%.html: %.txt common.txt
13054
25200c7efe0f runrst: add RSTARGS Makefile variable to allow customization
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12921
diff changeset
    37
	$(PYTHON) runrst html $(RSTARGS) --halt warning \
9626
d1aa5393bef4 doc: add a style sheet to the generated HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9445
diff changeset
    38
	  --link-stylesheet --stylesheet-path style.css $*.txt $*.html
465
f8cb8d082d40 Add a doc makefile
mpm@selenic.com
parents:
diff changeset
    39
3872
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3269
diff changeset
    40
MANIFEST: man html
9401
2a5144687727 doc/Makefile: Don't show Makefile comments in output
Mads Kiilerich <mads@kiilerich.com>
parents: 9400
diff changeset
    41
# tracked files are already in the main MANIFEST
3872
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3269
diff changeset
    42
	$(RM) $@
12841
5fbc2c38a98f doc/Makefile: do not include hg.1.gendoc.txt in MANIFEST
Martin Geisler <mg@lazybytes.net>
parents: 12840
diff changeset
    43
	for i in $(MAN) $(HTML); do \
3872
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3269
diff changeset
    44
	  echo "doc/$$i" >> $@ ; \
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3269
diff changeset
    45
	done
9d7ac8613340 fix MANIFEST generation
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 3269
diff changeset
    46
2233
3840cefa5222 Added install target.
wilde@trapperkeeper.sha-bang.de
parents: 1879
diff changeset
    47
install: man
3840cefa5222 Added install target.
wilde@trapperkeeper.sha-bang.de
parents: 1879
diff changeset
    48
	for i in $(MAN) ; do \
8822
1027da7d2fb9 doc: fix regexp for determining the man page section
Cédric Duval <cedricduval@free.fr>
parents: 8311
diff changeset
    49
	  subdir=`echo $$i | sed -n 's/^.*\.\([0-9]\)$$/man\1/p'` ; \
4753
620cea146b19 mercurial.spec: include CONTRIBUTORS, COPYING and man pages in rpm
Adam Spiers <hg@adamspiers.org>
parents: 4032
diff changeset
    50
	  mkdir -p $(DESTDIR)$(MANDIR)/$$subdir ; \
620cea146b19 mercurial.spec: include CONTRIBUTORS, COPYING and man pages in rpm
Adam Spiers <hg@adamspiers.org>
parents: 4032
diff changeset
    51
	  $(INSTALL) $$i $(DESTDIR)$(MANDIR)/$$subdir ; \
2233
3840cefa5222 Added install target.
wilde@trapperkeeper.sha-bang.de
parents: 1879
diff changeset
    52
	done
3840cefa5222 Added install target.
wilde@trapperkeeper.sha-bang.de
parents: 1879
diff changeset
    53
465
f8cb8d082d40 Add a doc makefile
mpm@selenic.com
parents:
diff changeset
    54
clean:
12840
99e8dd56e244 doc/Makefile: cleanup clean target
Martin Geisler <mg@lazybytes.net>
parents: 11639
diff changeset
    55
	$(RM) $(MAN) $(HTML) hg.1.gendoc.txt MANIFEST