Skip to content

Commit

Permalink
Resolved merge conflicts from removed tables of contents in cs126
Browse files Browse the repository at this point in the history
  • Loading branch information
EdmundGoodman committed May 9, 2021
2 parents a5596c9 + 5c45209 commit 6bc2046
Show file tree
Hide file tree
Showing 48 changed files with 984 additions and 173 deletions.
2 changes: 1 addition & 1 deletion _cs118/118complete.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: 118/CS118
layout: CS118
part: false
title: 118 One Page Notes
---
2 changes: 1 addition & 1 deletion _cs118/combined.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: 118/CS118
layout: CS118
math: true
title: CS118 Combined Notes - Edmund Goodman
---
Expand Down
2 changes: 1 addition & 1 deletion _cs118/cribSheet.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: 118/CS118
layout: CS118
math: true
title: CS118 Crib Sheet - Edmund Goodman
---
Expand Down
2 changes: 1 addition & 1 deletion _cs118/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: 118/CS118
layout: default
title: CS118
---
<flex style="display:flex; justify-content:space-between;">
Expand Down
4 changes: 2 additions & 2 deletions _cs118/part1.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
layout: 118/CS118
layout: CS118
part: true
title: Variables, Number Systems, and I/O
nextt: part2.html
nex: part2
---

# Variables, Number Systems, and I/O
Expand Down
6 changes: 3 additions & 3 deletions _cs118/part2.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
layout: 118/CS118
layout: CS118
part: true
title: "Conditional Statements"
prev: part1.html
nextt: part3.html
pre: part1
nex: part3
---

# Conditional Statements
Expand Down
6 changes: 3 additions & 3 deletions _cs118/part3.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
layout: 118/CS118
layout: CS118
part: true
title: "Arrays, Methods, Scope, and Recursion"
prev: part2.html
nextt: part4.html
pre: part2
nex: part4
---

# Arrays, Methods, Scope, and Recursion
Expand Down
6 changes: 3 additions & 3 deletions _cs118/part4.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
layout: 118/CS118
layout: CS118
part: true
title: "Object Oriented Programming"
prev: part3.html
nextt: part5.html
pre: part3
nex: part5
---

# Object Oriented Programming (OOP)
Expand Down
6 changes: 3 additions & 3 deletions _cs118/part5.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
layout: 118/CS118
layout: CS118
part: true
title: "Inheritance, Abstract Classes, and Interfaces"
prev: part4.html
nextt: part6.html
pre: part4
nex: part6
---

# Inheritance, Abstract Classes, and Interfaces
Expand Down
6 changes: 3 additions & 3 deletions _cs118/part6.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
layout: 118/CS118
layout: CS118
part: true
title: "Error Handling and Exceptions"
prev: part5.html
nextt: part7.html
pre: part5
nex: part7
---

# Error Handling and Exceptions
Expand Down
4 changes: 2 additions & 2 deletions _cs118/part7.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
layout: 118/CS118
layout: CS118
part: true
title: "Generics and the Java Class Library"
prev: part6.html
pre: part6
---

# Generics and the Java Class Library
Expand Down
7 changes: 7 additions & 0 deletions _includes/partnav.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{%- if include.pre != "null" -%}
<a href="{{ include.pre }}.html" title="{{ include.ntitle }}">👈Prev</a>
{%- endif -%}
<a href="index.html" title="{{ include.mod }} Home">🏡{{ include.mod }}</a>
{%- if include.nex != "null" -%}
<a href="{{ include.nex }}.html" title="{{ include.ptitle }}">Next👉</a>
{%- endif -%}
182 changes: 182 additions & 0 deletions _includes/toc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
{% capture tocWorkspace %}
{% comment %}
Copyright (c) 2017 Vladimir "allejo" Jimenez

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
{% endcomment %}
{% comment %}
Version 1.1.0
https://github.com/allejo/jekyll-toc

"...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe

Usage:
{% include toc.html html=content sanitize=true class="inline_toc" id="my_toc" h_min=2 h_max=3 %}

Parameters:
* html (string) - the HTML of compiled markdown generated by kramdown in Jekyll

Optional Parameters:
* sanitize (bool) : false - when set to true, the headers will be stripped of any HTML in the TOC
* class (string) : '' - a CSS class assigned to the TOC
* id (string) : '' - an ID to assigned to the TOC
* h_min (int) : 1 - the minimum TOC header level to use; any header lower than this value will be ignored
* h_max (int) : 6 - the maximum TOC header level to use; any header greater than this value will be ignored
* ordered (bool) : false - when set to true, an ordered list will be outputted instead of an unordered list
* item_class (string) : '' - add custom class(es) for each list item; has support for '%level%' placeholder, which is the current heading level
* submenu_class (string) : '' - add custom class(es) for each child group of headings; has support for '%level%' placeholder which is the current "submenu" heading level
* base_url (string) : '' - add a base url to the TOC links for when your TOC is on another page than the actual content
* anchor_class (string) : '' - add custom class(es) for each anchor element
* skip_no_ids (bool) : false - skip headers that do not have an `id` attribute

Output:
An ordered or unordered list representing the table of contents of a markdown block. This snippet will only
generate the table of contents and will NOT output the markdown given to it
{% endcomment %}

{% capture newline %}
{% endcapture %}
{% assign newline = newline | rstrip %} <!-- Remove the extra spacing but preserve the newline -->

{% capture deprecation_warnings %}{% endcapture %}

{% if include.baseurl %}
{% capture deprecation_warnings %}{{ deprecation_warnings }}<!-- jekyll-toc :: "baseurl" has been deprecated, use "base_url" instead -->{{ newline }}{% endcapture %}
{% endif %}

{% if include.skipNoIDs %}
{% capture deprecation_warnings %}{{ deprecation_warnings }}<!-- jekyll-toc :: "skipNoIDs" has been deprecated, use "skip_no_ids" instead -->{{ newline }}{% endcapture %}
{% endif %}

{% capture jekyll_toc %}{% endcapture %}
{% assign orderedList = include.ordered | default: false %}
{% assign baseURL = include.base_url | default: include.baseurl | default: '' %}
{% assign skipNoIDs = include.skip_no_ids | default: include.skipNoIDs | default: false %}
{% assign minHeader = include.h_min | default: 1 %}
{% assign maxHeader = include.h_max | default: 6 %}
{% assign nodes = include.html | strip | split: '<h' %}

{% assign firstHeader = true %}
{% assign currLevel = 0 %}
{% assign lastLevel = 0 %}

{% capture listModifier %}{% if orderedList %}ol{% else %}ul{% endif %}{% endcapture %}

{% for node in nodes %}
{% if node == "" %}
{% continue %}
{% endif %}

{% assign currLevel = node | replace: '"', '' | slice: 0, 1 | times: 1 %}

{% if currLevel < minHeader or currLevel > maxHeader %}
{% continue %}
{% endif %}

{% assign _workspace = node | split: '</h' %}

{% assign _idWorkspace = _workspace[0] | split: 'id="' %}
{% assign _idWorkspace = _idWorkspace[1] | split: '"' %}
{% assign htmlID = _idWorkspace[0] %}

{% assign _classWorkspace = _workspace[0] | split: 'class="' %}
{% assign _classWorkspace = _classWorkspace[1] | split: '"' %}
{% assign htmlClass = _classWorkspace[0] %}

{% if htmlClass contains "no_toc" %}
{% continue %}
{% endif %}

{% if firstHeader %}
{% assign minHeader = currLevel %}
{% endif %}

{% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %}
{% assign header = _workspace[0] | replace: _hAttrToStrip, '' %}

{% if include.item_class and include.item_class != blank %}
{% capture listItemClass %} class="{{ include.item_class | replace: '%level%', currLevel | split: '.' | join: ' ' }}"{% endcapture %}
{% endif %}

{% if include.submenu_class and include.submenu_class != blank %}
{% assign subMenuLevel = currLevel | minus: 1 %}
{% capture subMenuClass %} class="{{ include.submenu_class | replace: '%level%', subMenuLevel | split: '.' | join: ' ' }}"{% endcapture %}
{% endif %}

{% capture anchorBody %}{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}{% endcapture %}

{% if htmlID %}
{% capture anchorAttributes %} href="{% if baseURL %}{{ baseURL }}{% endif %}#{{ htmlID }}"{% endcapture %}

{% if include.anchor_class %}
{% capture anchorAttributes %}{{ anchorAttributes }} class="{{ include.anchor_class | split: '.' | join: ' ' }}"{% endcapture %}
{% endif %}

{% capture listItem %}<a{{ anchorAttributes }}>{{ anchorBody }}</a>{% endcapture %}
{% elsif skipNoIDs == true %}
{% continue %}
{% else %}
{% capture listItem %}{{ anchorBody }}{% endcapture %}
{% endif %}

{% if currLevel > lastLevel %}
{% capture jekyll_toc %}{{ jekyll_toc }}<{{ listModifier }}{{ subMenuClass }}>{% endcapture %}
{% elsif currLevel < lastLevel %}
{% assign repeatCount = lastLevel | minus: currLevel %}

{% for i in (1..repeatCount) %}
{% capture jekyll_toc %}{{ jekyll_toc }}</li></{{ listModifier }}>{% endcapture %}
{% endfor %}

{% capture jekyll_toc %}{{ jekyll_toc }}</li>{% endcapture %}
{% else %}
{% capture jekyll_toc %}{{ jekyll_toc }}</li>{% endcapture %}
{% endif %}

{% capture jekyll_toc %}{{ jekyll_toc }}<li{{ listItemClass }}>{{ listItem }}{% endcapture %}

{% assign lastLevel = currLevel %}
{% assign firstHeader = false %}
{% endfor %}

{% assign repeatCount = minHeader | minus: 1 %}
{% assign repeatCount = lastLevel | minus: repeatCount %}
{% for i in (1..repeatCount) %}
{% capture jekyll_toc %}{{ jekyll_toc }}</li></{{ listModifier }}>{% endcapture %}
{% endfor %}

{% if jekyll_toc != '' %}
{% assign rootAttributes = '' %}
{% if include.class and include.class != blank %}
{% capture rootAttributes %} class="{{ include.class | split: '.' | join: ' ' }}"{% endcapture %}
{% endif %}

{% if include.id and include.id != blank %}
{% capture rootAttributes %}{{ rootAttributes }} id="{{ include.id }}"{% endcapture %}
{% endif %}

{% if rootAttributes %}
{% assign nodes = jekyll_toc | split: '>' %}
{% capture jekyll_toc %}<{{ listModifier }}{{ rootAttributes }}>{{ nodes | shift | join: '>' }}>{% endcapture %}
{% endif %}
{% endif %}
{% endcapture %}{% assign tocWorkspace = '' %}{{ deprecation_warnings }}{{ jekyll_toc }}
10 changes: 1 addition & 9 deletions _layouts/118/CS118.html → _layouts/CS118.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@
layout: notes
---

{%- if page.part == true -%}
{% capture previous %}{{ page.prev | default: "null" }}{% endcapture %}

{% capture nextp %}{{ page.nextt | default: "null" }}{% endcapture %}

{% include 118/118nav.html nextt=nextp prev=previous %}

{{ content }}
{%- elsif page.part == false -%}
{%- if page.part == false -%}
<a href="../../cs118/index.html">🏡CS118 Home</a>
{%- for page in site.cs118 -%}
{%- if page.part == true -%}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
55 changes: 40 additions & 15 deletions _layouts/notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
{%- if page.math == true -%}
<script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"></script>
{%- endif -%}
<!-- Include tocNAV javascript -->
<script type="text/javascript" src="../assets/js/tocNav.js"></script>

{% seo %}
<link rel="preconnect" href="https://fonts.gstatic.com">
Expand All @@ -38,21 +40,44 @@ <h2 class="project-tagline">{{ page.description }}</h2>
<a href="{{ site.github.tar_url }}" class="btn">Download .tar.gz</a>
{% endif %}
</header>

<main id="content" class="main-content" role="main">
{{ content }}


<footer class="site-footer">
{% if site.github.is_project_page %}
<span class="site-footer-owner"><a href="{{ site.github.repository_url }}">{{ site.github.repository_name
}}</a> is maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name
}}</a>.</span>
{% endif %}
<span class="site-footer-credits">This page was generated by <a href="https://pages.github.com">GitHub
Pages</a>.</span>
</footer>
</main>
<div id="mainGrid" class="container">
<div class="navBox">
<div id="sidenav" class="sideNav closedNav">
<h2 style="margin-left: 10px;">Table of Contents</h2>
{%- include toc.html html=content -%}
</div>
</div>
<div title="Table of Contents" class="buttonCol" onclick="toggleNav()">
<div class="navArrow">
<i></i>
</div>
</div>
<div class="contents">
<main id="content" class="main-content" role="main">
<div class="partNav">
{%- if page.part == true -%}
{% capture previous %}{{ page.pre | default: "null" }}{% endcapture %}
{% capture next %}{{ page.nex | default: "null" }}{% endcapture %}
{%- capture mod -%}{{ page.layout | default: "null"}}{%- endcapture -%}

{% include partnav.html nex=next pre=previous mod=mod %}
{%- endif -%}
</div>
<!-- Main Content of markdown or sub-layouts-->
{{ content }}

<footer class="site-footer">
{% if site.github.is_project_page %}
<span class="site-footer-owner"><a href="{{ site.github.repository_url }}">{{ site.github.repository_name
}}</a> is maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name
}}</a>.</span>
{% endif %}
<span class="site-footer-credits">This page was generated by <a href="https://pages.github.com">GitHub
Pages</a>.</span>
</footer>
</main>
</div>
</div>
</body>

</html>
Loading

0 comments on commit 6bc2046

Please sign in to comment.