Skip to content

Commit

Permalink
added server sample
Browse files Browse the repository at this point in the history
  • Loading branch information
thlorenz committed Sep 4, 2012
1 parent f9b3eee commit 2af1bb8
Show file tree
Hide file tree
Showing 28 changed files with 565 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -6,10 +6,11 @@ lib-cov
*.out
*.pid
*.gz
.DS_Store

pids
logs
results

node_modules
npm-debug.log
npm-debug.log
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -2,7 +2,7 @@

Some introduction to the blog would be here, followed by the gory details.

![nodejs](blog/assets/images/nodejs.png)
![nodejs](assets/images/nodejs.png)

## Inlined snippet

Expand Down
File renamed without changes.
Binary file added examples/blog-site/blog/assets/images/nodejs.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions examples/blog-site/blog/assets/styles/blog.css
@@ -0,0 +1,19 @@
.blog-post p > code {
background: #F0F8F7;
border-radius: 3px;
padding: 2px 5px 2px 5px;
top: -2px;
position: relative;
}

/* block quotes */
.blog-post pre {
font-style: italic;
padding-left: 40px;
}

/* Don't apply above block quote style to code samples */
.blog-post pre .syntaxhighlighter {
font-style: initial;
margin-left: -40px;
}
30 changes: 30 additions & 0 deletions examples/blog-site/blog/assets/styles/code-fixes.css
@@ -0,0 +1,30 @@

.syntaxhighlighter .gutter .line {
border-right: 1px solid rgba(67, 189, 67, 0.26) !important;
padding-left: 5px;
padding-right: 5px;
}

.syntaxhighlighter .gutter {
padding-right: 8px;
}

.syntaxhighlighter {
width: 735px;
border-radius: 8px;
padding-left: 5px;
padding-right: 5px;
padding-top: 20px;
padding-bottom: 20px;
}


.syntaxhighlighter {
background-color: #FAF6DF !important;
}
.syntaxhighlighter .line.alt1 {
background-color: transparent !important;
}
.syntaxhighlighter .line.alt2 {
background-color: transparent !important;
}
101 changes: 101 additions & 0 deletions examples/blog-site/blog/assets/styles/code.css
@@ -0,0 +1,101 @@
.syntaxhighlighter {
background-color: white !important;
}
.syntaxhighlighter .line.alt1 {
background-color: white !important;
}
.syntaxhighlighter .line.alt2 {
background-color: white !important;
}
.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 {
background-color: #e0e0e0 !important;
}
.syntaxhighlighter .line.highlighted.number {
color: black !important;
}
.syntaxhighlighter table caption {
color: black !important;
}
.syntaxhighlighter .gutter {
color: #afafaf !important;
}
.syntaxhighlighter .gutter .line {
border-right: 3px solid #6ce26c !important;
}
.syntaxhighlighter .gutter .line.highlighted {
background-color: #6ce26c !important;
color: white !important;
}
.syntaxhighlighter.printing .line .content {
border: none !important;
}
.syntaxhighlighter.collapsed {
overflow: visible !important;
}
.syntaxhighlighter.collapsed .toolbar {
color: blue !important;
background: white !important;
border: 1px solid #6ce26c !important;
}
.syntaxhighlighter.collapsed .toolbar a {
color: blue !important;
}
.syntaxhighlighter.collapsed .toolbar a:hover {
color: red !important;
}
.syntaxhighlighter .toolbar {
color: white !important;
background: #6ce26c !important;
border: none !important;
}
.syntaxhighlighter .toolbar a {
color: white !important;
}
.syntaxhighlighter .toolbar a:hover {
color: black !important;
}
.syntaxhighlighter .plain, .syntaxhighlighter .plain a {
color: black !important;
}
.syntaxhighlighter .comments, .syntaxhighlighter .comments a {
color: #008200 !important;
}
.syntaxhighlighter .string, .syntaxhighlighter .string a {
color: blue !important;
}
.syntaxhighlighter .keyword {
color: #006699 !important;
}
.syntaxhighlighter .preprocessor {
color: gray !important;
}
.syntaxhighlighter .variable {
color: #aa7700 !important;
}
.syntaxhighlighter .value {
color: #009900 !important;
}
.syntaxhighlighter .functions {
color: #ff1493 !important;
}
.syntaxhighlighter .constants {
color: #0066cc !important;
}
.syntaxhighlighter .script {
font-weight: bold !important;
color: #006699 !important;
background-color: none !important;
}
.syntaxhighlighter .color1, .syntaxhighlighter .color1 a {
color: gray !important;
}
.syntaxhighlighter .color2, .syntaxhighlighter .color2 a {
color: #ff1493 !important;
}
.syntaxhighlighter .color3, .syntaxhighlighter .color3 a {
color: red !important;
}

.syntaxhighlighter .keyword {
font-weight: bold !important;
}
38 changes: 38 additions & 0 deletions examples/blog-site/blog/assets/styles/preview.css
@@ -0,0 +1,38 @@
.blog-post {
margin-left: auto;
margin-right: auto;
width: 750px;
background: #E4FFF3;
padding: 5px 20px 20px 20px;
border-radius: 10px
}

.blog-post h1 {
background: #F3EFCD;
border-top: 1px;
border-left: 1px;
border-right: 1px;
border-bottom: 1px;
border-color: #CAC59D;
border-style: solid;
border-radius: 5px 5px 1px 1px;
padding: 10px;
}

.blog-post h2 {
border-top: 0px;
border-left: 0px;
border-right: 0px;
border-bottom: 1px;
border-color: #B0D4E2;
border-style: solid;
padding-bottom: 8px;
}

.blog-post hr {
margin-left: -20px;
margin-right: -20px;
border-style: solid;
border-color: white;
border-width: 10px;
}
19 changes: 19 additions & 0 deletions examples/blog-site/blog/blog.json
@@ -0,0 +1,19 @@
{
"posts": [
"disclaimer",
"first-post"
],
"tags": [
"blog",
"markdown",
"warning",
"example",
"best-practice"
],
"styles": [
"code",
"code-fixes",
"blog",
"preview"
]
}
11 changes: 11 additions & 0 deletions examples/blog-site/blog/disclaimer/post.json
@@ -0,0 +1,11 @@
{
"created": "2012-09-04T01:10:00.420Z",
"updated": "2012-09-04T01:37:34.098Z",
"tags": [
"warning",
"example",
"best-practice"
],
"name": "disclaimer",
"title": "Disclaimer, Please Read First!"
}
15 changes: 15 additions & 0 deletions examples/blog-site/blog/disclaimer/post.md
@@ -0,0 +1,15 @@
# Disclaimer

Demonstrates how to use the dog provider in order to serve the blog via a website.

Please keep in mind that I favored simplicity over correctness and robustness.

I used shorter (and somewhat naive) implementations and avoided using libraries to let this example stand on its own.

## Improvments needed

The following should be improved if this was to be used for real:

- implement a more robust router or use libraries like director or express
- the server and blog initialization need more robust error handling
- the code should be modularized
10 changes: 10 additions & 0 deletions examples/blog-site/blog/first-post/post.json
@@ -0,0 +1,10 @@
{
"created": "2012-09-03T17:33:04.764Z",
"updated": "2012-09-03T17:33:04.764Z",
"tags": [
"blog",
"markdown"
],
"name": "first-post",
"title": "My First Post"
}
51 changes: 51 additions & 0 deletions examples/blog-site/blog/first-post/post.md
@@ -0,0 +1,51 @@
# Blog Uno

Some introduction to the blog would be here, followed by the gory details.

![nodejs](/blog/assets/images/nodejs.png)

## Inlined snippet

```javascript
var some = 'javascript';
```
The `var` ensures we don't pollute the global space.


## Snippet pulled in

This is some explanation about the snippet to follow.

{{ snippet: simple.js }}

The moral of the snippet here:

- moral one
- another moral

***

## Styles

Certain markdown directives should be recognized.

### Italic

This *should be italic* if it works.

#### *Italic Header*

Amazing what you can do with just markdown.

### Bold

This **should be bold** if it works.

### Mixed

This ***should be italic-bold*** if that also works.

## Indentation

Indented to generate a block quote
Second line
3 changes: 3 additions & 0 deletions examples/blog-site/blog/first-post/snippets/simple.js
@@ -0,0 +1,3 @@
var simple = 1;

console.log('this is as simple as 10', simple);
22 changes: 22 additions & 0 deletions examples/blog-site/site/README.md
@@ -0,0 +1,22 @@
# Blog-Site example

Demonstrates how to use the dog provider in order to serve the blog via a website.

## Disclaimer

Please keep in mind that I favored simplicity over correctness and robustness.

I used shorter (and somewhat naive) implementations and avoided using libraries to let this example stand on its own.

## Improvments needed

The following should be improved if this was to be used for real:

- implement a more robust router or use libraries like director or express
- the server and blog initialization need more robust error handling
- the code should be modularized

## Running the example

Alright, enough of the warnings, here is how you run the example:

0 comments on commit 2af1bb8

Please sign in to comment.