Re: publish docs from muse via make?

Phillip Lord <[email protected]> Wed, 03 May 2006 18:12:10 +0100
Newsgroups gmane.emacs.wiki.general
Message-ID <[email protected]>
>>>>> "PL" == Paul Lussier <[email protected]> writes:

 
  PL> Muse essentially eliminates all of these objections.  Though, it
  PL> would be really nice if we could update the published versions
  PL> automatically
  >> From outside of emacs.  Ideally, from make, where in order to
  >> make the
  PL> target, we would update the "source" from our revision control
  PL> system, then somehow run the muse-publish functions on that
  PL> directory, which would then create the published versions in
  PL> their respective directories.


I do this, although, frankly it's a pain in the ass, and rather slow
(because you launch emacs for every dependency). Also, if something
goes wrong, emacs normally crashes incomprehensibly and its a
nightmare to debug. 

So I start like this...

SOURCES =	$(shell echo *.muse)
TARGETS =	$(filter-out *.html,$(SOURCES:%.muse=%.html)) $(EXTRA_TARGETS)


.muse.html:
	emacs -q --debug-init --no-site-file --batch -l generate-muse.el  \
		-f muse-batch-publish-files bioont-06-xhtml \
		--output-dir=. $<
	## no, I don't know why this is necessary either. 
	sleep 1
	$(CP) $@ $(INSTALL_LOCATION)

"bioont-06-xhtml" is the style. 

then I have this...

all:  makefile-generated prepare  $(TARGETS) index.html

makefile-generated:
	./generate-makefile.pl > Makefile.generated



Makefile.generated just has rules like

home.html: home.muse

I'm sure it's possible to do this generically, but I've never worked
out how to. And doing it in perl was quick. 

Then finally, you need this...


(add-to-list 
 'load-path
 "~/emacs")

(setq muse-wiki-use-wikiword nil)

(save-excursion
  (let ((default-directory "~/emacs/packages/"))
    (normal-top-level-add-subdirs-to-load-path)))

(load-library "philmuse.el")


which is the content of muse-generate.el. This is a little bit more
complex than you need; you could just do 


(save-excursion
  (let ((default-directory "~/emacs/MUSE_PATH/"))
    (normal-top-level-add-subdirs-to-load-path)))

(require 'muse)
(require 'which-ever-bits-of-muse-you-need)



Convoluted but it works; it's a poor way to build muse projects, but
it doesn't integrate with the rest of the world. My make file also has
targets for pushing to the published website with rsync, cleaning,
building images and so on. 


Anyway, that's how it works for me. 

Phil