Check-in [ce85597cc6]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:initial commit
Timelines: family | descendants | trunk
Files: files | file ages | folders
SHA1:ce85597cc6d1255d530d7f3e6e2a3007a040c2d8
User & Date: brandon@invergo.net 2013-02-19 16:59:41
Context
2013-02-19
17:01
variablize markdown check-in: 0e2d3be820 user: brandon@invergo.net tags: trunk
16:59
initial commit check-in: ce85597cc6 user: brandon@invergo.net tags: trunk
Changes

Added Makefile.

            1  +# Deployment Options
            2  +# Get SSH user/doc root from auth.mk
            3  +include auth.mk
            4  +RSYNC = rsync
            5  +SSH_PORT = 22
            6  +SSH_USER ?= 
            7  +DOC_ROOT ?= 
            8  +RSYNC_DELETE = #--delete
            9  +
           10  +# Copies files from src/ to dst/. Any .html files are
           11  +# interpreted by GNU m4 and wrapped in a the GNU m4
           12  +# template. Common m4 macros may be stored in a macros
           13  +# file.
           14  +
           15  +MACROS    := macros.m4
           16  +SRC	  := src
           17  +DST       := dst
           18  +TEMPLATES := templates
           19  +PAGES     := $(SRC)/pages
           20  +POSTS     := $(SRC)/news
           21  +MAIN_T    := $(TEMPLATES)/main.html.m4
           22  +BLOG_T    := $(TEMPLATES)/blog.html.m4
           23  +POST_T	  := $(TEMPLATES)/post.html.m4
           24  +PAGE_T    := $(TEMPLATES)/page.html.m4
           25  +ATOM_T    := $(TEMPLATES)/atom.xml.m4
           26  +ATOM_E_T  := $(TEMPLATES)/atom_entry.xml.m4
           27  +
           28  +# Build a list of all the files that should exist when the
           29  +# baking is done. We do this by getting a list of all the
           30  +# source files and rewriting pathnames and file suffixes as
           31  +# necessary.
           32  +raw_posts  := $(shell find $(POSTS) -name index.html* -prune -o -type f)
           33  +raw_posts  := $(raw_posts:$(POSTS)/%=$(DST)/news/%)
           34  +raw_posts  := $(raw_posts:.m4=)
           35  +raw_posts  := $(filter-out %.inc %.swp %~ \#%,$(raw_posts))
           36  +raw_posts  := $(raw_posts:.md=.html)
           37  +
           38  +raw_pages  := $(shell find $(SRC) -type d -name news -prune -o -type f)
           39  +raw_pages  := $(raw_pages:$(SRC)/%=$(DST)/%)
           40  +raw_pages  := $(raw_pages:.m4=)
           41  +raw_pages  := $(filter-out %.inc %.swp %~ \#%,$(raw_pages))
           42  +raw_pages  := $(raw_pages:.md=.html)
           43  +
           44  +sp :=
           45  +sp += # add space
           46  +post-sort = $(shell echo -e $(subst $(sp),'\n',$2) | sort $1 --key=1,1 -)
           47  +sorted_posts := $(addprefix $(POSTS)/,$(call post-sort,-r,$(notdir $(wildcard $(POSTS)/*.md.m4))))
           48  +
           49  +all: clean-index clean-atom index atom posts pages
           50  +
           51  +posts: $(raw_posts)
           52  +	@echo "==> building posts"
           53  +
           54  +pages: $(raw_pages)
           55  +	@echo "==> building pages"
           56  +
           57  +$(POSTS)/%.html: $(POSTS)/%.html.m4 $(MACROS) $(MAIN_T) $(POST_T)
           58  +	@m4 -P $(MACROS) $< $(POST_T) $(MAIN_T) > $@
           59  +
           60  +$(SRC)/%.html: $(SRC)/%.html.m4 $(MACROS) $(MAIN_T) $(PAGE_T)
           61  +	@m4 -P $(MACROS) $< $(PAGE_T) $(MAIN_T) > $@
           62  +
           63  +index: 
           64  +	@echo "==> building index"
           65  +	@echo "TITLE({\"News\"})" >> $(POSTS)/index.html.m4
           66  +	@echo "BODY({\"{\"" >> $(POSTS)/index.html.m4
           67  +	@for f in $(sorted_posts); do \
           68  +		link="`basename $$f .md.m4`.html";\
           69  +		head -n3 $$f | m4 -D "__URL"=$$link  \
           70  +			-P $(MACROS) - $(BLOG_T) >> $(POSTS)/index.html.m4; \
           71  +	done
           72  +	@echo "\"}\"})" >> $(POSTS)/index.html.m4
           73  +
           74  +atom:
           75  +	@echo "==> building feed"
           76  +	@m4 -P $(MACROS) $(ATOM_T) > $(SRC)/atom.xml
           77  +	@for f in $(sorted_posts); do \
           78  +		link="`basename $$f .md.m4`.html";\
           79  +		markdown $$f | m4 -D "__URL"=$$link -P $(MACROS) - $(ATOM_E_T) \
           80  +			| head -n -4 >> $(SRC)/atom.xml; \
           81  +	done
           82  +	@echo "</feed>" >> $(SRC)/atom.xml
           83  +
           84  +
           85  +$(SRC)/%.html.m4: $(SRC)/%.md.m4 
           86  +	@markdown $< > $@
           87  +
           88  +$(SRC)/%: $(SRC)/%.m4 $(MACROS)
           89  +	@m4 -P $(MACROS) $< > $@
           90  +
           91  +$(DST)/%: $(SRC)/%
           92  +	@install -m 644 -D $< $@
           93  +
           94  +clean-index:
           95  +	@echo "==> cleaning index"
           96  +	-rm $(POSTS)/index.html.m4
           97  +
           98  +clean-atom:
           99  +	@echo "==> cleaning feed"
          100  +	-rm $(SRC)/atom.xml
          101  +
          102  +clean: clean-index clean-atom
          103  +	@echo "==> cleaning dst"
          104  +	@mv $(DST) .old_dst
          105  +	@rm -rf .old_dst
          106  +
          107  +new-post:
          108  +	@if [[ "$(TITLE)" == "" ]]; then echo "Error: no TITLE set"; fi
          109  +	@m4 -DTITLE="$(TITLE)" -P $(TEMPLATES)/new_post.md.m4 > \
          110  +		$(POSTS)/$(shell date +%Y-%m-%d)-$(subst $(sp),-,$(TITLE)).md.m4
          111  +
          112  +deploy:
          113  +	@$(RSYNC) -avze 'ssh -p $(SSH_PORT)' $(RSYNC_DELETE) $(DST)/ $(SSH_USER):$(DOC_ROOT)
          114  +
          115  +.PHONY = all pages posts index clean-index clean new-post atom clean-atom deploy

Added README.md.

            1  +# GNU Make and M4 Website Bakery
            2  +
            3  +One of the first hacks that I was really proud of was this website-baking system I built in late 1999 with some venerable old Unix tools, [GNU Make](http://www.gnu.org/software/make/) and [GNU m4](http://www.gnu.org/software/m4/). The article [Using M4 to write HTML](http://web.archive.org/web/19980529230944/http://www.linuxgazette.com/issue22/using_m4.html) by Bob Hepple was my original inspiration, but I think I was able to surpass the utility of the examples given therein.
            4  +
            5  +**You're currently viewing the 'master' branch of this repository.** I've tried to include here many interesting features and ideas for how this technique might be used, including the use of [Pandoc](http://johnmacfarlane.net/pandoc/) for markdown-format source files. I've tried to include a generous amount of internal documentation and comments as well, but it may yet be a lot to absorb at once. To more easily understand what's going on here, be sure to take a look at the 'simple' branch of the repository: http://github.com/datagrok/m4-bakery/tree/simple
            6  +
            7  +## Site Baking
            8  +
            9  +"Website baking" is the pattern of building from templates a mostly- or completely-static website that requires no special software to serve. Baking a website provides huge advantages when it can be employed, because they:
           10  +
           11  +- have fewer vectors for break-ins, 
           12  +- easily scale to handle massive amounts of traffic, and 
           13  +- may be hosted on commodity hardware or the cheapest of web hosting services.
           14  +
           15  +Of course, with no processing occurring on the server end, it's not possible to host user-interactive features like comments sections, authentication, or e-commerce systems. These days however, many people use third-party tools like [Disqus](http://disqus.com) to implement these features anyway.
           16  +
           17  +In short, if you're not using any of the dynamic features of your web hosting service, you might as well make the whole site static.
           18  +
           19  +## GNU Make and GNU M4
           20  +
           21  +That is of course only an argument for building static websites. Doing it in this _particular_ way may be... ill-advised.
           22  +
           23  +Though m4 may be venerable and may come pre-installed on several modern Unix platforms, it brings along a notoriously cumbersome syntax for defining and calling macros, escaping, quoting, and other things. Sendmail's configuration system serves as a cautionary tale, as it was built upon m4 and is legendary for being obtuse. Employing m4 may be an exercise in masochism.
           24  +
           25  +The difficulty in employing m4 may contribute to my pride in having built a useful tool with it a whole decade+ ago. I hope that this repository will yet serve as an instructive example of how to 'bake' a website using ubiquitous Unix tools, even if every single user ends up swapping out m4 for modern template software, e.g. [Jinja](http://jinja.pocoo.org/).
           26  +
           27  +## Features
           28  +
           29  +- The HTML template is wrapped around .html.m4 files automatically; no boilerplate is necessary in the source file.
           30  +- The HTML template is a single file, not a separate header and footer.
           31  +- Files named .m4 don't get the template, but still get interpreted by m4.
           32  +- Any files not named '.m4' don't get interpreted by m4; they are copied verbatim.
           33  +- Macros defined in source .html.m4 files will be expanded in the template. This lets you put complex logic in the template and trigger it from the source file. For example, you could set the page title, toggle a template style, define sidebars, etc.
           34  +- Macros defined in the macros file will be expanded in the source files and the template. You can define macros here that you want to be available everywhere.
           35  +
           36  +## Execution
           37  +
           38  +Beginning with source files like this:
           39  +
           40  +	src/
           41  +	|-- index.html.m4
           42  +	`-- style.css
           43  +
           44  +Along with the Makefile, macros file, and HTML template, running 'make' will
           45  +output:
           46  +
           47  +	install -m 644 -D src/style.css dst/style.css
           48  +	m4 -P macros.m4 src/index.html.m4 template.html.m4 > src/index.html
           49  +	install -m 644 -D src/index.html dst/index.html
           50  +	rm src/index.html
           51  +
           52  +And produce the following structure:
           53  +
           54  +	dst/
           55  +	|-- index.html
           56  +	`-- style.css

Added auth.mk.

            1  +SSH_USER = user
            2  +DOC_ROOT = ~/my_website
            3  +

Added macros.m4.

            1  +m4_divert(2)m4_dnl  Keep this line at the top of the file.
            2  +m4_dnl  ----------------------------------------------------------------------
            3  +m4_dnl  Define site-wide macros
            4  +m4_dnl  ----------------------------------------------------------------------
            5  +m4_changequote(`{"', `"}')m4_dnl
            6  +m4_define({"TITLE"},
            7  +	{"m4_define({"__TITLE"}, $1)m4_dnl"})m4_dnl
            8  +m4_define({"DATE"},
            9  +	{"m4_define({"__DATE"}, $1)m4_dnl"})m4_dnl
           10  +m4_define({"UPDATE"},
           11  +	{"m4_define({"__UPDATE"}, $1)m4_dnl"})m4_dnl
           12  +m4_define({"EXCERPT"},
           13  +	{"m4_define({"__EXCERPT"}, $1)m4_dnl"})m4_dnl
           14  +m4_define({"BODY"},
           15  +	{"m4_define({"__BODY"}, $1)m4_dnl"})m4_dnl
           16  +m4_dnl TODO fix this
           17  +m4_define({"TAGS"},
           18  +	{"m4_define({"__TAGS"}, $1)m4_dnl"})m4_dnl
           19  +m4_dnl  ----------------------------------------------------------------------
           20  +m4_dnl  Configuration of the site
           21  +m4_dnl  ----------------------------------------------------------------------
           22  +m4_define({"__ROOT"}, {"http://brandon.invergo.net"})m4_dnl
           23  +m4_define({"__SITE_TITLE"}, {"Brandon Invergo"})m4_dnl
           24  +m4_define({"__SITE_SUBTITLE"}, {""})m4_dnl
           25  +m4_define({"__AUTHOR"}, {"Brandon Invergo"})
           26  +m4_define({"__EMAIL"}, {"brandon@invergo.net"})

Added src/css/main.css.

            1  +/* ==========================================================================
            2  +   HTML5 Boilerplate styles - h5bp.com (generated via initializr.com)
            3  +   ========================================================================== */
            4  +
            5  +html,
            6  +button,
            7  +input,
            8  +select,
            9  +textarea {
           10  +    color: #DCDCCC;
           11  +}
           12  +
           13  +body {
           14  +    font-size: 1em;
           15  +    line-height: 1.4;
           16  +}
           17  +
           18  +::-moz-selection {
           19  +    background: #656555;
           20  +    text-shadow: none;
           21  +}
           22  +
           23  +::selection {
           24  +    background: #656555;
           25  +    text-shadow: none;
           26  +}
           27  +
           28  +hr {
           29  +    display: block;
           30  +    height: 1px;
           31  +    border: 0;
           32  +    border-top: 1px solid #2B2B2B;
           33  +    margin: 1em 0;
           34  +    padding: 0;
           35  +}
           36  +
           37  +img {
           38  +    vertical-align: middle;
           39  +}
           40  +
           41  +fieldset {
           42  +    border: 0;
           43  +    margin: 0;
           44  +    padding: 0;
           45  +}
           46  +
           47  +textarea {
           48  +    resize: vertical;
           49  +}
           50  +
           51  +.chromeframe {
           52  +    margin: 0.2em 0;
           53  +    background: #2B2B2B;
           54  +    color: #DCDCCC;
           55  +    padding: 0.2em 0;
           56  +}
           57  +
           58  +
           59  +/* ==========================================================================
           60  +   Author's custom styles
           61  +   ========================================================================== */
           62  +
           63  +body {
           64  +    color: #DCDCCC;
           65  +    background-color: #3f3f3f;
           66  +    width: 60%;
           67  +    margin:0px auto; 
           68  +}
           69  +
           70  +p#meta {
           71  +    color: #5f7f5f;
           72  +}
           73  +
           74  +p {
           75  +    background-color: #3F3F3F;
           76  +    font-family: sans-serif;
           77  +}
           78  +
           79  +header {
           80  +    margin: 0;
           81  +}
           82  +
           83  +h1 {
           84  +    color: #DCDCCC;
           85  +    background-color: #7F9F7F;
           86  +    padding: 10px 20px 10px 20px;
           87  +    margin: 0;
           88  +}
           89  +
           90  +h2 {
           91  +    background-color: #3f3f3f;
           92  +    padding: 0px 0px 0px 0px;
           93  +}
           94  +
           95  +a {
           96  +    text-decoration: none;
           97  +}
           98  +
           99  +a:link {
          100  +    color: #8CD0D3;
          101  +}
          102  +
          103  +a:visited {
          104  +    color: #CC9393;
          105  +}
          106  +
          107  +a:hover {
          108  +    color: #DC8CC3;
          109  +}
          110  +
          111  +ul {
          112  +    list-style-type: none;
          113  +}
          114  +
          115  +li {
          116  +    color: #DCDCCC;
          117  +}
          118  +
          119  +nav {
          120  +    background-color: #2B2B2B;
          121  +    margin: 0; padding: 0;
          122  +}
          123  +
          124  +#navmenu ol {
          125  +    margin: 0; padding: 0;
          126  +    list-style-type: none; list-style-image: none;
          127  +}
          128  +
          129  +#navmenu li {
          130  +    display: inline;
          131  +    padding: 5px 20px 5px 20px;
          132  +    margin: 4px;
          133  +}
          134  +
          135  +footer {
          136  +    background-color: #2B2B2B;
          137  +}
          138  +
          139  +#copyright ol {
          140  +    margin: 0; padding: 0;
          141  +    list-style-type: none; list-style-image: none;
          142  +}
          143  +
          144  +#copyright li {
          145  +    display: inline;
          146  +    padding: 5px 20px 5px 20px;
          147  +    margin: 4px;
          148  +}
          149  +
          150  +pre {
          151  +    font-family: monospace, Courier;
          152  +    font-size: smaller;
          153  +    background: #4f4f4f;
          154  +}
          155  +
          156  +code {
          157  +    font-family: monospace, Courier;
          158  +    font-size: smaller;
          159  +    background: #4f4f4f;
          160  +}
          161  +
          162  +
          163  +/* ==========================================================================
          164  +   Media Queries
          165  +   ========================================================================== */
          166  +
          167  +@media only screen and (min-width: 35em) {
          168  +
          169  +}
          170  +
          171  +@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
          172  +       only screen and (min-resolution: 144dpi) {
          173  +
          174  +}
          175  +
          176  +/* ==========================================================================
          177  +   Helper classes
          178  +   ========================================================================== */
          179  +
          180  +.ir {
          181  +    background-color: transparent;
          182  +    border: 0;
          183  +    overflow: hidden;
          184  +    *text-indent: -9999px;
          185  +}
          186  +
          187  +.ir:before {
          188  +    content: "";
          189  +    display: block;
          190  +    width: 0;
          191  +    height: 100%;
          192  +}
          193  +
          194  +.hidden {
          195  +    display: none !important;
          196  +    visibility: hidden;
          197  +}
          198  +
          199  +.visuallyhidden {
          200  +    border: 0;
          201  +    clip: rect(0 0 0 0);
          202  +    height: 1px;
          203  +    margin: -1px;
          204  +    overflow: hidden;
          205  +    padding: 0;
          206  +    position: absolute;
          207  +    width: 1px;
          208  +}
          209  +
          210  +.visuallyhidden.focusable:active,
          211  +.visuallyhidden.focusable:focus {
          212  +    clip: auto;
          213  +    height: auto;
          214  +    margin: 0;
          215  +    overflow: visible;
          216  +    position: static;
          217  +    width: auto;
          218  +}
          219  +
          220  +.invisible {
          221  +    visibility: hidden;
          222  +}
          223  +
          224  +.clearfix:before,
          225  +.clearfix:after {
          226  +    content: " ";
          227  +    display: table;
          228  +}
          229  +
          230  +.clearfix:after {
          231  +    clear: both;
          232  +}
          233  +
          234  +.clearfix {
          235  +    *zoom: 1;
          236  +}
          237  +
          238  +/* ==========================================================================
          239  +   Print styles
          240  +   ========================================================================== */
          241  +
          242  +@media print {
          243  +    * {
          244  +        background: transparent !important;
          245  +        color: #000 !important; /* Black prints faster: h5bp.com/s */
          246  +        box-shadow:none !important;
          247  +        text-shadow: none !important;
          248  +    }
          249  +
          250  +    a,
          251  +    a:visited {
          252  +        text-decoration: underline;
          253  +    }
          254  +
          255  +    a[href]:after {
          256  +        content: " (" attr(href) ")";
          257  +    }
          258  +
          259  +    abbr[title]:after {
          260  +        content: " (" attr(title) ")";
          261  +    }
          262  +
          263  +    /*
          264  +     * Don't show links for images, or javascript/internal links
          265  +     */
          266  +
          267  +    .ir a:after,
          268  +    a[href^="javascript:"]:after,
          269  +    a[href^="#"]:after {
          270  +        content: "";
          271  +    }
          272  +
          273  +    pre,
          274  +    blockquote {
          275  +        border: 1px solid #999;
          276  +        page-break-inside: avoid;
          277  +    }
          278  +
          279  +    thead {
          280  +        display: table-header-group; /* h5bp.com/t */
          281  +    }
          282  +
          283  +    tr,
          284  +    img {
          285  +        page-break-inside: avoid;
          286  +    }
          287  +
          288  +    img {
          289  +        max-width: 100% !important;
          290  +    }
          291  +
          292  +    @page {
          293  +        margin: 0.5cm;
          294  +    }
          295  +
          296  +    p,
          297  +    h2,
          298  +    h3 {
          299  +        orphans: 3;
          300  +        widows: 3;
          301  +    }
          302  +
          303  +    h2,
          304  +    h3 {
          305  +        page-break-after: avoid;
          306  +    }
          307  +}

Added src/css/normalize.css.

            1  +/*! normalize.css v1.0.1 | MIT License | git.io/normalize */
            2  +
            3  +/* ==========================================================================
            4  +   HTML5 display definitions
            5  +   ========================================================================== */
            6  +
            7  +/*
            8  + * Corrects `block` display not defined in IE 6/7/8/9 and Firefox 3.
            9  + */
           10  +
           11  +article,
           12  +aside,
           13  +details,
           14  +figcaption,
           15  +figure,
           16  +footer,
           17  +header,
           18  +hgroup,
           19  +nav,
           20  +section,
           21  +summary {
           22  +    display: block;
           23  +}
           24  +
           25  +/*
           26  + * Corrects `inline-block` display not defined in IE 6/7/8/9 and Firefox 3.
           27  + */
           28  +
           29  +audio,
           30  +canvas,
           31  +video {
           32  +    display: inline-block;
           33  +    *display: inline;
           34  +    *zoom: 1;
           35  +}
           36  +
           37  +/*
           38  + * Prevents modern browsers from displaying `audio` without controls.
           39  + * Remove excess height in iOS 5 devices.
           40  + */
           41  +
           42  +audio:not([controls]) {
           43  +    display: none;
           44  +    height: 0;
           45  +}
           46  +
           47  +/*
           48  + * Addresses styling for `hidden` attribute not present in IE 7/8/9, Firefox 3,
           49  + * and Safari 4.
           50  + * Known issue: no IE 6 support.
           51  + */
           52  +
           53  +[hidden] {
           54  +    display: none;
           55  +}
           56  +
           57  +/* ==========================================================================
           58  +   Base
           59  +   ========================================================================== */
           60  +
           61  +/*
           62  + * 1. Corrects text resizing oddly in IE 6/7 when body `font-size` is set using
           63  + *    `em` units.
           64  + * 2. Prevents iOS text size adjust after orientation change, without disabling
           65  + *    user zoom.
           66  + */
           67  +
           68  +html {
           69  +    font-size: 100%; /* 1 */
           70  +    -webkit-text-size-adjust: 100%; /* 2 */
           71  +    -ms-text-size-adjust: 100%; /* 2 */
           72  +}
           73  +
           74  +/*
           75  + * Addresses `font-family` inconsistency between `textarea` and other form
           76  + * elements.
           77  + */
           78  +
           79  +html,
           80  +button,
           81  +input,
           82  +select,
           83  +textarea {
           84  +    font-family: sans-serif;
           85  +}
           86  +
           87  +/*
           88  + * Addresses margins handled incorrectly in IE 6/7.
           89  + */
           90  +
           91  +body {
           92  +    margin: 0;
           93  +}
           94  +
           95  +/* ==========================================================================
           96  +   Links
           97  +   ========================================================================== */
           98  +
           99  +/*
          100  + * Addresses `outline` inconsistency between Chrome and other browsers.
          101  + */
          102  +
          103  +a:focus {
          104  +    outline: thin dotted;
          105  +}
          106  +
          107  +/*
          108  + * Improves readability when focused and also mouse hovered in all browsers.
          109  + */
          110  +
          111  +a:active,
          112  +a:hover {
          113  +    outline: 0;
          114  +}
          115  +
          116  +/* ==========================================================================
          117  +   Typography
          118  +   ========================================================================== */
          119  +
          120  +/*
          121  + * Addresses font sizes and margins set differently in IE 6/7.
          122  + * Addresses font sizes within `section` and `article` in Firefox 4+, Safari 5,
          123  + * and Chrome.
          124  + */
          125  +
          126  +h1 {
          127  +    font-size: 2em;
          128  +    margin: 0.67em 0;
          129  +}
          130  +
          131  +h2 {
          132  +    font-size: 1.5em;
          133  +    margin: 0.83em 0;
          134  +}
          135  +
          136  +h3 {
          137  +    font-size: 1.17em;
          138  +    margin: 1em 0;
          139  +}
          140  +
          141  +h4 {
          142  +    font-size: 1em;
          143  +    margin: 1.33em 0;
          144  +}
          145  +
          146  +h5 {
          147  +    font-size: 0.83em;
          148  +    margin: 1.67em 0;
          149  +}
          150  +
          151  +h6 {
          152  +    font-size: 0.75em;
          153  +    margin: 2.33em 0;
          154  +}
          155  +
          156  +/*
          157  + * Addresses styling not present in IE 7/8/9, Safari 5, and Chrome.
          158  + */
          159  +
          160  +abbr[title] {
          161  +    border-bottom: 1px dotted;
          162  +}
          163  +
          164  +/*
          165  + * Addresses style set to `bolder` in Firefox 3+, Safari 4/5, and Chrome.
          166  + */
          167  +
          168  +b,
          169  +strong {
          170  +    font-weight: bold;
          171  +}
          172  +
          173  +blockquote {
          174  +    margin: 1em 40px;
          175  +}
          176  +
          177  +/*
          178  + * Addresses styling not present in Safari 5 and Chrome.
          179  + */
          180  +
          181  +dfn {
          182  +    font-style: italic;
          183  +}
          184  +
          185  +/*
          186  + * Addresses styling not present in IE 6/7/8/9.
          187  + */
          188  +
          189  +mark {
          190  +    background: #ff0;
          191  +    color: #000;
          192  +}
          193  +
          194  +/*
          195  + * Addresses margins set differently in IE 6/7.
          196  + */
          197  +
          198  +p,
          199  +pre {
          200  +    margin: 1em 0;
          201  +}
          202  +
          203  +/*
          204  + * Corrects font family set oddly in IE 6, Safari 4/5, and Chrome.
          205  + */
          206  +
          207  +code,
          208  +kbd,
          209  +pre,
          210  +samp {
          211  +    font-family: monospace, serif;
          212  +    _font-family: 'courier new', monospace;
          213  +    font-size: 1em;
          214  +}
          215  +
          216  +/*
          217  + * Improves readability of pre-formatted text in all browsers.
          218  + */
          219  +
          220  +pre {
          221  +    white-space: pre;
          222  +    white-space: pre-wrap;
          223  +    word-wrap: break-word;
          224  +}
          225  +
          226  +/*
          227  + * Addresses CSS quotes not supported in IE 6/7.
          228  + */
          229  +
          230  +q {
          231  +    quotes: none;
          232  +}
          233  +
          234  +/*
          235  + * Addresses `quotes` property not supported in Safari 4.
          236  + */
          237  +
          238  +q:before,
          239  +q:after {
          240  +    content: '';
          241  +    content: none;
          242  +}
          243  +
          244  +/*
          245  + * Addresses inconsistent and variable font size in all browsers.
          246  + */
          247  +
          248  +small {
          249  +    font-size: 80%;
          250  +}
          251  +
          252  +/*
          253  + * Prevents `sub` and `sup` affecting `line-height` in all browsers.
          254  + */
          255  +
          256  +sub,
          257  +sup {
          258  +    font-size: 75%;
          259  +    line-height: 0;
          260  +    position: relative;
          261  +    vertical-align: baseline;
          262  +}
          263  +
          264  +sup {
          265  +    top: -0.5em;
          266  +}
          267  +
          268  +sub {
          269  +    bottom: -0.25em;
          270  +}
          271  +
          272  +/* ==========================================================================
          273  +   Lists
          274  +   ========================================================================== */
          275  +
          276  +/*
          277  + * Addresses margins set differently in IE 6/7.
          278  + */
          279  +
          280  +dl,
          281  +menu,
          282  +ol,
          283  +ul {
          284  +    margin: 1em 0;
          285  +}
          286  +
          287  +dd {
          288  +    margin: 0 0 0 40px;
          289  +}
          290  +
          291  +/*
          292  + * Addresses paddings set differently in IE 6/7.
          293  + */
          294  +
          295  +menu,
          296  +ol,
          297  +ul {
          298  +    padding: 0 0 0 40px;
          299  +}
          300  +
          301  +/*
          302  + * Corrects list images handled incorrectly in IE 7.
          303  + */
          304  +
          305  +nav ul,
          306  +nav ol {
          307  +    list-style: none;
          308  +    list-style-image: none;
          309  +}
          310  +
          311  +/* ==========================================================================
          312  +   Embedded content
          313  +   ========================================================================== */
          314  +
          315  +/*
          316  + * 1. Removes border when inside `a` element in IE 6/7/8/9 and Firefox 3.
          317  + * 2. Improves image quality when scaled in IE 7.
          318  + */
          319  +
          320  +img {
          321  +    border: 0; /* 1 */
          322  +    -ms-interpolation-mode: bicubic; /* 2 */
          323  +}
          324  +
          325  +/*
          326  + * Corrects overflow displayed oddly in IE 9.
          327  + */
          328  +
          329  +svg:not(:root) {
          330  +    overflow: hidden;
          331  +}
          332  +
          333  +/* ==========================================================================
          334  +   Figures
          335  +   ========================================================================== */
          336  +
          337  +/*
          338  + * Addresses margin not present in IE 6/7/8/9, Safari 5, and Opera 11.
          339  + */
          340  +
          341  +figure {
          342  +    margin: 0;
          343  +}
          344  +
          345  +/* ==========================================================================
          346  +   Forms
          347  +   ========================================================================== */
          348  +
          349  +/*
          350  + * Corrects margin displayed oddly in IE 6/7.
          351  + */
          352  +
          353  +form {
          354  +    margin: 0;
          355  +}
          356  +
          357  +/*
          358  + * Define consistent border, margin, and padding.
          359  + */
          360  +
          361  +fieldset {
          362  +    border: 1px solid #c0c0c0;
          363  +    margin: 0 2px;
          364  +    padding: 0.35em 0.625em 0.75em;
          365  +}
          366  +
          367  +/*
          368  + * 1. Corrects color not being inherited in IE 6/7/8/9.
          369  + * 2. Corrects text not wrapping in Firefox 3.
          370  + * 3. Corrects alignment displayed oddly in IE 6/7.
          371  + */
          372  +
          373  +legend {
          374  +    border: 0; /* 1 */
          375  +    padding: 0;
          376  +    white-space: normal; /* 2 */
          377  +    *margin-left: -7px; /* 3 */
          378  +}
          379  +
          380  +/*
          381  + * 1. Corrects font size not being inherited in all browsers.
          382  + * 2. Addresses margins set differently in IE 6/7, Firefox 3+, Safari 5,
          383  + *    and Chrome.
          384  + * 3. Improves appearance and consistency in all browsers.
          385  + */
          386  +
          387  +button,
          388  +input,
          389  +select,
          390  +textarea {
          391  +    font-size: 100%; /* 1 */
          392  +    margin: 0; /* 2 */
          393  +    vertical-align: baseline; /* 3 */
          394  +    *vertical-align: middle; /* 3 */
          395  +}
          396  +
          397  +/*
          398  + * Addresses Firefox 3+ setting `line-height` on `input` using `!important` in
          399  + * the UA stylesheet.
          400  + */
          401  +
          402  +button,
          403  +input {
          404  +    line-height: normal;
          405  +}
          406  +
          407  +/*
          408  + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
          409  + *    and `video` controls.
          410  + * 2. Corrects inability to style clickable `input` types in iOS.
          411  + * 3. Improves usability and consistency of cursor style between image-type
          412  + *    `input` and others.
          413  + * 4. Removes inner spacing in IE 7 without affecting normal text inputs.
          414  + *    Known issue: inner spacing remains in IE 6.
          415  + */
          416  +
          417  +button,
          418  +html input[type="button"], /* 1 */
          419  +input[type="reset"],
          420  +input[type="submit"] {
          421  +    -webkit-appearance: button; /* 2 */
          422  +    cursor: pointer; /* 3 */
          423  +    *overflow: visible;  /* 4 */
          424  +}
          425  +
          426  +/*
          427  + * Re-set default cursor for disabled elements.
          428  + */
          429  +
          430  +button[disabled],
          431  +input[disabled] {
          432  +    cursor: default;
          433  +}
          434  +
          435  +/*
          436  + * 1. Addresses box sizing set to content-box in IE 8/9.
          437  + * 2. Removes excess padding in IE 8/9.
          438  + * 3. Removes excess padding in IE 7.
          439  + *    Known issue: excess padding remains in IE 6.
          440  + */
          441  +
          442  +input[type="checkbox"],
          443  +input[type="radio"] {
          444  +    box-sizing: border-box; /* 1 */
          445  +    padding: 0; /* 2 */
          446  +    *height: 13px; /* 3 */
          447  +    *width: 13px; /* 3 */
          448  +}
          449  +
          450  +/*
          451  + * 1. Addresses `appearance` set to `searchfield` in Safari 5 and Chrome.
          452  + * 2. Addresses `box-sizing` set to `border-box` in Safari 5 and Chrome
          453  + *    (include `-moz` to future-proof).
          454  + */
          455  +
          456  +input[type="search"] {
          457  +    -webkit-appearance: textfield; /* 1 */
          458  +    -moz-box-sizing: content-box;
          459  +    -webkit-box-sizing: content-box; /* 2 */
          460  +    box-sizing: content-box;
          461  +}
          462  +
          463  +/*
          464  + * Removes inner padding and search cancel button in Safari 5 and Chrome
          465  + * on OS X.
          466  + */
          467  +
          468  +input[type="search"]::-webkit-search-cancel-button,
          469  +input[type="search"]::-webkit-search-decoration {
          470  +    -webkit-appearance: none;
          471  +}
          472  +
          473  +/*
          474  + * Removes inner padding and border in Firefox 3+.
          475  + */
          476  +
          477  +button::-moz-focus-inner,
          478  +input::-moz-focus-inner {
          479  +    border: 0;
          480  +    padding: 0;
          481  +}
          482  +
          483  +/*
          484  + * 1. Removes default vertical scrollbar in IE 6/7/8/9.
          485  + * 2. Improves readability and alignment in all browsers.
          486  + */
          487  +
          488  +textarea {
          489  +    overflow: auto; /* 1 */
          490  +    vertical-align: top; /* 2 */
          491  +}
          492  +
          493  +/* ==========================================================================
          494  +   Tables
          495  +   ========================================================================== */
          496  +
          497  +/*
          498  + * Remove most spacing between table cells.
          499  + */
          500  +
          501  +table {
          502  +    border-collapse: collapse;
          503  +    border-spacing: 0;
          504  +}

Added src/css/normalize.min.css.

            1  +/*! normalize.css v1.0.1 | MIT License | git.io/normalize */
            2  +article,aside,details,figcaption,figure,footer,header,hgroup,nav,section,summary{display:block}
            3  +audio,canvas,video{display:inline-block;*display:inline;*zoom:1}
            4  +audio:not([controls]){display:none;height:0}
            5  +[hidden]{display:none}
            6  +html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}
            7  +html,button,input,select,textarea{font-family:sans-serif}
            8  +body{margin:0}
            9  +a:focus{outline:thin dotted}
           10  +a:active,a:hover{outline:0}
           11  +h1{font-size:2em;margin:.67em 0}
           12  +h2{font-size:1.5em;margin:.83em 0}
           13  +h3{font-size:1.17em;margin:1em 0}
           14  +h4{font-size:1em;margin:1.33em 0}
           15  +h5{font-size:.83em;margin:1.67em 0}
           16  +h6{font-size:.75em;margin:2.33em 0}
           17  +abbr[title]{border-bottom:1px dotted}
           18  +b,strong{font-weight:bold}
           19  +blockquote{margin:1em 40px}
           20  +dfn{font-style:italic}
           21  +mark{background:#ff0;color:#000}
           22  +p,pre{margin:1em 0}
           23  +code,kbd,pre,samp{font-family:monospace,serif;_font-family:'courier new',monospace;font-size:1em}
           24  +pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word}
           25  +q{quotes:none}
           26  +q:before,q:after{content:'';content:none}
           27  +small{font-size:80%}
           28  +sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}
           29  +sup{top:-0.5em}
           30  +sub{bottom:-0.25em}
           31  +dl,menu,ol,ul{margin:1em 0}
           32  +dd{margin:0 0 0 40px}
           33  +menu,ol,ul{padding:0 0 0 40px}
           34  +nav ul,nav ol{list-style:none;list-style-image:none}
           35  +img{border:0;-ms-interpolation-mode:bicubic}
           36  +svg:not(:root){overflow:hidden}
           37  +figure{margin:0}
           38  +form{margin:0}
           39  +fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:.35em .625em .75em}
           40  +legend{border:0;padding:0;white-space:normal;*margin-left:-7px}
           41  +button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}
           42  +button,input{line-height:normal}
           43  +button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;*overflow:visible}
           44  +button[disabled],input[disabled]{cursor:default}
           45  +input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;*height:13px;*width:13px}
           46  +input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}
           47  +input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}
           48  +button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}
           49  +textarea{overflow:auto;vertical-align:top}
           50  +table{border-collapse:collapse;border-spacing:0}

Added src/css/screen.css.

            1  +body {
            2  +    color: #DCDCCC;
            3  +    background-color: #3F3F3F;
            4  +}
            5  +
            6  +h1 {
            7  +    color: #DCDCCC;
            8  +    background-color: #7F9F7F;
            9  +}
           10  +
           11  +a {
           12  +    text-decoration: none;
           13  +}
           14  +
           15  +a:link {
           16  +    color: #8CD0D3;
           17  +}
           18  +
           19  +a:visited {
           20  +    color: #CC9393;
           21  +}
           22  +
           23  +a:hover {
           24  +    color: #DC8CC3;
           25  +}
           26  +
           27  +ul {
           28  +    list-style-type: none;
           29  +}
           30  +
           31  +li {
           32  +    color: #DCDCCC;
           33  +}
           34  +
           35  +nav {
           36  +    background-color: #2B2B2B;
           37  +}
           38  +
           39  +#navmenu ol {
           40  +    margin: 0; padding: 0;
           41  +    list-style-type: none; list-style-image: none;
           42  +}
           43  +
           44  +#navmenu li {
           45  +    display: inline;
           46  +    padding: 5px 20px 5px 20px;
           47  +    margin: 4px;
           48  +}

Added src/index.md.m4.

            1  +m4_dnl	Define a macro that will be expanded in the HTML template.
            2  +TITLE({"m4-bloggery demo"})
            3  +
            4  +BODY({"{"Yes!
            5  +"}"})

Added src/news/2013-02-19-example-post.md.m4.

            1  +TITLE({"example post"})
            2  +DATE({"2013-02-19 17:57"})
            3  +TAGS({"Example"})
            4  +
            5  +BODY({"{"
            6  +Here's an example post.
            7  +"}"}

Added templates/atom.xml.m4.

            1  +m4_divert<?xml version="1.0" encoding="utf-8"?>
            2  +<feed xmlns="http://www.w3.org/2005/Atom">
            3  +
            4  +  <title><![CDATA[__SITE_TITLE]]></title>
            5  +  <link href="__ROOT/atom.xml" rel="self"/>
            6  +  <link href="__ROOT/"/>
            7  +  <updated>m4_esyscmd(date +"%Y-%m-%d %H:%M")</updated>
            8  +  <id>__ROOT/</id>
            9  +  <author>
           10  +    <name><![CDATA[__AUTHOR]]></name>
           11  +    <email><![CDATA[__EMAIL]]></email>
           12  +  </author>
           13  +  <generator uri="https://github.com/datagrok/m4-bakery/">m4-bakery</generator>

Added templates/atom_entry.xml.m4.

            1  +m4_divert(1)
            2  +  <entry>
            3  +    <title type="html"><![CDATA[__TITLE]]></title>
            4  +    <link href="__ROOT/__URL"/>
            5  +    <updated>__DATE</updated>
            6  +    <id>__ROOT/__URL</id>
            7  +    <content type="html"><![CDATA[<p>__BODY</p>]]></content>
            8  +  </entry>

Added templates/blog.html.m4.

            1  +m4_divert(1)m4_dnl
            2  +<div class="blog-index">
            3  +    [m4_ifdef({"__DATE"}, __DATE, {"m4_dnl"})] <a href="__URL">__TITLE</a> 
            4  +</div>

Added templates/main.html.m4.

            1  +m4_divert m4_dnl
            2  +<!DOCTYPE html>
            3  +m4_ifdef({"__ROOT"},, {"m4_define({"__ROOT"}, {""})"})m4_dnl
            4  +<html class="no-js">
            5  +    <head>
            6  +        <meta charset="utf-8">
            7  +        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
            8  +        <title>__TITLE</title>
            9  +        <meta name="description" content="Adaptation, Algorithms and
           10  +					  Ambience">
           11  +	<meta name="author" content="Brandon Invergo">
           12  +	<meta name="Copyright" content="Copyright Brandon Invergo
           13  +					2012. All Rights Reserved.">
           14  +        <meta name="viewport" content="width=device-width">
           15  +
           16  +        <link rel="stylesheet" href="__ROOT/css/normalize.min.css">
           17  +        <link rel="stylesheet" href="__ROOT/css/main.css">
           18  +    </head>
           19  +    <body>
           20  +      <header role="banner">
           21  +	<hgroup>
           22  +	  <h1>__SITE_TITLE</h1>
           23  +<!--	  <h2>__SITE_SUBTITLE</h2> -->
           24  +	</hgroup>
           25  +      </header>
           26  +      <nav>
           27  +	<ol id="navmenu">
           28  +          <li><a href="__ROOT/index.html">Home</a></li>
           29  +          <li><a href="__ROOT/news/index.html">News</a></li>
           30  +          <li><a href="__ROOT/CV/index.html">CV</a></li>
           31  +          <li><a href="__ROOT/software/index.html">Software</a></li>
           32  +          <li><a href="__ROOT/music/index.html">Music</a></li>
           33  +          <li><a href="__ROOT/links/index.html">Links</a></li>
           34  +	  <li><a href="__ROOT/contact/index.html">Contact</a></li>
           35  +	  <li><a href="__ROOT/atom.xml">Feed</a></li>
           36  +        </ol>
           37  +      </nav>
           38  +      <div id="main">
           39  +	<div id="content">
           40  +m4_dnl
           41  +m4_divert(4)m4_dnl  --- Content will be placed here ---
           42  +m4_dnl
           43  +	</div>
           44  +      </div>
           45  +      <footer>
           46  +	<ol id="copyright">
           47  +	  <li>Copyright 2013 Brandon Invergo</li>
           48  +	  <li>Built with
           49  +	    <a href="https://github.com/datagrok/m4-bakery">m4-bakery</a>
           50  +	  </li>
           51  +	  <li>Last update m4_esyscmd(date +"%Y-%m-%d %H:%M")</li>
           52  +	</ol>
           53  +      </footer>
           54  +    </body>
           55  +</html>

Added templates/new_post.md.m4.

            1  +`TITLE'({"TITLE"})
            2  +DATE({"m4_translit(m4_esyscmd(date "+%Y-%m-%d %H:%M"), `
            3  +', `')"})
            4  +TAGS({""})
            5  +
            6  +BODY({"{"
            7  +
            8  +"}"}

Added templates/page.html.m4.

            1  +m4_divert(1) m4_dnl
            2  +         <div>
            3  +	   <article>
            4  +	   <h2 class="entry-title">__TITLE</h2>
            5  +	   __BODY
            6  +m4_dnl
            7  +m4_dnl m4_divert(3) m4_dnl
            8  +m4_dnl
            9  +             <footer>
           10  +	       <p id="meta">
           11  +		 m4_ifdef({"__DATE"}, {"Created: __DATE"}, {"m4_dnl"})
           12  +		 m4_ifdef({"__UPDATE"}, {"Updated: __UPDATE"}, {"m4_dnl"})
           13  +	       </p>
           14  +	     </footer>
           15  +	   </article>
           16  +	 </div>

Added templates/post.html.m4.

            1  +m4_divert(1) m4_dnl
            2  +         <div>
            3  +	   <header>
            4  +	     <h2 class="entry-title">__TITLE</h1>
            5  +	   </header>
            6  +	   <article>
            7  +	   __BODY
            8  +             <footer>
            9  +	       <p id="meta">
           10  +		 m4_ifdef({"__DATE"}, {"Created: __DATE"}, {"m4_dnl"})
           11  +		 m4_ifdef({"__UPDATE"}, {"Updated: __UPDATE"}, {"m4_dnl"})
           12  +		 <br />
           13  +		 m4_ifdef({"__TAGS"}, {"Tags: __TAGS"}, {"m4_dnl"})
           14  +	       </p>
           15  +	     </footer>
           16  +	   </article>
           17  +	 </div>