Re: Learning and using aap in website project
Bram Moolenaar <[email protected]> Tue, 29 Jun 2004 11:29:54 +0200
| Newsgroups | gmane.comp.tools.aap.user |
|---|---|
| Message-ID | <[email protected]> |
Fredrik wrote:
> I'm maintaining a website for an non-profit org and all the articles
> that get submitted is written in asciidoc[1] and I have been using
> simple shell scripts for generating and uploading the site and has
> worked pretty okay until I stumbled on a-a-p via asciidoc's homepage
> and found an example how to build and maintain a site with asciidoc
> and aap, beautiful!
>
> Here is how my tree looks like:
>
> /
> /style
> /html
> /source/
> /source/conf
> /source/articles
> /source/articles/conf
>
> Where:
> style - is where some images and css files are located
> html - where the generated site should be placed
> source - where the site is index.asc, contact.asc and so on
> source/articles - where the submitted articles are located
> conf - is the asciidoc configuration for templating.
>
> I would like to generate html from ascidoc sources and from the asciidoc
> website example[2] the "rule" looks like this:
[...]
> This works very well when you have the main.aap *.asc files in the
> same directory. So my question is how I should do when using subdirs
> for generating the site?
>
> I have checked the documentation and tried but with no luck. I
> couldn't find any good examples either so I thought I would try my
> luck here.
There are several ways to do this, of course. Let's assume you want to
separate generating the html files from uploading them. This means you
can try them out locally first.
Create a main.aap in the toplevel directory that contains something like
this:
# Include the list of files to be generated.
:include filelist.aap
HTML_FILES = html/$*(ROOT).html
# Where to upload the HTML files to.
:attr {publish = scp://myhost/path/%file%} $HTML_FILES
# Rules for building the HTML files
:child source/main.aap
# Default target: build the HTML files
all: $HTML_FILES
# Publish target: upload the HTML files (build them too)
publish: $HTML_FILES
:publishall
One thing to watch out for: The HTML files have "html" in their name,
thus %file% also has that. You might want to use %basename% instead.
filelist.aap:
ROOT =
index
aboutsite
about
tutorials
In the source/main.aap recipe you place the stuff to build the HTML
files (so that you can run "aap" there to check your .asc files):
:include ../filelist.aap
HTML_FILES = ../html/$*(ROOT).html
all: $HTML_FILES
# AsciiDoc options to generate web pages.
ASCIIDOC_OPTS = -b css -f conf/asciidoc.conf -g revision=$VERS
# File translation rules.
:rule %.html : %.asc conf/asciidoc.conf
@if target == 'index.html':
# Index has description and keywords meta tags.
ASCIIDOC_OPTS += -g index-only -o $target
:sys $ASCIIDOC $ASCIIDOC_OPTS -o $target $(source[0])
Note that $HTML_FILES files exists both in the toplevel recipe and the
child recipe in the source directory, but have different values. That
is because file names in a recipe are relative to that recipe.
I don't know what you want to do with the source/articles directory.
Hopefully the above provides enough ideas to figure this out. You could
put the rule in a separate recipe and include that where you need it.
Avoids that you have to copy it around.
I didn't test any of this!
--
Vim is like Emacs without all the typing. (John "Johann" Spetz)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
\\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com