Skip to content

Commit

Permalink
feature: Page refresh works
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMitterer committed Mar 26, 2015
1 parent 1dddce5 commit 0a98736
Show file tree
Hide file tree
Showing 30 changed files with 699 additions and 21 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -4,6 +4,9 @@
- [Mustache][3]
- [Markdown Cheatsheet][4]

LivePage!!!!
https://chrome.google.com/webstore/detail/livepage/pilnojpmdoofaelbinaeodfpjheijkbh

### Basis auf pub
- [StillShot][2]
- [Plugins][5]
Expand Down
1 change: 0 additions & 1 deletion dartpad

This file was deleted.

11 changes: 11 additions & 0 deletions examples/simple/.dartpad/refreshChromium-1.0.applescript
@@ -0,0 +1,11 @@
tell application "Chromium"
set windowList to every window
repeat with aWindow in windowList
set tabList to every tab of aWindow
repeat with atab in tabList
if (URL of atab contains "localhost") then
tell atab to reload
end if
end repeat
end repeat
end tell
6 changes: 6 additions & 0 deletions examples/simple/.dartpad/site.yaml
@@ -0,0 +1,6 @@
#template_dir: ../_templates

site_options:
name: Mike
site_name: HudriWudri
author: Mike Mitterer
7 changes: 7 additions & 0 deletions examples/simple/.gitignore
@@ -0,0 +1,7 @@
.buildlog
.DS_Store
.idea
.pub/
build/
packages
pubspec.lock
5 changes: 5 additions & 0 deletions examples/simple/CHANGELOG.md
@@ -0,0 +1,5 @@
# Changelog

## 0.0.1

- Initial version, created by Stagehand
24 changes: 24 additions & 0 deletions examples/simple/LICENSE
@@ -0,0 +1,24 @@
Copyright (c) 2015, <your name>.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3 changes: 3 additions & 0 deletions examples/simple/README.md
@@ -0,0 +1,3 @@
# Uber-simple web app

Generated by Stagehand. See LICENSE.
88 changes: 88 additions & 0 deletions examples/simple/html/_content/about.md
@@ -0,0 +1,88 @@
# Anything above the '~~~' line is interpreted as YAML,
# and is used to set variables you can access from your template tags.
# This is an example of a YAML comment which will be completely ignored.

# A basic variable definition
title: About StillShot

# A list of strings. Surrounding your strings in quotes is optional,
# but some may require it so they don't interfere with YAML syntax.
default_vars:
- "`title`: post title, automatically set to name of markdown file if left blank"
- "`_site`: site.yaml values"
- "`_date`: post 'last modified' date"
- "`_content`: post content (only accessible from templates, not markdown)"

# Alternate List Syntax
authors: [foo, bar, baz]

# A list of Dictionaries
links:
- name: Dart
url: https://dartlang.org
- name: Pub
url: https://pub.dartlang.org
# alternate inline-dict style:
- {name: Google, url: http://google.com}
- {name: Github, url: http://github.com}

# You can even embed markdown in your YAML strings if you want (as long as you use the values
# in the markdown file itself -- markdown injected into html templates will not get evaluated).
tags:
- "[StillShot][stillshot]"
- "[Markdown][markdown]"
- "[Mustache][mustache]"
- "[YAML][yaml]"

# You can also override your 'date_format' setting from your site.yaml
# for each individual post
date_format: yMd

# And here we manually define the template we want to use.
# Note the lack of a file extension. This is to have compatibility
# with any template file-type, though mustache embedded in plain
# old HTML is the default. If no template is defined here, StillShot
# will use the one listed for 'default_template' in your site.yaml
template: info_page
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 `~`'s is the minimum for designating and separating a [YAML][yaml] block, but they can be extended longer -- all that matters
is that the tildes (`~`) are on their own line.
And anything beyond that gets interpreted as [Markdown][markdown]!
You can even use template tags in here, for any variables you set in in the top YAML block, or in your `site.yaml` file:
This post's title is: "{{ title }}"
This file was last modified on {{ _date }}
Note that variables beginning with an underscore designate *implicit* metadata added by __StillShot__.
Some vars that are always available by default:
{{#default_vars}}
- {{.}}
{{/default_vars}}
And as you can see, you can also use mustache logic to iterate through yaml maps and lists:
{{#links}}
- [{{name}}]({{url}})
{{/links}}
{{#tags}}
* {{.}}
{{/tags}}
{{#authors}}
- {{.}}
{{/authors}}
Note how you need to use a `.` to access a list item, but can access map/dict keys directly.
You can of course disable these markdown templating features by setting `markdown_templating: true` in your [site.yaml](../site.yaml) file.
Same ideas apply when writing your actual HTML templates. See [mustache's docs][mustache] for more templating info.
[yaml]: http://rhnh.net/2011/01/31/yaml-tutorial
[markdown]: http://daringfireball.net/projects/markdown/syntax
[mustache]: http://mustache.github.io/mustache.5.html
[stillshot]: https://github.com/oblique63/StillShot
2 changes: 2 additions & 0 deletions examples/simple/html/_content/about/index.html
@@ -0,0 +1,2 @@
~~~
<span>INDEX!!!!</span>
3 changes: 3 additions & 0 deletions examples/simple/html/_content/main.dart
@@ -0,0 +1,3 @@
main() {

}
2 changes: 2 additions & 0 deletions examples/simple/html/_content/mike.html
@@ -0,0 +1,2 @@
~~~
Hallo Mik Mitterer12
3 changes: 3 additions & 0 deletions examples/simple/html/_content/test.html
@@ -0,0 +1,3 @@
title: Mikes Page
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<div>Hallo DIV - {{title}}</div>
35 changes: 35 additions & 0 deletions examples/simple/html/_templates/default.html
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<title>{{title}} | {{_site.site_name}}</title>

<!--
The output directory path (e.g. "../web/") will be stripped from the relative path in this tag.
Since the rendered output page will be in the output directory, any resource paths linking to it
will automatically change to reflect the assets' new relative location (e.g. "css/main.css").
This will work for any tags that have a 'src' or 'href' attribute (e.g. <script>, <img>, <a>, etc).
-->
<link rel="stylesheet" href="{{_page.relative_to_root}}styles/main.css">
</head>
<body>
<!-- 'title' defaults to markdown filename if not defined in the file's YAML block -->
<h1>{{title}}</h1>
NestingLevel: {{_page.nesting_level}}

<!-- Values set in 'site.yaml' can be accessed as properties in the '_site' variable -->
by <span>{{_site.author}}</span>


<!--
'_date' stores the markdown page's last modified date. The date formatting can be set in 'site.yaml' via the
'date_format' variable.
-->
- <span>{{_date}}</span>

<!-- '_content' contains the contents of the markdown file (minus the yaml variables in the header) -->
<article>
{{_content}}
</article>
</body>
</html>
35 changes: 35 additions & 0 deletions examples/simple/html/_templates/info_page.html
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<title>{{title}} | {{_site.site_name}}</title>

<!--
The output directory path (e.g. "../web/") will be stripped from the relative path in this tag.
Since the rendered output page will be in the output directory, any resource paths linking to it
will automatically change to reflect the assets' new relative location (e.g. "css/main.css").
This will work for any tags that have a 'src' or 'href' attribute (e.g. <script>, <img>, <a>, etc).
-->
<link rel="stylesheet" href="styles/main.css">
</head>
<body>
InfoPage
<!-- 'title' defaults to markdown filename if not defined in the file's YAML block -->
<h1>{{title}}</h1>

<!-- Values set in 'site.yaml' can be accessed as properties in the '_site' variable -->
by <span>{{_site.author}}</span>


<!--
'_date' stores the markdown page's last modified date. The date formatting can be set in 'site.yaml' via the
'date_format' variable.
-->
- <span>{{_date}}</span>

<!-- '_content' contains the contents of the markdown file (minus the yaml variables in the header) -->
<article>
{{_content}}
</article>
</body>
</html>
10 changes: 10 additions & 0 deletions examples/simple/pubspec.yaml
@@ -0,0 +1,10 @@
name: 'simple'
version: 0.0.1
description: >
An absolute bare-bones web app.
#author: <your name> <email@example.com>
#homepage: https://www.example.com
environment:
sdk: '>=1.0.0 <2.0.0'
dependencies:
browser: any
56 changes: 56 additions & 0 deletions examples/simple/web/about.html
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html>
<head>
<title>About StillShot | HudriWudri</title>
<!--
The output directory path (e.g. "../web/") will be stripped from the relative path in this tag.
Since the rendered output page will be in the output directory, any resource paths linking to it
will automatically change to reflect the assets' new relative location (e.g. "css/main.css").
This will work for any tags that have a 'src' or 'href' attribute (e.g. <script>, <img>, <a>, etc).
-->
<link rel="stylesheet" href="styles/main.css">
</head>
<body>
InfoPage
<!-- 'title' defaults to markdown filename if not defined in the file's YAML block -->
<h1>About StillShot</h1>
<!-- Values set in 'site.yaml' can be accessed as properties in the '_site' variable -->
by <span>Mike Mitterer</span>

<!--
'_date' stores the markdown page's last modified date. The date formatting can be set in 'site.yaml' via the
'date_format' variable.
-->
- <span>3/25/2015</span>
<!-- '_content' contains the contents of the markdown file (minus the yaml variables in the header) -->
<article>
<p>3 <code>~</code>'s is the minimum for designating and separating a <a href="http://rhnh.net/2011/01/31/yaml-tutorial">YAML</a> block, but they can be extended longer -- all that matters
is that the tildes (<code>~</code>) are on their own line.
And anything beyond that gets interpreted as <a href="http://daringfireball.net/projects/markdown/syntax">Markdown</a>!
You can even use template tags in here, for any variables you set in in the top YAML block, or in your <code>site.yaml</code> file:
This post's title is: "About StillShot"
This file was last modified on 3/25/2015</p>
<p>Note that variables beginning with an underscore designate <em>implicit</em> metadata added by <strong>StillShot</strong>.
Some vars that are always available by default:
- <code>title</code>: post title, automatically set to name of markdown file if left blank
- <code>_site</code>: site.yaml values
- <code>_date</code>: post 'last modified' date
- <code>_content</code>: post content (only accessible from templates, not markdown)</p>
<p>And as you can see, you can also use mustache logic to iterate through yaml maps and lists:
- <a href="https://dartlang.org">Dart</a>
- <a href="https://pub.dartlang.org">Pub</a>
- <a href="http://google.com">Google</a>
- <a href="http://github.com">Github</a>
<em> <a href="https://github.com/oblique63/StillShot">StillShot</a>
</em> <a href="http://daringfireball.net/projects/markdown/syntax">Markdown</a>
<em> <a href="http://mustache.github.io/mustache.5.html">Mustache</a>
</em> <a href="http://rhnh.net/2011/01/31/yaml-tutorial">YAML</a>
- foo
- bar
- baz</p>
<p>Note how you need to use a <code>.</code> to access a list item, but can access map/dict keys directly.
You can of course disable these markdown templating features by setting <code>markdown_templating: true</code> in your <a href="../site.yaml">site.yaml</a> file.
Same ideas apply when writing your actual HTML templates. See <a href="http://mustache.github.io/mustache.5.html">mustache's docs</a> for more templating info.</p>
</article>
</body>
</html>
30 changes: 30 additions & 0 deletions examples/simple/web/about/index.html
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<title>index | HudriWudri</title>
<!--
The output directory path (e.g. "../web/") will be stripped from the relative path in this tag.
Since the rendered output page will be in the output directory, any resource paths linking to it
will automatically change to reflect the assets' new relative location (e.g. "css/main.css").
This will work for any tags that have a 'src' or 'href' attribute (e.g. <script>, <img>, <a>, etc).
-->
<link rel="stylesheet" href="../styles/main.css">
</head>
<body>
<!-- 'title' defaults to markdown filename if not defined in the file's YAML block -->
<h1>index</h1>
NestingLevel: 1
<!-- Values set in 'site.yaml' can be accessed as properties in the '_site' variable -->
by <span>Mike Mitterer</span>

<!--
'_date' stores the markdown page's last modified date. The date formatting can be set in 'site.yaml' via the
'date_format' variable.
-->
- <span>26.03.2015</span>
<!-- '_content' contains the contents of the markdown file (minus the yaml variables in the header) -->
<article>
<span>INDEX!!!!</span>
</article>
</body>
</html>
26 changes: 26 additions & 0 deletions examples/simple/web/index.html
@@ -0,0 +1,26 @@
<!DOCTYPE html>

<!--
Copyright (c) 2015, <your name>. All rights reserved. Use of this source code
is governed by a BSD-style license that can be found in the LICENSE file.
-->

<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="scaffolded-by" content="https://github.com/google/stagehand">
<title>simple</title>

<link rel="stylesheet" href="styles/main.css">
</head>

<body>

<div id="output"></div>

<script type="application/dart" src="main.dart"></script>
<script data-pub-inline src="packages/browser/dart.js"></script>
</body>
</html>
2 changes: 2 additions & 0 deletions examples/simple/web/main.dart
@@ -0,0 +1,2 @@
main() {
}

0 comments on commit 0a98736

Please sign in to comment.