Added scrap type
Getty Ritter
9 years ago
37 | 37 |
# A lot of these are boringly similar: probably should come up with a way of abstracting
|
38 | 38 |
# this common pattern, but, y'know, Make...
|
39 | 39 |
|
| 40 |
# These are the list page views:
|
| 41 |
|
40 | 42 |
$(OUTDIR)/quotes/index.html: $(DATADIR)/quotes/* templates/quote.mustache templates/main.mustache
|
41 | 43 |
mkdir -p `dirname $@`
|
42 | 44 |
bin/quote.sh $(DATADIR) all >$@
|
|
49 | 51 |
mkdir -p `dirname $@`
|
50 | 52 |
bin/link.sh $(DATADIR) all >$@
|
51 | 53 |
|
| 54 |
$(OUTDIR)/scraps/index.html: $(DATADIR)/scraps/* templates/scrap.mustache templates/main.mustache
|
| 55 |
mkdir -p `dirname $@`
|
| 56 |
bin/scrap.sh $(DATADIR) all >$@
|
| 57 |
|
52 | 58 |
# ------------------------------------------------------------------------------
|
| 59 |
|
| 60 |
# These are the individual element pages:
|
53 | 61 |
|
54 | 62 |
$(OUTDIR)/quotes/%/index.html: $(DATADIR)/quotes/% templates/quote.mustache templates/main.mustache
|
55 | 63 |
mkdir -p `dirname $@`
|
|
63 | 71 |
mkdir -p `dirname $@`
|
64 | 72 |
bin/link.sh $(DATADIR) $< >$@
|
65 | 73 |
|
| 74 |
$(OUTDIR)/scraps/%/index.html: $(DATADIR)/scraps/% templates/scrap.mustache templates/main.mustache
|
| 75 |
mkdir -p `dirname $@`
|
| 76 |
bin/link.sh $(DATADIR) $< >$@
|
| 77 |
|
66 | 78 |
# ------------------------------------------------------------------------------
|
| 79 |
|
| 80 |
# These are the works-related pages:
|
| 81 |
# (It was important to me to stick the works at the root instead of in
|
| 82 |
# subdirs pertaining to their category.)
|
67 | 83 |
|
68 | 84 |
$(OUTDIR)/%/index.html: $(DATADIR)/works/*/% templates/textpage.mustache templates/main.mustache
|
69 | 85 |
mkdir -p `dirname $@`
|
| 1 |
#!/bin/sh -e
|
| 2 |
|
| 3 |
if [ "$#" -lt "2" ]; then
|
| 4 |
echo "Not enough arguments to $(basename $0)"
|
| 5 |
echo "Usage: $(basename $0) [data-dir] [scrap file]"
|
| 6 |
exit 1
|
| 7 |
fi
|
| 8 |
|
| 9 |
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
| 10 |
PATH=$DIR:$PATH
|
| 11 |
|
| 12 |
if [ "$2" = "all" ]; then
|
| 13 |
ARGS="$1/scraps/*"
|
| 14 |
FOCUS=false
|
| 15 |
else
|
| 16 |
ARGS="$2"
|
| 17 |
FOCUS=true
|
| 18 |
fi
|
| 19 |
COPY="\copy;2015 Getty Ritter (ain't no rights that ain't reserved)"
|
| 20 |
|
| 21 |
json-list -c $ARGS \
|
| 22 |
| pretty-quote \
|
| 23 |
| json-dict scraplist - focus $FOCUS \
|
| 24 |
| mustache - templates/scrap.mustache \
|
| 25 |
| json-dict title Scraps contents - usejs true copy "$COPY" onload '"doLoadHighlight()"' \
|
| 26 |
| mustache - templates/main.mustache
|
99 | 99 |
border-radius: 15px;
|
100 | 100 |
}
|
101 | 101 |
|
| 102 |
.scrap {
|
| 103 |
padding-top: 8px;
|
| 104 |
padding-bottom: 8px;
|
| 105 |
padding-left: 10px;
|
| 106 |
padding-right: 10px;
|
| 107 |
background-color: #070707;
|
| 108 |
margin: 20px;
|
| 109 |
-moz-border-radius: 15px;
|
| 110 |
border-radius: 15px;
|
| 111 |
}
|
| 112 |
|
102 | 113 |
.link {
|
103 | 114 |
padding-top: 20px;
|
104 | 115 |
padding-bottom: 20px;
|
|
126 | 137 |
.author { text-align: right; }
|
127 | 138 |
.name { font-size: large; }
|
128 | 139 |
.description { font-size: small; }
|
| 140 |
.related { text-align: right; font-size: small; }
|
129 | 141 |
|
130 | 142 |
.url {
|
131 | 143 |
font-size: small;
|
| 1 |
<div class="scraps">
|
| 2 |
{{#scraplist}}
|
| 3 |
<div class="scrap" id="{{id}}">
|
| 4 |
{{{content}}}
|
| 5 |
<div class="related">
|
| 6 |
{{#related}}
|
| 7 |
<a href=/scrap/{{name}}><code>{{name}}</code>: {{why}}</a><br/>
|
| 8 |
{{/related}}
|
| 9 |
</div>
|
| 10 |
{{^focus}}
|
| 11 |
<div class="scraplink"><a href="{{id}}" onClick="doHighlight('{{id}}')">#{{id}}</a></div>
|
| 12 |
{{/focus}}
|
| 13 |
</div>
|
| 14 |
{{/scraplist}}
|
| 15 |
</div>
|