1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 10:57:58 +01:00

Sorry, stashed changes including:

Change util.range to accept an increment as the third argument.
    Sanitize Makefile.doc
This commit is contained in:
Kris Maglione
2009-01-21 03:41:43 -05:00
parent 050cd4b2e4
commit eb88d7ea0b
9 changed files with 62 additions and 76 deletions

View File

@@ -8,3 +8,4 @@ $(TARGETS:%=\%.%):
$(MAKE) -C $* $(@:$*.%=%) $(MAKE) -C $* $(@:$*.%=%)
$(TARGETS): %: $(DIRS:%=%.%) $(TARGETS): %: $(DIRS:%=%.%)

View File

@@ -5,7 +5,7 @@ OS = $(shell uname -s)
BUILD_DATE = $(shell date "+%Y/%m/%d %H:%M:%S") BUILD_DATE = $(shell date "+%Y/%m/%d %H:%M:%S")
BASE = $(TOP)/../common BASE = $(TOP)/../common
DOC_SRC_FILES = $(wildcard locale/*/*.txt) $(wildcard locale/*/*.t2t) DOC_SRC_FILES = $(wildcard locale/*/*.txt)
LOCALES = $(wildcard locale/*) LOCALES = $(wildcard locale/*)
MAKE_JAR = VERSION="$(VERSION)" DATE="$(BUILD_DATE)" sh $(BASE)/make_jar.sh MAKE_JAR = VERSION="$(VERSION)" DATE="$(BUILD_DATE)" sh $(BASE)/make_jar.sh
@@ -16,7 +16,7 @@ JAR_DIRS = content skin locale
JAR_TEXTS = js css dtd xml xul html xhtml JAR_TEXTS = js css dtd xml xul html xhtml
JAR_BINS = png JAR_BINS = png
JAR = chrome/${NAME}.jar JAR = chrome/$(NAME).jar
XPI_BASES = $(JAR_BASES) $(TOP)/.. XPI_BASES = $(JAR_BASES) $(TOP)/..
XPI_FILES = install.rdf TODO AUTHORS Donators NEWS License.txt XPI_FILES = install.rdf TODO AUTHORS Donators NEWS License.txt
@@ -24,14 +24,14 @@ XPI_DIRS = modules components chrome
XPI_TEXTS = js jsm XPI_TEXTS = js jsm
XPI_BINS = jar XPI_BINS = jar
XPI_NAME = ${NAME}_${VERSION} XPI_NAME = $(NAME)_$(VERSION)
XPI_PATH = ../downloads/${XPI_NAME} XPI_PATH = ../downloads/$(XPI_NAME)
XPI = $(XPI_PATH).xpi XPI = $(XPI_PATH).xpi
RDF = ../downloads/update.rdf RDF = ../downloads/update.rdf
RDF_IN = ${RDF}.in RDF_IN = $(RDF).in
BUILD_DIR = build.${VERSION}.${OS} BUILD_DIR = build.$(VERSION).$(OS)
ASCIIDOC = asciidoc ASCIIDOC = asciidoc
@@ -39,17 +39,24 @@ ASCIIDOC = asciidoc
#### rules #### rules
.PHONY: all help info doc jar xpi install clean distclean $(JAR) TARGETS = all help info doc jar xpi install clean distclean $(JAR)
$(TARGETS:%=\%.%):
echo MAKE $* $(@:$*.%=%)
$(MAKE) -C $* $(@:$*.%=%)
$(TARGETS): %: $(LOCALES:%=%.%)
.PHONY: $(TARGETS)
all: help all: help
help: help:
@echo "${NAME} ${VERSION} build" @echo "$(NAME) $(VERSION) build"
@echo @echo
@echo " make help - display this help" @echo " make help - display this help"
@echo " make info - show some info about the system" @echo " make info - show some info about the system"
@echo " make doc - build doc files" @echo " make doc - build doc files"
@echo " make jar - build a JAR (${JAR})" @echo " make jar - build a JAR ($(JAR))"
@echo " make xpi - build an XPI (${XPI_NAME})" @echo " make xpi - build an XPI ($(XPI_NAME))"
@echo " make release - updates update.rdf (this is not for you)" @echo " make release - updates update.rdf (this is not for you)"
@echo " make clean - clean up" @echo " make clean - clean up"
@echo " make distclean - clean up more" @echo " make distclean - clean up more"
@@ -57,32 +64,30 @@ help:
@echo "running some commands with V=1 will show more build details" @echo "running some commands with V=1 will show more build details"
info: info:
@echo "version ${VERSION}" @echo "version $(VERSION)"
@echo "release file ${XPI}" @echo "release file $(XPI)"
@echo "doc files ${DOC_SRC_FILES}" @echo "doc files $(DOC_SRC_FILES)"
@echo -e "jar files $(shell echo ${JAR_FILES} | sed 's/ /\\n /g' )" @echo "xpi files $(XPI_FILES)"
@echo "xpi files ${XPI_FILES}"
xpi: ${XPI} xpi: $(XPI)
jar: ${JAR} jar: $(JAR)
release: ${XPI} ${RDF} release: $(XPI) $(RDF)
${RDF}: ${RDF_IN} Makefile $(RDF): $(RDF_IN) Makefile
@echo "Preparing release..." @echo "Preparing release..."
${Q}${SED} -e "s,###VERSION###,${VERSION},g" \ $(SED) -e "s,###VERSION###,$(VERSION),g" \
-e "s,###DATE###,${BUILD_DATE},g" \ -e "s,###DATE###,$(BUILD_DATE),g" \
< $< > $@ < $< > $@
@echo "SUCCESS: $@" @echo "SUCCESS: $@"
clean: clean:
@echo "Cleanup..." @echo "Cleanup..."
rm -f ${JAR} ${XPI} rm -f $(JAR) $(XPI)
distclean: clean distclean: clean $(LOCALES:%=%.distclean)
@echo "More cleanup..." @echo "More cleanup..."
@set -e; for locale in $(LOCALES); do $(MAKE) -C clean; doc; done rm -rf $(BUILD_DIR)
rm -rf ${BUILD_DIR}
#### xpi #### xpi
@@ -102,5 +107,5 @@ $(JAR): doc
#### doc (see Makefile.doc) #### doc (see Makefile.doc)
doc: doc: $(LOCALES:%=%.doc) ;
@set -e; for locale in $(LOCALES); do $(MAKE) -C $$locale doc; done

View File

@@ -2,26 +2,16 @@
#### configuration #### configuration
BASE = ../../../common LOCALE = $(shell basename `pwd`)
LANG = $(shell basename `pwd` | awk -F- '{ print ($$1 ~ /^..$$/) ? $$1 : "en" }')
THIS_LOCALE = $(notdir $(shell pwd))
THIS_LANG = $(firstword $(subst -, ,$(THIS_LOCALE)))
ifneq ($(strip $(shell echo -n $(THIS_LANG) | wc -c)),2)
THIS_LANG = en
endif
ADC_SRC_FILES = $(wildcard *.txt) ADC_SRC_FILES = $(wildcard *.txt)
ADC_FILES = $(ADC_SRC_FILES:%.txt=%.html) ADC_FILES = $(ADC_SRC_FILES:%.txt=%.html)
ADC_DEPS = $(wildcard asciidoc.conf lang-$(THIS_LANG).conf) ADC_DEPS = $(wildcard asciidoc.conf lang-$(LANG).conf)
T2T_SRC_FILES = $(wildcard *.t2t)
T2T_FILES = $(T2T_SRC_FILES:%.t2t=%.xhtml)
T2T_DEPS = $(wildcard config.t2t)
DOC_FILES = $(ADC_FILES) $(T2T_FILES) DOC_FILES = $(ADC_FILES) $(T2T_FILES)
ASCIIDOC = asciidoc ASCIIDOC = asciidoc
TXT2TAGS = txt2tags
AWK = awk AWK = awk
.SILENT: .SILENT:
@@ -31,15 +21,13 @@ AWK = awk
.PHONY: all help doc asciidoc check-asciidoc clean distclean .PHONY: all help doc asciidoc check-asciidoc clean distclean
all: doc all: doc
doc: asciidoc t2t doc: asciidoc
help: help:
@echo "${NAME} ${VERSION} build" @echo "$(NAME) $(VERSION) build"
@echo @echo
@echo " make help - display this help" @echo " make help - display this help"
@echo " make doc - build doc files" @echo " make doc - build doc files"
@echo " make asciidoc - build asciidoc'd files only"
@echo " make t2t - build txt2tags'd files only"
@echo " make clean - clean up" @echo " make clean - clean up"
@echo " make distclean - clean up more" @echo " make distclean - clean up more"
@@ -52,12 +40,8 @@ distclean: clean
#### Makes single-file makes easier to type #### Makes single-file makes easier to type
%: %.html %.t2t %.xhtml %.t2t ;
%: %.html %.txt ; %: %.html %.txt ;
%: %.xhtml %.t2t ;
#### asciidoc #### asciidoc
asciidoc: check-asciidoc $(ADC_FILES) asciidoc: check-asciidoc $(ADC_FILES)
@@ -67,13 +51,6 @@ check-asciidoc:
echo >&2 "Warning: asciidoc versions other than 8.2.x are unsupported" echo >&2 "Warning: asciidoc versions other than 8.2.x are unsupported"
$(ADC_FILES): %.html: %.txt $(BASE)/Makefile.doc $(ADC_DEPS) $(ADC_FILES): %.html: %.txt $(BASE)/Makefile.doc $(ADC_DEPS)
@echo "DOC locale/$(THIS_LOCALE)/$@" @echo "DOC locale/$(LOCALE)/$@"
$(ASCIIDOC) --unsafe -a linkcss -a quirks! -a lang=$(THIS_LANG) -a doctitle="$(shell basename $@)" -o $@ $< $(ASCIIDOC) --unsafe -a linkcss -a quirks! -a lang=$(LANG) -a doctitle="$(shell basename $@)" -o $@ $<
#### txt2tags
t2t: $(T2T_FILES)
$(T2T_FILES): %.xhtml: %.t2t $(BASE)/Makefile.doc $(T2T_DEPS)
@echo "T2T locale/$(THIS_LOCALE)/$@"
txt2tags --quiet $<

View File

@@ -1064,7 +1064,7 @@ function Buffer() //{{{
let res = buffer.evaluateXPath(options["hinttags"], frame.document); let res = buffer.evaluateXPath(options["hinttags"], frame.document);
for (let [,regex] in Iterator(regexps)) for (let [,regex] in Iterator(regexps))
{ {
for (let i in util.range(res.snapshotLength, 0, true)) for (let i in util.range(res.snapshotLength, 0, -1))
{ {
let elem = res.snapshotItem(i); let elem = res.snapshotItem(i);
if (regex.test(elem.textContent)) if (regex.test(elem.textContent))

View File

@@ -554,10 +554,10 @@ CompletionContext.prototype = {
{ {
let self = this; let self = this;
let items = this.items; let items = this.items;
let reverse = start > end; let step = start > end ? -1 : 1;
start = Math.max(0, start || 0); start = Math.max(0, start || 0);
end = Math.min(items.length, end ? end : items.length); end = Math.min(items.length, end ? end : items.length);
return util.map(util.range(start, end, reverse), function (i) items[i]); return util.map(util.range(start, end, step), function (i) items[i]);
}, },
getRows: function getRows(start, end, doc) getRows: function getRows(start, end, doc)
@@ -565,10 +565,10 @@ CompletionContext.prototype = {
let self = this; let self = this;
let items = this.items; let items = this.items;
let cache = this.cache.rows; let cache = this.cache.rows;
let reverse = start > end; let step = start > end ? -1 : 1;
start = Math.max(0, start || 0); start = Math.max(0, start || 0);
end = Math.min(items.length, end != null ? end : items.length); end = Math.min(items.length, end != null ? end : items.length);
for (let i in util.range(start, end, reverse)) for (let i in util.range(start, end, step))
yield [i, cache[i] = cache[i] || util.xmlToDom(self.createRow(items[i]), doc)]; yield [i, cache[i] = cache[i] || util.xmlToDom(self.createRow(items[i]), doc)];
}, },

View File

@@ -204,7 +204,7 @@ function Editor() //{{{
function (args) function (args)
{ {
let matches = args.string.match(RegExp("^\\s*($|" + abbrevmatch + ")(?:\\s*$|\\s+(.*))")); let matches = args.string.match(RegExp("^\\s*($|" + abbrevmatch + ")(?:\\s*$|\\s+(.*))"));
if (! matches) if (!matches)
{ {
liberator.echoerr("E474: Invalid argument"); liberator.echoerr("E474: Invalid argument");
return false; return false;

View File

@@ -519,25 +519,28 @@ const util = { //{{{
}, },
/** /**
* A generator that returns the values between <b>start</b> and <b>end</b>. * A generator that returns the values between <b>start</b> and <b>end</b>,
* If <b>reverse</b> is true then the values are returned in reverse order. * in <b>step</b> increments.
* *
* @param {number} start The interval's start value. * @param {number} start The interval's start value.
* @param {number} end The interval's end value. * @param {number} end The interval's end value.
* @param {boolean} reverse Reverse the order in which the values are produced. * @param {boolean} step The value to step the range by. May be
* negative. @default 1
* @returns {Iterator(Object)} * @returns {Iterator(Object)}
*/ */
range: function range(start, end, reverse) range: function range(start, end, step)
{ {
if (!reverse) if (!step)
step = 1;
if (step > 0)
{ {
while (start < end) for (; start < end; start += step)
yield start++; yield start;
} }
else else
{ {
while (start > end) while (start > end)
yield --start; yield start += step;
} }
}, },

View File

@@ -711,7 +711,7 @@ function History() //{{{
if (url) if (url)
{ {
let sh = window.getWebNavigation().sessionHistory; let sh = window.getWebNavigation().sessionHistory;
for (let i in util.range(sh.index, 0, true)) for (let i in util.range(sh.index, 0, -1))
{ {
if (sh.getEntryAtIndex(i, false).URI.spec == url) if (sh.getEntryAtIndex(i, false).URI.spec == url)
{ {
@@ -735,7 +735,7 @@ function History() //{{{
let sh = window.getWebNavigation().sessionHistory; let sh = window.getWebNavigation().sessionHistory;
context.anchored = false; context.anchored = false;
context.completions = [sh.getEntryAtIndex(i, false) for (i in util.range(sh.index, 0, true))]; context.completions = [sh.getEntryAtIndex(i, false) for (i in util.range(sh.index, 0, -1))];
context.keys = { text: function (item) item.URI.spec, description: "title" }; context.keys = { text: function (item) item.URI.spec, description: "title" };
}, },
count: true, count: true,
@@ -1043,8 +1043,7 @@ function QuickMarks() //{{{
list: function list(filter) list: function list(filter)
{ {
let marks = [key for ([key, val] in qmarks)]; let marks = [k for ([k, v] in qmarks)];
// This was a lot nicer without the lambda...
let lowercaseMarks = marks.filter(function (x) /[a-z]/.test(x)).sort(); let lowercaseMarks = marks.filter(function (x) /[a-z]/.test(x)).sort();
let uppercaseMarks = marks.filter(function (x) /[A-Z]/.test(x)).sort(); let uppercaseMarks = marks.filter(function (x) /[A-Z]/.test(x)).sort();
let numberMarks = marks.filter(function (x) /[0-9]/.test(x)).sort(); let numberMarks = marks.filter(function (x) /[0-9]/.test(x)).sort();

View File

@@ -1 +0,0 @@
../../../common/Makefile.doc

View File

@@ -0,0 +1,2 @@
BASE = ../../../common
include $(BASE)/Makefile.doc