gdritter repos lib-static / 9f697c0
Added scrap type Getty Ritter 9 years ago
4 changed file(s) with 69 addition(s) and 0 deletion(s). Collapse all Expand all
3737 # A lot of these are boringly similar: probably should come up with a way of abstracting
3838 # this common pattern, but, y'know, Make...
3939
40 # These are the list page views:
41
4042 $(OUTDIR)/quotes/index.html: $(DATADIR)/quotes/* templates/quote.mustache templates/main.mustache
4143 mkdir -p `dirname $@`
4244 bin/quote.sh $(DATADIR) all >$@
4951 mkdir -p `dirname $@`
5052 bin/link.sh $(DATADIR) all >$@
5153
54 $(OUTDIR)/scraps/index.html: $(DATADIR)/scraps/* templates/scrap.mustache templates/main.mustache
55 mkdir -p `dirname $@`
56 bin/scrap.sh $(DATADIR) all >$@
57
5258 # ------------------------------------------------------------------------------
59
60 # These are the individual element pages:
5361
5462 $(OUTDIR)/quotes/%/index.html: $(DATADIR)/quotes/% templates/quote.mustache templates/main.mustache
5563 mkdir -p `dirname $@`
6371 mkdir -p `dirname $@`
6472 bin/link.sh $(DATADIR) $< >$@
6573
74 $(OUTDIR)/scraps/%/index.html: $(DATADIR)/scraps/% templates/scrap.mustache templates/main.mustache
75 mkdir -p `dirname $@`
76 bin/link.sh $(DATADIR) $< >$@
77
6678 # ------------------------------------------------------------------------------
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.)
6783
6884 $(OUTDIR)/%/index.html: $(DATADIR)/works/*/% templates/textpage.mustache templates/main.mustache
6985 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
9999 border-radius: 15px;
100100 }
101101
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
102113 .link {
103114 padding-top: 20px;
104115 padding-bottom: 20px;
126137 .author { text-align: right; }
127138 .name { font-size: large; }
128139 .description { font-size: small; }
140 .related { text-align: right; font-size: small; }
129141
130142 .url {
131143 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>