[annotator-dev] Lost in the "current" Annotator 1.2.9 - looking a "state-of-the-art" plugin

Ernesto Torresin (ML) ewk-ml at connettivo.net
Tue Jun 24 14:01:42 UTC 2014


On 24/06/2014 14:38, Ernesto Torresin (ML) wrote:
> On 24/06/2014 13:39, Ernesto Torresin (ML) wrote:
>> On 24/06/2014 12:18, Ernesto Torresin (ML) wrote:
>>> On 24/06/2014 11:00, Nick Stenning wrote:
>>>>
>> [...]
>>> I am using the master branch indeed, because to read the sources and
>>> compile I was requested by the Makefile to have a .git repository. I'm
>>> going for the 1.2.x branch now.
>>
>> 'npm install .' in the v1.2.x gave me coffescript at 1.6.3 as specified in
>> package.json and required by coffeebarx at 0.0.3, but Makefile wants to
>> call the coffeescript node module with the "--no-header" option, that
>> was not present in coffeescript before v. 1.7.1 if I understand
>> correctly
>> https://github.com/jashkenas/coffeescript/commit/2b03fa9077cea31b25cb23518d8af59fe5b80fed.
>> Should I modify the package.json or the Makefile?
>>
> 
> No way in either way. Requesting a more recent coffeescript module
> breaks some dependencies, and removing the "--no-header" option just
> lets me hit against sed errors about missing files. BTW I get the same
> sed errors about missing files if I try to compile the version at
> https://github.com/openannotation/annotator/archive/v1.2.9.tar.gz linked
> to at https://github.com/openannotation/annotator/releases/tag/v1.2.9.
> I am installing npm modules locally in every version, and I can compile
> the clone of the master branch as usual.
> 
> Any idea?

OK, I don't need minified files to study the code, so I stripped away
the pkg/Makefile rules for the min.js files and now the
https://github.com/openannotation/annotator/archive/v1.2.9.tar.gz
compiles. This sounds like a reasonable start. I'm dropping the v1.2.x
branch because I'd like to start with something that was considered
stable enough for being released.

:-)

E.T.
PS in case it may help anybody, here is my modified Makefile. Some line
breaks may be added by the mail program, so chances are good that this
cannot be used as-is. Anyway, I just replaced the parts with the
"min.js" string, with parts with a ".js" string. Quick and dirty.
-----------------------------------------------------------------
pkg/Makefile:
-----------------------------------------------------------------
vpath %.coffee ../src

SHELL := /bin/bash
PATH := $(shell npm bin):$(PATH)

ANNOTATOR=\
	xpath.coffee \
	util.coffee \
	console.coffee \
	class.coffee \
	range.coffee \
	annotator.coffee \
	widget.coffee \
	editor.coffee \
	viewer.coffee \
	notification.coffee

PLUGINS=\
	plugin/annotateitpermissions.coffee \
	plugin/auth.coffee \
	plugin/document.coffee \
	plugin/filter.coffee \
	plugin/kitchensink.coffee \
	plugin/markdown.coffee \
	plugin/permissions.coffee \
	plugin/store.coffee \
	plugin/tags.coffee \
	plugin/unsupported.coffee

ANNOTATOR_FULL=\
	$(ANNOTATOR) \
	plugin/unsupported.coffee \
	plugin/auth.coffee \
	plugin/store.coffee \
	plugin/permissions.coffee \
	plugin/annotateitpermissions.coffee \
	plugin/filter.coffee \
	plugin/markdown.coffee \
	plugin/tags.coffee \
	plugin/kitchensink.coffee

BOOKMARKLET=\
	$(ANNOTATOR) \
	plugin/auth.coffee \
	plugin/store.coffee \
	plugin/permissions.coffee \
	plugin/annotateitpermissions.coffee \
	plugin/unsupported.coffee \
	plugin/tags.coffee

BOOKMARKLET_CFG=../contrib/bookmarklet/config.json
BOOKMARKLET_SRC=../contrib/bookmarklet/src/bookmarklet.js

all: annotator plugins annotator-full bookmarklet

annotator: annotator.js annotator.min.css #annotator: annotator.min.js
annotator.min.css

PLUGIN_NAMES=$(notdir $(PLUGINS))
plugins: $(addprefix annotator.,$(PLUGIN_NAMES:.coffee=.js)) #plugins:
$(addprefix annotator.,$(PLUGIN_NAMES:.coffee=.min.js))

annotator-full: annotator-full.js #annotator-full.min.js

_preamble.map:
	@../tools/preamble > _preamble.coffee
	@coffee -mcb _preamble.coffee

annotator.js: $(ANNOTATOR) _preamble.map
	@cd ..; coffeebarx $(addprefix src/, $(ANNOTATOR)) -xso pkg/_annotator.js
	@mapcat _preamble.map _annotator.map -m annotator.map -j annotator.js

annotator-full.js: $(ANNOTATOR_FULL) _preamble.map
	@cd ..; coffeebarx $(addprefix src/, $(ANNOTATOR_FULL)) -xso
pkg/_annotator-full.js
	@mapcat _preamble.map _annotator-full.map -m annotator-full.map -j
annotator-full.js

annotator.css: ../css/annotator.css
	@../tools/data_uri_ify <../css/annotator.css >annotator.css

bookmarklet: annotator-bookmarklet.js annotator.min.css bookmarklet.js
#bookmarklet: annotator-bookmarklet.min.js annotator.min.css
bookmarklet.min.js

annotator-bookmarklet.js: $(BOOKMARKLET) _preamble.map
	@cd ..; coffeebarx $(addprefix src/, $(BOOKMARKLET)) -xso
pkg/_annotator-bookmarklet.js
	@mapcat _preamble.map _annotator-bookmarklet.map -m
annotator-bookmarklet.map -j annotator-bookmarklet.js

BOOKMARKLET_CFG_DEP=$(shell [ -f $(BOOKMARKLET_CFG) ] && echo
$(BOOKMARKLET_CFG))
bookmarklet.js: $(BOOKMARKLET_SRC) $(BOOKMARKLET_CFG_DEP)
	@if [ -r $(BOOKMARKLET_CFG) ]; then \
	  sed -e "/Leave __config__/d" \
	      -e "/^__config__$$/{r $(BOOKMARKLET_CFG)" -e 'd;}' \
	      <$(BOOKMARKLET_SRC) \
	      >bookmarklet.js; \
	else \
	  sed -e "/Leave __config__/d" \
	      <$(BOOKMARKLET_SRC) \
	      >bookmarklet.js; \
	fi

annotator.%.js: plugin/%.coffee _preamble.map
	@cd ..; coffeebarx -xso pkg/_$(basename $@).js pkg/$<
	@mapcat _preamble.map _$(basename $@).map -m $(basename $@).map -j $@

#%.min.js: %.js _preamble.map
#	@# Oh my god this is so horrible I want to die. Uglify doesn't add the
#	@# "file" key to the output map, so we manually inject it... with sed.
#	@echo $@
#	@if [ -e $(basename $<).map ]; then \
#	  uglifyjs $< --source-map _$(basename $<).min.map --in-source-map
$(basename $<).map > _$@ 2>/dev/null ; \
#	  sed -e 's/\("version":3,\)/\1"file":"'_$@'",/' -i '' _$(basename
$<).min.map ; \
#	  mapcat _preamble.map _$(basename $<).min.map -m $(basename
$<).min.map -j $@ ; \
#	else \
#	  uglifyjs $< > $@ 2>/dev/null ; \
#	fi

%.min.css: %.css
	@echo $@
	@uglifycss $< >$@

locales:
	@cd ..; \
	for f in $(basename $(ANNOTATOR_FULL)); \
          do echo "lib/$$f.js"; \
        done | \
	xargs xgettext -Lpython -o- -k_t -kgettext --from-code=utf-8 \
	> locale/annotator.pot

clean:
	rm -rf *.js *.css *.map *_mapsrc _preamble* _tmp

# don't remove intermediate .js files when building plugins
.SECONDARY:

.PHONY: all annotator plugins annotator-full bookmarklet clean
-----------------------------------------------------------------






More information about the annotator-dev mailing list