Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 33 lines (28 sloc) 1.507 kB
02a6bf5 @psycotica0 Changed Tag Handling
authored
1
2 # This makes a list of files of the form:
3 # tag1 filename1
4 # tag2 filename1
5 # tag1 filename2
6 # Where the files are ordered by creation date given in filename.augmented
7 # This can be used for a lot of things:
8 # With grep '^tag1 ' | cut -d ' ' -f2- you can get all files for a tag
9 # With grep ' filename1$' | cut -d ' ' -f1 you can get all tags for a file
10 # With cut -d ' ' -f1 | sort | uniq you can get all tags in use.
11
12 # Always run to see if there's a new article to be added to the tagindex
13 redo-always
14 # I've chosen to just use a sorted list of mime files. If that changes, the taglist should be considered changed
15 ls *.mime | sort | redo-stamp
16
17 ls *.mime | sed 's/.mime$//' | while read file; do
18 # Need augmented to get the ordering
19 # If, though, a new tag was added, then augmented will be different, so we'll be rerun to regenerate the index
20 redo-ifchange "$file.augmented"
21 c_time="$(sed -n 's/Date-Created: *\(.*\)/\1/p' < "$file.augmented")"
22 for tag in $(grep '^Tag:' < "$file.augmented" | sed 's/^Tag://'); do
23 echo "$c_time $tag $file" >> $3
24 done
25 done
26
87b48d9 @psycotica0 Added Git Augmentation
authored
27 # This hack variable gets around the biggest shell bug that prevents (sort < $3 | cut > $3)
28 # The -k in sort says "If two articles have the same date, sort the lines by filename"
29 # This keeps all tags for a given file together, which we use to establish ordering.
30 # Otherwise we end up with weird stuff where a1 comes before a2 sometimes, depending on tags.
31 hack="$(sort -k 1,1 -k 3,3 < $3 | cut -d ' ' -f 2-)"
02a6bf5 @psycotica0 Changed Tag Handling
authored
32 echo "$hack" > $3
Something went wrong with that request. Please try again.