Skip to content

Commit 8dfed27

Browse files
author
Emma Brand
committed
Reverted style changes, fixed tutorial section and added TOC
1 parent 15b59a7 commit 8dfed27

18 files changed

+180
-58
lines changed

_config.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ keywords: san diego, robotics, robosub, san diego city college, robotics team
55
currentlocation: San Diego City Robotics Club, 1313 Park Blvd, San Diego, CA 92101
66
77

8-
permalink: /news/:title
8+
permalink: /blog/:title
99
excerpt_separator: <!--more-->
10-
markdown: kramdown
10+
markdown: kramdown
11+
12+
collections:
13+
- tutorials

_data/navigation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
- page: Sponsors
1111
url: /sponsors
1212

13-
- page: Code
14-
url: /tutorial
13+
- page: Tutorials
14+
url: /tutorials
1515

1616
- page: Contact
1717
url: /contact

_includes/news-sidebar.html renamed to _includes/sidebar.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ <h3>Recent Posts</h3>
66
<a href="{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a><br/>
77
{% endfor %}
88
</section>
9+
910
<hr />
11+
1012
<section id="js-topics">
1113
<h3>Topics</h3>
1214
{% for category in site.categories %}

_includes/toc.html

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{% capture tocWorkspace %}
2+
{% comment %}
3+
Version 1.0.6
4+
https://github.com/allejo/jekyll-toc
5+
6+
"...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe
7+
8+
Usage:
9+
{% include toc.html html=content sanitize=true class="inline_toc" id="my_toc" h_min=2 h_max=3 %}
10+
11+
Parameters:
12+
* html (string) - the HTML of compiled markdown generated by kramdown in Jekyll
13+
14+
Optional Parameters:
15+
* sanitize (bool) : false - when set to true, the headers will be stripped of any HTML in the TOC
16+
* class (string) : '' - a CSS class assigned to the TOC
17+
* id (string) : '' - an ID to assigned to the TOC
18+
* h_min (int) : 1 - the minimum TOC header level to use; any header lower than this value will be ignored
19+
* h_max (int) : 6 - the maximum TOC header level to use; any header greater than this value will be ignored
20+
* ordered (bool) : false - when set to true, an ordered list will be outputted instead of an unordered list
21+
* item_class (string) : '' - add custom class(es) for each list item; has support for '%level%' placeholder, which is the current heading level
22+
* baseurl (string) : '' - add a base url to the TOC links for when your TOC is on another page than the actual content
23+
* anchor_class (string) : '' - add custom class(es) for each anchor element
24+
25+
Output:
26+
An ordered or unordered list representing the table of contents of a markdown block. This snippet will only
27+
generate the table of contents and will NOT output the markdown given to it
28+
{% endcomment %}
29+
30+
{% capture my_toc %}{% endcapture %}
31+
{% assign orderedList = include.ordered | default: false %}
32+
{% assign minHeader = include.h_min | default: 1 %}
33+
{% assign maxHeader = include.h_max | default: 6 %}
34+
{% assign nodes = include.html | split: '<h' %}
35+
{% assign firstHeader = true %}
36+
37+
{% capture listModifier %}{% if orderedList %}1.{% else %}-{% endif %}{% endcapture %}
38+
39+
{% for node in nodes %}
40+
{% if node == "" %}
41+
{% continue %}
42+
{% endif %}
43+
44+
{% assign headerLevel = node | replace: '"', '' | slice: 0, 1 | times: 1 %}
45+
46+
{% if headerLevel < minHeader or headerLevel > maxHeader %}
47+
{% continue %}
48+
{% endif %}
49+
50+
{% if firstHeader %}
51+
{% assign firstHeader = false %}
52+
{% assign minHeader = headerLevel %}
53+
{% endif %}
54+
55+
{% assign indentAmount = headerLevel | minus: minHeader | add: 1 %}
56+
{% assign _workspace = node | split: '</h' %}
57+
58+
{% assign _idWorkspace = _workspace[0] | split: 'id="' %}
59+
{% assign _idWorkspace = _idWorkspace[1] | split: '"' %}
60+
{% assign html_id = _idWorkspace[0] %}
61+
62+
{% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %}
63+
{% assign header = _workspace[0] | replace: _hAttrToStrip, '' %}
64+
65+
{% assign space = '' %}
66+
{% for i in (1..indentAmount) %}
67+
{% assign space = space | prepend: ' ' %}
68+
{% endfor %}
69+
70+
{% unless include.item_class == blank %}
71+
{% capture listItemClass %}{:.{{ include.item_class | replace: '%level%', headerLevel }}}{% endcapture %}
72+
{% endunless %}
73+
74+
{% capture my_toc %}{{ my_toc }}
75+
{{ space }}{{ listModifier }} {{ listItemClass }} [{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}]({% if include.baseurl %}{{ include.baseurl }}{% endif %}#{{ html_id }}){% if include.anchor_class %}{:.{{ include.anchor_class }}}{% endif %}{% endcapture %}
76+
{% endfor %}
77+
78+
{% if include.class %}
79+
{% capture my_toc %}{:.{{ include.class }}}
80+
{{ my_toc | lstrip }}{% endcapture %}
81+
{% endif %}
82+
83+
{% if include.id %}
84+
{% capture my_toc %}{: #{{ include.id }}}
85+
{{ my_toc | lstrip }}{% endcapture %}
86+
{% endif %}
87+
{% endcapture %}{% assign tocWorkspace = '' %}{{ my_toc | markdownify | strip }}

_layouts/content.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,7 @@ <h2 class="text-center">{{ page.subtitle }}</h2>
3434

3535
{% endif %}
3636
</div>
37-
</article>
37+
</article>
38+
<div id="scrolltop">
39+
<i class="mdi mdi-48px mdi-arrow-up-drop-circle"></i>
40+
</div>

_layouts/left-sidebar.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
<div class="row">
55
<div class="col-12 col-md-4">
66

7-
{% if page.id %}
8-
{% include news-sidebar.html %}
9-
{% else %}
10-
{% include {{ page.sidebar }} %}
11-
{% endif %}
7+
{% include sidebar.html %}
128

139
</div>
1410
<div class="col-12 col-md-8">

_layouts/posts.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
layout: content
33
---
44
<article class="post">
5-
<h1 class="post-title">{{ page.title }}</h1>
5+
66
{{ content }}
7+
78
</article>

_layouts/right-sidebar.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@
1616
</div>
1717
<div class="col-12 col-md-4">
1818

19-
{% if page.id %}
20-
{% include news-sidebar.html %}
21-
{% else %}
22-
{% include {{ page.sidebar }} %}
23-
{% endif %}
19+
{% include sidebar.html %}
2420

2521
</div>
2622
</div>

_layouts/tutorial.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
layout: content
3+
---
4+
5+
{% include toc.html html=content baseurl=page.url %}
6+
7+
{{ content }}

_posts/2018-10-26-robotics-while-loop.md renamed to _tutorials/2018-10-26-robotics-while-loop.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
---
2-
layout: posts
3-
title: "Robotics while loop"
4-
toc: true
5-
catagotries: [tutorial, code]
62
---
73

8-
# python tutorial 1
4+
# Python Tutorial 1
5+
6+
## Robotics while loop
97

108
The while loop is a convenient way to do the same task over and over again. This
119
comes up a lot in robotics, where it is often desirable to let something run in

0 commit comments

Comments
 (0)