diff --git a/Makefile b/Makefile index 2d0618d6..ebdc570e 100644 --- a/Makefile +++ b/Makefile @@ -8,3 +8,4 @@ $(TARGETS:%=\%.%): $(MAKE) -C $* $(@:$*.%=%) $(TARGETS): %: $(DIRS:%=%.%) + diff --git a/common/Makefile.common b/common/Makefile.common index 38606885..7b590bad 100644 --- a/common/Makefile.common +++ b/common/Makefile.common @@ -5,7 +5,7 @@ OS = $(shell uname -s) BUILD_DATE = $(shell date "+%Y/%m/%d %H:%M:%S") BASE = $(TOP)/../common -DOC_SRC_FILES = $(wildcard locale/*/*.txt) $(wildcard locale/*/*.t2t) +DOC_SRC_FILES = $(wildcard locale/*/*.txt) LOCALES = $(wildcard locale/*) 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_BINS = png -JAR = chrome/${NAME}.jar +JAR = chrome/$(NAME).jar XPI_BASES = $(JAR_BASES) $(TOP)/.. XPI_FILES = install.rdf TODO AUTHORS Donators NEWS License.txt @@ -24,14 +24,14 @@ XPI_DIRS = modules components chrome XPI_TEXTS = js jsm XPI_BINS = jar -XPI_NAME = ${NAME}_${VERSION} -XPI_PATH = ../downloads/${XPI_NAME} +XPI_NAME = $(NAME)_$(VERSION) +XPI_PATH = ../downloads/$(XPI_NAME) XPI = $(XPI_PATH).xpi RDF = ../downloads/update.rdf -RDF_IN = ${RDF}.in +RDF_IN = $(RDF).in -BUILD_DIR = build.${VERSION}.${OS} +BUILD_DIR = build.$(VERSION).$(OS) ASCIIDOC = asciidoc @@ -39,17 +39,24 @@ ASCIIDOC = asciidoc #### 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 help: - @echo "${NAME} ${VERSION} build" + @echo "$(NAME) $(VERSION) build" @echo @echo " make help - display this help" @echo " make info - show some info about the system" @echo " make doc - build doc files" - @echo " make jar - build a JAR (${JAR})" - @echo " make xpi - build an XPI (${XPI_NAME})" + @echo " make jar - build a JAR ($(JAR))" + @echo " make xpi - build an XPI ($(XPI_NAME))" @echo " make release - updates update.rdf (this is not for you)" @echo " make clean - clean up" @echo " make distclean - clean up more" @@ -57,32 +64,30 @@ help: @echo "running some commands with V=1 will show more build details" info: - @echo "version ${VERSION}" - @echo "release file ${XPI}" - @echo "doc files ${DOC_SRC_FILES}" - @echo -e "jar files $(shell echo ${JAR_FILES} | sed 's/ /\\n /g' )" - @echo "xpi files ${XPI_FILES}" + @echo "version $(VERSION)" + @echo "release file $(XPI)" + @echo "doc files $(DOC_SRC_FILES)" + @echo "xpi files $(XPI_FILES)" -xpi: ${XPI} -jar: ${JAR} +xpi: $(XPI) +jar: $(JAR) -release: ${XPI} ${RDF} +release: $(XPI) $(RDF) -${RDF}: ${RDF_IN} Makefile +$(RDF): $(RDF_IN) Makefile @echo "Preparing release..." - ${Q}${SED} -e "s,###VERSION###,${VERSION},g" \ - -e "s,###DATE###,${BUILD_DATE},g" \ + $(SED) -e "s,###VERSION###,$(VERSION),g" \ + -e "s,###DATE###,$(BUILD_DATE),g" \ < $< > $@ @echo "SUCCESS: $@" clean: @echo "Cleanup..." - rm -f ${JAR} ${XPI} + rm -f $(JAR) $(XPI) -distclean: clean +distclean: clean $(LOCALES:%=%.distclean) @echo "More cleanup..." - @set -e; for locale in $(LOCALES); do $(MAKE) -C clean; doc; done - rm -rf ${BUILD_DIR} + rm -rf $(BUILD_DIR) #### xpi @@ -102,5 +107,5 @@ $(JAR): doc #### doc (see Makefile.doc) -doc: - @set -e; for locale in $(LOCALES); do $(MAKE) -C $$locale doc; done +doc: $(LOCALES:%=%.doc) ; + diff --git a/common/Makefile.doc b/common/Makefile.doc index 7111a941..48c81e4e 100644 --- a/common/Makefile.doc +++ b/common/Makefile.doc @@ -2,26 +2,16 @@ #### configuration -BASE = ../../../common - -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 +LOCALE = $(shell basename `pwd`) +LANG = $(shell basename `pwd` | awk -F- '{ print ($$1 ~ /^..$$/) ? $$1 : "en" }') ADC_SRC_FILES = $(wildcard *.txt) ADC_FILES = $(ADC_SRC_FILES:%.txt=%.html) -ADC_DEPS = $(wildcard asciidoc.conf lang-$(THIS_LANG).conf) - -T2T_SRC_FILES = $(wildcard *.t2t) -T2T_FILES = $(T2T_SRC_FILES:%.t2t=%.xhtml) -T2T_DEPS = $(wildcard config.t2t) +ADC_DEPS = $(wildcard asciidoc.conf lang-$(LANG).conf) DOC_FILES = $(ADC_FILES) $(T2T_FILES) ASCIIDOC = asciidoc -TXT2TAGS = txt2tags AWK = awk .SILENT: @@ -31,15 +21,13 @@ AWK = awk .PHONY: all help doc asciidoc check-asciidoc clean distclean all: doc -doc: asciidoc t2t +doc: asciidoc help: - @echo "${NAME} ${VERSION} build" + @echo "$(NAME) $(VERSION) build" @echo @echo " make help - display this help" @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 distclean - clean up more" @@ -52,12 +40,8 @@ distclean: clean #### Makes single-file makes easier to type -%: %.html %.t2t %.xhtml %.t2t ; - %: %.html %.txt ; -%: %.xhtml %.t2t ; - #### asciidoc asciidoc: check-asciidoc $(ADC_FILES) @@ -67,13 +51,6 @@ check-asciidoc: echo >&2 "Warning: asciidoc versions other than 8.2.x are unsupported" $(ADC_FILES): %.html: %.txt $(BASE)/Makefile.doc $(ADC_DEPS) - @echo "DOC locale/$(THIS_LOCALE)/$@" - $(ASCIIDOC) --unsafe -a linkcss -a quirks! -a lang=$(THIS_LANG) -a doctitle="$(shell basename $@)" -o $@ $< + @echo "DOC locale/$(LOCALE)/$@" + $(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 $< diff --git a/common/content/buffer.js b/common/content/buffer.js index 5c984553..c08ca04b 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -1064,7 +1064,7 @@ function Buffer() //{{{ let res = buffer.evaluateXPath(options["hinttags"], frame.document); 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); if (regex.test(elem.textContent)) diff --git a/common/content/completion.js b/common/content/completion.js index 19fec8fc..0f692b64 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -554,10 +554,10 @@ CompletionContext.prototype = { { let self = this; let items = this.items; - let reverse = start > end; + let step = start > end ? -1 : 1; start = Math.max(0, start || 0); 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) @@ -565,10 +565,10 @@ CompletionContext.prototype = { let self = this; let items = this.items; let cache = this.cache.rows; - let reverse = start > end; + let step = start > end ? -1 : 1; start = Math.max(0, start || 0); 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)]; }, diff --git a/common/content/editor.js b/common/content/editor.js index 8e0c603e..b24422bf 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -204,7 +204,7 @@ function Editor() //{{{ function (args) { let matches = args.string.match(RegExp("^\\s*($|" + abbrevmatch + ")(?:\\s*$|\\s+(.*))")); - if (! matches) + if (!matches) { liberator.echoerr("E474: Invalid argument"); return false; diff --git a/common/content/util.js b/common/content/util.js index 95a73230..090de789 100644 --- a/common/content/util.js +++ b/common/content/util.js @@ -519,25 +519,28 @@ const util = { //{{{ }, /** - * A generator that returns the values between start and end. - * If reverse is true then the values are returned in reverse order. + * A generator that returns the values between start and end, + * in step increments. * * @param {number} start The interval's start 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)} */ - range: function range(start, end, reverse) + range: function range(start, end, step) { - if (!reverse) + if (!step) + step = 1; + if (step > 0) { - while (start < end) - yield start++; + for (; start < end; start += step) + yield start; } else { while (start > end) - yield --start; + yield start += step; } }, diff --git a/vimperator/content/bookmarks.js b/vimperator/content/bookmarks.js index bd888b2f..f099b36e 100644 --- a/vimperator/content/bookmarks.js +++ b/vimperator/content/bookmarks.js @@ -711,7 +711,7 @@ function History() //{{{ if (url) { 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) { @@ -735,7 +735,7 @@ function History() //{{{ let sh = window.getWebNavigation().sessionHistory; 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" }; }, count: true, @@ -1043,8 +1043,7 @@ function QuickMarks() //{{{ list: function list(filter) { - let marks = [key for ([key, val] in qmarks)]; - // This was a lot nicer without the lambda... + let marks = [k for ([k, v] in qmarks)]; let lowercaseMarks = 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(); diff --git a/vimperator/locale/en-US/Makefile b/vimperator/locale/en-US/Makefile deleted file mode 120000 index 85510a12..00000000 --- a/vimperator/locale/en-US/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../../common/Makefile.doc \ No newline at end of file diff --git a/vimperator/locale/en-US/Makefile b/vimperator/locale/en-US/Makefile new file mode 100644 index 00000000..627ca99b --- /dev/null +++ b/vimperator/locale/en-US/Makefile @@ -0,0 +1,2 @@ +BASE = ../../../common +include $(BASE)/Makefile.doc