Skip to content

Commit b4df676

Browse files
committed
Tables of Contents
1 parent d5377ba commit b4df676

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+672
-55
lines changed

_config.yml

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,74 @@
1-
21
title: ACM@UIUC TIL
32
url: "https://til.acm.illinois.edu"
43
baseurl:
54
google_analytics_key:
65
show_full_navigation: true
76

87
# Dependencies
9-
markdown: kramdown
8+
markdown: kramdown
109
kramdown:
11-
input: GFM
12-
hard_wrap: false
10+
input: GFM
11+
hard_wrap: false
1312
highlighter: rouge
1413

1514
# Values for the jekyll-seo-tag gem (https://github.com/jekyll/jekyll-seo-tag)
1615
logo: /siteicon.png
1716
description: Things we learned.
1817
author:
19-
name: ACM@UIUC
20-
email: til@acm.illinois.edu
21-
twitter: ACM-UIUC
18+
name: ACM@UIUC
19+
email: til@acm.illinois.edu
20+
twitter: ACM-UIUC
2221
social:
2322
name: ACM@UIUC
2423
links:
25-
- https://github.com/acm-uiuc
26-
24+
- https://github.com/acm-uiuc
2725

26+
excerpt_separator: ""
2827
permalink: pretty
2928

3029
gems:
31-
- jekyll-sitemap
32-
- jekyll-seo-tag
33-
- jekyll-feed
30+
- jekyll-sitemap
31+
- jekyll-seo-tag
32+
- jekyll-feed
3433

3534
exclude:
36-
- Gemfile
37-
- Gemfile.lock
38-
- README.md
39-
- LICENCE
40-
- CONTRIBUTING.md
35+
- Gemfile
36+
- Gemfile.lock
37+
- README.md
38+
- LICENSE
39+
- CONTRIBUTING.md
4140

4241
collections:
43-
til:
44-
title: Today We Learned
45-
permalink: /:path/
46-
output: true
42+
til:
43+
title: Today I Learned
44+
permalink: /:path/
45+
output: true
4746

4847
defaults:
49-
-
50-
scope:
51-
path: ""
52-
values:
53-
layout: default
54-
-
55-
scope:
56-
path: ""
57-
type: "til"
58-
values:
59-
seo:
60-
type: Article
61-
_comments:
62-
category: Group navigation links with this field
63-
order: Used to sort links in the navigation
64-
-
65-
scope:
66-
path: ""
67-
type: "posts"
68-
values:
69-
_comments:
70-
type: Marks the impact of this release
48+
-
49+
scope:
50+
path: ""
51+
values:
52+
layout: default
53+
-
54+
scope:
55+
path: ""
56+
type: "til"
57+
values:
58+
seo:
59+
type: Article
60+
_comments:
61+
category: Group navigation links with this field
62+
order: Used to sort links in the navigation
63+
-
64+
scope:
65+
path: ""
66+
type: "posts"
67+
values:
68+
_comments:
69+
type: Marks the impact of this release
7170

7271

7372
types:
74-
- minor
75-
- major
73+
- minor
74+
- major

_plugins/loop_directory.rb

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#usage:
2+
#{% loop_directory directory:images iterator:image filter:*.jpg sort:descending %}
3+
# <img src="{{ image }}" />
4+
#{% endloop_directory %}
5+
6+
module Jekyll
7+
class LoopDirectoryTag < Liquid::Block
8+
9+
include Liquid::StandardFilters
10+
Syntax = /(#{Liquid::QuotedFragment}+)?/
11+
12+
def initialize(tag_name, markup, tokens)
13+
@attributes = {}
14+
15+
@attributes['directory'] = '';
16+
@attributes['iterator'] = 'item';
17+
@attributes['filter'] = 'item';
18+
@attributes['sort'] = 'ascending';
19+
20+
# Parse parameters
21+
if markup =~ Syntax
22+
markup.scan(Liquid::TagAttributes) do |key, value|
23+
@attributes[key] = value
24+
end
25+
else
26+
raise SyntaxError.new("Bad options given to 'loop_directory' plugin.")
27+
end
28+
29+
#if @attributes['directory'].nil?
30+
# raise SyntaxError.new("You did not specify a directory for loop_directory.")
31+
#end
32+
33+
super
34+
end
35+
36+
def render(context)
37+
context.registers[:loop_directory] ||= Hash.new(0)
38+
39+
images = Dir.glob(File.join(@attributes['directory'], @attributes['filter']))
40+
41+
if @attributes['sort'].casecmp( "descending" ) == 0
42+
# Find files and sort them reverse-lexically. This means
43+
# that files whose names begin with YYYYMMDD are sorted newest first.
44+
images.sort! {|x,y| y <=> x }
45+
else
46+
# sort normally in ascending order
47+
images.sort!
48+
end
49+
50+
result = []
51+
52+
context.stack do
53+
54+
55+
# remove filename extension
56+
images.each { |pathname|
57+
context[@attributes['iterator']] = File.basename(pathname, @attributes['filter'].sub('*', ''))
58+
result << render_all(@nodelist, context)
59+
}
60+
61+
# return pathname
62+
# images.each_with_index do |item, index|
63+
# context[@attributes['iterator']] = item
64+
# result << render_all(@nodelist, context)
65+
# end
66+
end
67+
68+
result
69+
end
70+
end
71+
end
72+
73+
Liquid::Template.register_tag('loop_directory', Jekyll::LoopDirectoryTag)

_til/_defaults.md

Lines changed: 1 addition & 1 deletion

_til/acm_uiuc/toc.md

Lines changed: 21 additions & 0 deletions

_til/ack/ack-bar.md renamed to _til/bash/ack-bar.md

Lines changed: 1 addition & 1 deletion

_til/awk/awk-cookbook.md renamed to _til/bash/awk-cookbook.md

Lines changed: 1 addition & 1 deletion

_til/ack/case-insensitive-search.md renamed to _til/bash/case-insensitive-search.md

Lines changed: 1 addition & 1 deletion

_til/ack/list-available-file-types.md renamed to _til/bash/list-available-file-types.md

Lines changed: 1 addition & 1 deletion

_til/unix/partial-string-matching-in-bash-scripts.md renamed to _til/bash/partial-string-matching-in-bash-scripts.md

Lines changed: 1 addition & 1 deletion

_til/bash/toc.md

Lines changed: 21 additions & 0 deletions

_til/devops/toc.md

Lines changed: 21 additions & 0 deletions

_til/git/toc.md

Lines changed: 21 additions & 0 deletions

_til/go/toc.md

Lines changed: 21 additions & 0 deletions

_til/grep/grep-for-files-without-a-match.md

Lines changed: 1 addition & 1 deletion

_til/grep/grep-for-multiple-patterns.md

Lines changed: 1 addition & 1 deletion

_til/grep/toc.md

Lines changed: 21 additions & 0 deletions

0 commit comments

Comments
 (0)