From 5872db2bfe73e38697c969d2c5aaef6e1d6bc577 Mon Sep 17 00:00:00 2001 From: accraze Date: Mon, 2 Nov 2015 11:02:41 -0800 Subject: [PATCH 1/3] docs: updated with installation and basic usage info --- README.md | 51 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7d88b84..7adf255 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,67 @@ minima: noSQL + noHTML + noJS ============================= -Traditional web frameworks comprise of an ORM layer over a DB, a templating engine and some +Traditional web frameworks comprise of an ORM layer over a DB, a templating engine and some HTTP dispatcher and session management. In my view, the first two are relics of the past and we can (and should) do without them, and the third should be greatly improved. Luckily, modern minimalist frameworks like ``flask`` get us closer to that, but there's still way to go. +--> [Installation](#Install) +--> [Basic Useage](#Useage) + The Vision: Snakes all the Way Down! ------------------------------------ -* Websites should be service-oriented, exposing APIs instead of generating HTML pages +* Websites should be service-oriented, exposing APIs instead of generating HTML pages on the fly. JSON API calls everywhere, by default. * Templating is a stupid thing: it's basically very limited, cumbersome, and impossible-to-debug form of function application. A template takes parameters and generates HTML: it's a function! * An HTTP server is ultimately a degenerate form of Remote Procedure Call (RPC) - it dispatches function names (URLs) to concrete functions, extracts parameters, and generally alleviates - your code from the mess that is HTTP. It's time to realize it and think about it the way it + your code from the mess that is HTTP. It's time to realize it and think about it the way it realy is. * HTML is too low-level for us to mess with; we ought to be talking at a much more semantic level, that renders itself as HTML plus the required JavaScript. -* JavaScript is a horrible language and we should strive to avoid any contact with it. We do this +* JavaScript is a horrible language and we should strive to avoid any contact with it. We do this by putting as much of it as possible into the framework. Semantic elements may generate their appropriate JavaScript when they render themselves to HTML, but the product should be pure. * ORM and SQL suck. A document-oriented database (e.g., *mongo*) would normally prove the better choice (unless you need really complex queries): if you choose to work in a dynamic language, - why would you work with a static DB schema? + why would you work with a static DB schema? -Web programming involves too many unrelated technologies that were stacked one on top of the other -over the years (HTTP, HTML, JavaScript/CoffeeScript, CSS/Sass, JSON, AJAX, SQL, templating, CGI, -...). The purpose of minima is to reduce that mess to pure Python, as far down as we can go, +Web programming involves too many unrelated technologies that were stacked one on top of the other +over the years (HTTP, HTML, JavaScript/CoffeeScript, CSS/Sass, JSON, AJAX, SQL, templating, CGI, +...). The purpose of minima is to reduce that mess to pure Python, as far down as we can go, given that these technologies are here to stay. + +### Install +`pip install minima` + +### Useage +#### Hypertext +Write 'HTML Functions' using a simple **DSL** within Python. + +```python +>>> import minima.hypertext as H + +>>> print H.h1("Welcome", class_="highlight", id="foo") +

Welcome

+ +>>> print H.h1.highlight("Welcome", id="foo") +

Welcome

+ +>>> print H.div.content(h1.highlight("Welcome"), "This is my page") +
+

Welcome

+ This is my page +
+ +>>> with div.content: +... h1.highlight("Welcome") +... TEXT("This is my page") +... +
+

Welcome

+ This is my page +
+``` From 4339f0470a277adc01bcf88a6f7ea50360d373a1 Mon Sep 17 00:00:00 2001 From: accraze Date: Mon, 2 Nov 2015 11:08:32 -0800 Subject: [PATCH 2/3] hygiene --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7adf255..6f09b77 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,9 @@ HTTP dispatcher and session management. In my view, the first two are relics of we can (and should) do without them, and the third should be greatly improved. Luckily, modern minimalist frameworks like ``flask`` get us closer to that, but there's still way to go. ---> [Installation](#Install) ---> [Basic Useage](#Useage) +--> [Installation](#install) + +--> [Basic Useage](#useage) The Vision: Snakes all the Way Down! ------------------------------------ @@ -41,7 +42,7 @@ given that these technologies are here to stay. #### Hypertext Write 'HTML Functions' using a simple **DSL** within Python. -```python +``` >>> import minima.hypertext as H >>> print H.h1("Welcome", class_="highlight", id="foo") From c20252668cdac1b05a1ccaa52b72d565be38dd2e Mon Sep 17 00:00:00 2001 From: accraze Date: Mon, 2 Nov 2015 11:24:04 -0800 Subject: [PATCH 3/3] formatting also added a bit more info to the basic usage section --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6f09b77..7e9f38d 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,11 @@ HTTP dispatcher and session management. In my view, the first two are relics of we can (and should) do without them, and the third should be greatly improved. Luckily, modern minimalist frameworks like ``flask`` get us closer to that, but there's still way to go. ---> [Installation](#install) +* [The Vision](#the-vision-snakes-all-the-way-down) ---> [Basic Useage](#useage) +* [Installation](#install) + +* [Basic Useage](#useage) The Vision: Snakes all the Way Down! ------------------------------------ @@ -36,11 +38,13 @@ over the years (HTTP, HTML, JavaScript/CoffeeScript, CSS/Sass, JSON, AJAX, SQL, given that these technologies are here to stay. ### Install -`pip install minima` +``` +$ pip install minima +``` ### Useage #### Hypertext -Write 'HTML Functions' using a simple **DSL** within Python. +Write 'HTML Functions' using a simple **DSL** within Python. Add elements and classes using dot notation. Create nested elements using `with`. ``` >>> import minima.hypertext as H