├── .gitignore
├── LICENSE
├── README.md
├── index.html
├── list.php
├── scripts
├── bootstrap-responsive.min.css
├── bootstrap.min.css
├── handlebars-v4.0.5.mod.js
├── jquery-3.1.1.min.js
├── main.js
├── strapdown.mod.css
└── strapdown.mod.js
└── tpls
└── example-report.md
/.gitignore:
--------------------------------------------------------------------------------
1 | tpls/*.md
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 Frans Rosén
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ### Template generator
2 |
3 | A simple variable based template editor using handlebarjs+strapdownjs. The idea is to use variables in markdown based files to easily replace the variables with content. Data is saved temporarily in local storage. PHP is only needed to generate the list of files in the dropdown of templates.
4 |
5 |
6 |
7 | Thoughts:
8 |
9 | 1. I turned off HTML sanitization to make code with <, >, " etc inside:
10 |
11 | ```
12 | this kind of content
13 | ```
14 |
15 | So it's easily XSS:able as it is now.
16 |
17 | 2. I had to hack a bit in strapdown.js due to messy location of files.
18 | 3. I had to hack a bit in handlebar.js since I wanted to use `{{lookup}}` as a param, and that wasn't possible to turn off even though I removed it as a helper.
19 | 4. Didn't do anything with images, since these still needs to be uploaded elsewhere. A tip here is to name them with what they contain so the tags are easily changeable whenever you use this in your report.
20 |
21 | ### How to run
22 |
23 | ```
24 | php -S localhost:8000
25 | ```
26 |
27 | Place a bunch of `.md` files in the `/tpls/` dir. They should show up in the dropdown. It saves now on every keystroke and will remember the data using localStorage. It will also reuse the variables if you switch template.
28 |
29 | ### Disclaimer
30 |
31 | This was a weekend project, took a few hours but was totally worth it (was able to gain speed quick using it). It's really messy but, hey, it works.
32 |
33 | \o/
34 |
35 | Frans Rosén [@fransrosen](https://twitter.com/fransrosen)
36 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |