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

+5-2
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

+2-2
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

+2
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

+87
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

+4-1
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

+1-5
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

+2-1
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

+1-5
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

+7
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

+3-5
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

_posts/2018-11-19-github-contributing.md renamed to _tutorials/2018-11-19-github-contributing.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
2-
layout: content
3-
title: "Contributing using github"
4-
toc: true
5-
catagotries: [tutorial, code]
62
---
73

4+
# Contributing using GitHub
5+
86
In order to contribute to Zoidberg code it is first necessary to get a Github account. This is simple to do at [Github](http://github.com/). This tutorial covers version control using the program git, which is a command line tool. There are other tools to to do the same thing which use a GUI, but they may use other workflows which could mess up the repository.
97

108
## Fork and Pull workflow
119

1210
To get a better understanding of Git and the process we'll be using, check out these guides on the Fork and Pull workflow.
1311

12+
<!--more-->
13+
1414
- [general GitHub guides](https://guides.github.com/)
1515
- [a good rundown on the Fork and Pull workflow](https://gist.github.com/Chaser324/ce0505fbed06b947d962). This is the source of much of the information on this page.
1616
- [Git stash](https://git-scm.com/book/en/v1/Git-Tools-Stashing)

news/index.html renamed to blog/index.html

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
---
22
layout: right-sidebar
3-
title: News
4-
subtitle: News subtitle
5-
permalink: /news
6-
sidebar: news-sidebar.html
3+
title: Blog
4+
subtitle: Read about what we're doing, learn how to contribute, and more!
5+
permalink: /blog
76
---
87

9-
<link rel="stylesheet" href="/css/blog.css" />
10-
118
{% for post in site.posts %}
129

1310
<section class="blog-posts {% for topic in post.categories %}{{ topic }} {% endfor %}">

code_tutorial.md

-13
This file was deleted.

css/blog.css

-6
This file was deleted.

css/styles.css

+39
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ padding: 0;
55
margin: 0;
66
width: 100vw;
77
overflow-x: hidden;
8+
scroll-behavior: smooth;
89
}
910

1011
* {
@@ -562,4 +563,42 @@ left: -3px
562563
}
563564
.b-lazy.b-loaded {
564565
opacity: 1;
566+
}
567+
568+
.code, code, pre {
569+
color: #fff !important;
570+
}
571+
572+
code table .gutter {
573+
min-width: 2em;
574+
}
575+
576+
.gutter pre {
577+
color: #09F !important;
578+
}
579+
580+
section.blog-posts {
581+
display:none;
582+
}
583+
#js-topics a:hover {
584+
cursor: pointer;
585+
text-decoration: underline;
586+
}
587+
588+
.post-title, #sidebar section a {
589+
text-transform: capitalize;
590+
}
591+
592+
#scrolltop {
593+
position: fixed;
594+
opacity: 0;
595+
bottom: 50px;
596+
right: 50px;
597+
cursor: pointer;
598+
-webkit-transition: opacity 0.3s ease-in-out;
599+
transition: opacity 0.5s ease-in-out;
600+
}
601+
602+
#scrolltop.up {
603+
opacity: 0.3;
565604
}

js/blog.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
$("#js-topics").on("click", "a", function(){
22
var topic = $(this).attr('data-topic');
3-
history.pushState(null, null, "/news/#" + topic);
3+
history.pushState(null, null, "/tutorials/#" + topic);
44
showTopic(topic);
55
});
66

js/scripts.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,19 @@ $(function() {
1414
return;
1515
}
1616

17+
if (st > 100) {
18+
$('#scrolltop').addClass('up');
19+
} else {
20+
$('#scrolltop').removeClass('up');
21+
}
22+
1723
if (st > lastScrollTop){
1824
$('header').removeClass('nav-down').addClass('nav-up');
19-
$('#scrolltop').removeClass('up');
2025
} else {
2126
if(st + $(window).height() < $(document).height() && st >= delta) {
2227
$('header').removeClass('nav-up').addClass('nav-down');
23-
$('#scrolltop').addClass('up');
2428
} else {
2529
$('header').removeClass('nav-up').removeClass('nav-down');
26-
$('#scrolltop').removeClass('up');
2730
}
2831
}
2932
lastScrollTop = st;
@@ -44,9 +47,7 @@ $(function() {
4447

4548

4649
$('#scrolltop').click(function() {
47-
$('html, body').animate({
48-
scrollTop: 0
49-
}, 1000);
50+
$('html, body').scrollTop(0);
5051
});
5152

5253
$('body').on('click','a.next',function(){
@@ -72,4 +73,5 @@ $(function() {
7273
$(this).attr('data-src','');
7374
}
7475
});
75-
}
76+
}
77+

tutorials.html

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
layout: tutorial
3+
title: Code Tutorials
4+
---
5+
6+
{% for tutorial in site.tutorials %}
7+
8+
{{tutorial}}
9+
10+
{% endfor %}

0 commit comments

Comments
 (0)