Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

23
Pamela bringing back the pleasure of hand-written HTML Sébastien Pierre, Datalicious @Montréal Python 8, Jul. 2009 www.datalicious.ca | github.com/sebastien/pamela

description

Pamela allows you to write HTML faster by provider a CSS-savvy Python-inspired syntax that will reduce the risk of errors and make you more productive !

Transcript of Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

Page 1: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

Pamelabringing back the pleasure

of hand-written HTML

Sébastien Pierre, Datalicious@Montréal Python 8, Jul. 2009

www.datalicious.ca | github.com/sebastien/pamela

Page 2: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

Less

Is

More

Page 3: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

Less Typing

Is

More Thinking(and faster prototyping)

Page 4: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

As designers

we need to turn an idea

into a prototype

FAST !

Page 5: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

Plain HTML

Too Many Typos

with

Big documents

Page 6: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

Plain HTML

Too Much Typing

with

Modern HTML

Page 7: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

Modern HTML

<html> <body> <h1>My First HTML Page<h1> Hello, World ! </body></html>

<html> <body> <div class="section"> <div class="header"> <h1 class="title">My First HTML Page</h1> </div> <div class="content"> Hello, World ! </div> </div> </body></html>

Page 8: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

Modern HTML

<html> <body> <h1>My First HTML Page<h1> Hello, World ! </body></html>

<html> <body> <div class="section"> <div class="header"> <h1 class="title">My First HTML Page</h1> </div> <div class="content"> Hello, World ! </div> </div> </body></html>

We add a lot more<div>s and <span>s

to hook CSS rules

Page 9: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

Modern HTML

<html> <body> <h1>My First HTML Page<h1> Hello, World ! </body></html>

<html> <body> <div class="section"> <div class="header"> <h1 class="title">My First HTML Page</h1> </div> <div class="content"> Hello, World ! </div> </div> </body></html>

Which meansmore chances of

forgetting to closea <div> or <span>

Page 10: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

10

Pamela :

simply syntax sugar for html(not a templating language)

Page 11: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

11

Feature 1: Indentation-based

� Python does it well

� � �No more oops, I forget to close my <div>

<html| <body| | <h1:Pamela : Bringing back the pleasure of hand-written HTML !| | Check out Pamela <a(href=http://github.com/sebastien/pamela):here>

Page 12: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

12

Feature 1: Indentation-based

� Python does it well

� � �No more oops, I forget to close my <div>

Here the Python-style indentation

<html| <body| | <h1:Pamela : Bringing back the pleasure of hand-written HTML !| | Check out Pamela <a(href=http://github.com/sebastien/pamela):here>

Page 13: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

13

Feature 1: Indentation-based

� Python does it well

� � �No more oops, I forget to close my <div>

<html| <body| | <h1:Pamela : Bringing back the pleasure of hand-written HTML !| | Check out Pamela <a(href=http://github.com/sebastien/pamela):here> <a href=http://github.com/sebastien/pamela>here</a>

We use asmall variant

of the HTML element syntax

Page 14: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

14

Feature 1: Indentation-based

� Python does it well

� � �No more oops, I forget to close my <div>

<html| <body| | <h1:Pamela : Bringing back the pleasure of hand-written HTML !| | Check out Pamela <a(href=http://github.com/sebastien/pamela):here> <a href=http://github.com/sebastien/pamela>here</a>

# EOFNo explicit closing needed !

Page 15: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

15

Feature 2 : ID and CSS shorthands

� Classes and IDs used a lot by JS libs �(jQuery, Prototype, )

� We use them a lot with CSS frameworks (Blueprint, 960,...)

<div#content| <div.section| | <h1.title:Pamela : Bringing back the pleasure of hand-written HTML !| | Check out Pamela| | <a#pid.pamela.link(href=http://github.com/sebastien/pamela):here>

Page 16: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

16

Feature 2 : ID and CSS shorthands

� Classes and IDs used a lot by JS libs �(jQuery, Prototype, )

� We use them a lot with CSS frameworks (Blueprint, 960,...)

<div#content| <div.section| | <h1.title:Pamela : Bringing back the pleasure of hand-written HTML !| | Check out Pamela| | <a#pid.pamela.link(href=http://github.com/sebastien/pamela):here>

IDs are denotedas in CSS selectors

#<ID_NAME>

Page 17: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

17

Feature 2 : ID and CSS shorthands

� Classes and IDs used a lot by JS libs �(jQuery, Prototype, )

� We use them a lot with CSS frameworks (Blueprint, 960,...)

<div#content| <div.section| | <h1.title:Pamela : Bringing back the pleasure of hand-written HTML !| | Check out Pamela| | <a#pid.pamela.link(href=http://github.com/sebastien/pamela):here>

Same for classes.<CLASS_NAME>

Page 18: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

18

Feature 2 : ID and CSS shorthands

� Classes and IDs used a lot by JS libs �(jQuery, Prototype, )

� We use them a lot with CSS frameworks (Blueprint, 960,...)

<div#content| <div.section| | <h1.title:Pamela : Bringing back the pleasure of hand-written HTML !| | Check out Pamela| | <a#pid.pamela.link(href=http://github.com/sebastien/pamela):here>

You can mix classes and ID,ID always comes first

Page 19: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

19

Pamela in Practice

Page 20: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

20

Pamela in Practice

Page 21: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

21

Pamela in Practice

Page 22: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

22

Pamela in a Nutshell

Faithful to HTML/CSSSyntax is a variant of HTML, using CSS selector conventions

Less errors, more timePython-style indentation and shorthands make you safer and faster

FlexibleCan be used as a command-line processor or as a Python module

Powerful�Manage whitespace, include files, add variables and more !

Page 23: Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8

The end

Thank you !www.github.com/sebastien/pamela

www.datalicious.ca

[email protected]