Changeset 39 in code
- Timestamp:
- Sep 2, 2015, 9:21:50 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/README.md
r13 r39 15 15 * Cross-platform 16 16 * Highly extensible 17 * Works well for blogs and generic static websites (landing pages etc) 17 18 * Easy to learn 18 19 * Fast … … 26 27 ## Ideology 27 28 28 Keep your texts in markdown format in the root directory of your blog/site. 29 Keep your texts in markdown, [amber] or HTML format right in the main directory 30 of your blog/site. 29 31 30 32 Keep all service files (extensions, layout pages, deployment scripts etc) 31 33 in the `.zs` subdirectory. 32 34 33 Define variables in the header of the markdown files:35 Define variables in the header of the content files using [YAML]: 34 36 35 37 title: My web site 36 38 keywords: best website, hello, world 39 --- 37 40 38 Markdown text goes after a *newline*41 Markdown text goes after a header *separator* 39 42 40 43 Use placeholders for variables and plugins in your markdown or html 41 files, e.g. `{{ title }}` .44 files, e.g. `{{ title }}` or `{{ command arg1 arg2 }}. 42 45 43 46 Write extensions in any language you like and put them into the `.zs` … … 47 50 placeholder. 48 51 49 E xtensions can use special environment variables, like:52 Every variable from the content header will be passed via environment variables like `title` becomes `$ZS_TITLE` and so on. There are some special variables: 50 53 51 54 * `$ZS` - a path to the `zs` executable … … 54 57 * `$ZS_URL` - a URL for the currently generated page 55 58 56 You can also pass command line arguments, e.g: `{{ my-plugin arg1 arg2 }}` 59 ## Example of RSS generation 57 60 58 ## Example of RSS generation 61 Extensions can be written in any language you know (Bash, Python, Lua, JavaScript, Go, even Assembler). Here's an example of how to scan all markdown blog posts and create RSS items: 62 63 ``` bash 64 for f in ./blog/*.md ; do 65 d=$($ZS var $f date) 66 if [ ! -z $d ] ; then 67 timestamp=`date --date "$d" +%s` 68 url=`$ZS var $f url` 69 title=`$ZS var $f title | tr A-Z a-z` 70 descr=`$ZS var $f description` 71 echo $timestamp \ 72 "<item>" \ 73 "<title>$title</title>" \ 74 "<link>http://zserge.com/$url</link>" \ 75 "<description>$descr</description>" \ 76 "<pubDate>$(date --date @$timestamp -R)</pubDate>" \ 77 "<guid>http://zserge.com/$url</guid>" \ 78 "</item>" 79 fi 80 done | sort -r -n | cut -d' ' -f2- 81 ``` 59 82 60 83 ## Hooks 61 84 62 85 There are two special plugin names that are executed every time the build 63 happens - `pre ` and `post`. You can define some global action here like compile64 your LESS to CSS etc:86 happens - `prehook` and `posthook`. You can define some global actions here like 87 content generation, or additional commands, like LESS to CSS conversion: 65 88 66 89 # .zs/post … … 70 93 rm -f $ZS_OUTDIR/styles.css 71 94 95 ## Syntax sugar 96 97 By default, `zs` converts each `.amber` file into `.html`, so you can use lightweight Jade-like syntax instead of bloated HTML. 98 99 Also, `zs` converts `.gcss` into `.css`, so you don't really need LESS or SASS. More about GCSS can be found [here][gcss]. 100 72 101 ## Command line usage 73 102 74 103 `zs build` re-builds your site. 104 105 `zs build <file>` re-builds one file and prints resulting content to stdout. 75 106 76 107 `zs watch` rebuilds your site every time you modify any file. … … 83 114 84 115 The software is distributed under the MIT license. 116 117 [amber]: https://github.com/eknkc/amber/ 118 [YAML]: https://github.com/go-yaml/yaml 119 [gcss]: https://github.com/yosssi/gcss
Note:
See TracChangeset
for help on using the changeset viewer.