Skip to content

Instantly share code, notes, and snippets.

@robotlolita
Created February 12, 2011 13:49
Show Gist options
  • Save robotlolita/823778 to your computer and use it in GitHub Desktop.
Save robotlolita/823778 to your computer and use it in GitHub Desktop.
Current syntax for Elegance...
uses html ;; imports html tags
define text-processor "markdown" ;; filters all text literals through markdown
;; Defines some abstract blocks for DRY
block site-header
title "Elegance"
subtitle "makes writing webpages less painful"
when rendered
hgroup#top
h1 title
h2 '—{subtitle}
;; Navigation bar
block site-nav
links ("Home"
"Blog"
"About"
"Contact")
when render-links
ul
for text in links
li
a :href "/section/{text|lower|slugify}" 'text
when rendered
nav#main-nav
render-links
;; Footer (inherits links from site navigation)
block site-footer < site-nav
info "We've got Elegance"
when rendered
footer#page-footer
div.left
super render-links
div.right
p info
;; Actual page (blocks above should go on a separate file, shared by all pages)
meta :title "Elegance" \
:desc "Makes writing webpages less painful"
body
site-header
site-nav :links +("Feed")
section#content
article '## 'Ello thar
Elegance should help
you to stop repeating
yourself so much when
writing a webpage.
Plus, you don't have
to go through the **pain**
of handwriting HTML/SGML/XML :3
site-footer
;; Would be rendered as this::
;; <!DOCTYPE html>
;; <html>
;; <head>
;; <title>Elegance</title>
;; <meta name="description" content="Makes writing webpages less painful">
;; </head>
;; <body>
;; <hgroup>
;; <h1>:Elegance</h1>
;; <h2>—Makes writing webpages less painful</h2>
;; </hgroup>
;; <nav id="main-nav">
;; <ul>
;; <li><a href="/section/home">Home</a></li>
;; <li><a href="/section/blog">Blog</a></li>
;; <li><a href="/section/about">About</a></li>
;; <li><a href="/section/contact">Contact</a></li>
;; <li><a href="/section/feed">Feed</a></li>
;; </ul>
;; </nav>
;; <section id="content">
;; <article>
;; <h2>'Ello thar</h2>
;; <p>Elegance should help
;; you to stop repeating
;; yourself so much when
;; writing a webpage.</p>
;; <p>Plus, you don't have
;; to go through the <strong>pain</strong>
;; of handwriting HTML/SGML/XML :3</p>
;; </article>
;; </section>
;; <footer id="page-footer">
;; <div class="left">
;; <ul>
;; <li><a href="/section/home">Home</a></li>
;; <li><a href="/section/blog">Blog</a></li>
;; <li><a href="/section/about">About</a></li>
;; <li><a href="/section/contact">Contact</a></li>
;; <li><a href="/section/feed">Feed</a></li>
;; </ul>
;; </div>
;; <div class="right">
;; <p>We've got elegance</p>
;; </div>
;; </footer>
;; </body>
;; </html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment