Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flex sidebar #178

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ header_pages:
ref_packages:
- Core Prolog
- ALS Library
- C Interface
- ALSDev
- C Interface

defaults:
-
Expand Down
19 changes: 8 additions & 11 deletions docs/_includes/ref-packtoc.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@
{%- for package in site.ref_packages %}

<li>
<strong>{{package | escape}}</strong>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing all the changes to this file are experimental/scratch changes. Should they be removed?

<strong><a href="
{% if package == "Core Prolog" %}ref/cut.html"{% endif %}
{% if package == "ALS Library" %}ref/arithx1.html"{% endif %}
{% if package == "ALSDev" %}ref/Edit_Menu.html"{% endif %}
{% if package == "C Interface" %}ref/c_malloc.html"{% endif %}
>{{package | escape}}{{package.name}}</a></strong>

{%- assign groups = site.pages | where: "reference", true | where: "package", package | group_by: "group" | sort: "name" %}

<ul>
{%- for g in groups %}
<li>
<a href="ref/#{{g.name|slugify}}">{{g.name}}</a>
</li>
{%- endfor %}
</ul>
</li>
{%- endfor %}
</ul>
</ul>
<div style="margin-top:-1em;margin-left:1.8em;"><a href="/docs/ref/#control">View All Predicates</a></div>
110 changes: 110 additions & 0 deletions docs/_includes/sidebar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<script> $( document ).ready(function() {
$("#outer-nav").removeAttr("hidden");
setupRef();
});
</script>

<script>
$(document).ready(function(){
$('#searchdiv').change(function(){
clearSearch();
doSearch();
});
});
</script>

<script>
$(document).ready(function(){
$("#searchInput").on("search", function(evt){
if($(this).val().length > 0){
// the search is being executed
clearSearch();
doSearch();
} else {
// user clicked reset
clearSearch()
}
})
});
</script>

<nav id="outer-nav" hidden>

<div style="border:1px solid black;margin-left:10px; width:94%;">
<input type="search" id="searchInput" autocomplete="off" class="mysearch"
placeholder="Search predicates..." incremental
style="border:1px solid white; width:100%; font-size:18px;">
<br>
<div id="searchdiv">
<input type="radio" name="searchtype" id="srchname" value="srchname"><label style="font-size:12px;" for="srchname">By Name</label>
<input type="radio" name="searchtype" id="srchdesc" value="srchdesc"><label style="font-size:12px;" for="srchdesc">By Desc</label>
<input type="radio" name="searchtype" id="srchboth" value="srchboth" checked><label style="font-size:12px;" for="srchboth">By Both</label>
</div>
<hr style="border:1px solid black;">
<div style="text-align:center;"><a href="/docs/ref/#control">View All Predicates</a></div>
</div>

<ul> <!-- packages list -->
{%- for package in site.ref_packages %}

<li class="pkg" > <!-- package -->
<details {% if package == page.package %}open{% endif %}>
<summary>{{package | escape}}</summary>

{%- assign groups = site.pages | where: "reference", true | where: "package", package | group_by: "group" | sort: "name" %}

<ul> <!-- group list -->
{%- for g in groups %}

<li class="grp" > <!-- group -->
<details > <!-- group details -->
<summary>{{g.name | escape}}</summary>
<ul> <!-- predicates list -->

{%- assign predicates = "" | split: "" %}
{%- for r in g.items %}
{% for p in r.predicates %}
{% assign predicates = predicates | push: p %}
{% endfor %}
{%- endfor %}

{%- assign sorted_preds = predicates | sort: "sig" %}

{%- for p in sorted_preds %}
{%- assign ppage = g.items | where_exp: "item", "item.predicates contains p" | first %}
<li class="prd"> <!-- predicates list -->
{%- assign predname = ppage.url | split: "/" | last | split: "." | first %}
<a href="{{ppage.url}}"
{%- assign psig0 = p.sig | slice: 0 %}
{%- assign psigt = p.sig | slice: 1, 100 %}
{%- if psig0 == "$" %}
{%- assign thepred = p.sig %}
{%- assign apppred = psigt | split: "/" | first %}
{% elsif p.sig == "</2" %}
{%- assign thepred = "<" %}
{%- assign apppred = "lessthan" %}
{% elsif p.sig == "=</2" %}
{%- assign thepred = "=<" %}
{%- assign apppred = "lessthaneq" %}
{% elsif p.sig == "!/0" %}
{%- assign thepred = "!" %}
{%- assign apppred = "cut" %}
{%- else %}
{%- assign thepred = p.sig %}
{%- assign apppred = p.sig | split: "/" | first %}
{%- endif %}
id="{{ppage.url | split: "/" | last | split: "." | first}}_{{apppred}}"
onclick="accessPredPage('{{ppage.url | split: "/" | last | split: "." | first}}','{{apppred}}')" >{{thepred}}
{%- if p.args %}/[{% for a in p.args %}{{ a[0] }}{% unless forloop.last %},{% endunless %}{% endfor %}]{% comment %} for-p.args {% endcomment %}{% endif %}</a>
<div class="dscr" hidden>{%- if p.args %}{{p.args | first}}{% else %}{{p.desc}}{% endif %}</div>
</li> <!-- END prd class list entry -->
{%- endfor %} {% comment %} for p-sorted_preds {% endcomment %}
</ul> <!-- END predicates list -->
</details> <!-- END group details -->
</li> <!-- END group list entry in pkg -->
{%- endfor %} {% comment %} for g {% endcomment %}
</ul> <!-- END group list -->
</details> <!-- END package details -->
{%- endfor %}

</nav>
30 changes: 30 additions & 0 deletions docs/_layouts/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="{{ page.lang | default: site.lang | default: "en" }}">

{%- include head.html -%}

{%- if jekyll.environment != "production" %}
<script>
window.onerror = function(message, source, lineno, colno, error) {
alert(message);
return false;
}
</script>
{% endif -%}

<script type="text/javascript" src="/assets/jquery-3.4.1.js"></script>
<script type="text/javascript" src="/assets/searchhelp.js"></script>

<body>

{%- include header.html -%}

<main class="page-content" aria-label="Content" style="margin-left:30px;">
{{ content }}
</main>

{%- include footer.html -%}

</body>

</html>
14 changes: 14 additions & 0 deletions docs/_layouts/reference-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
{% if jekyll.environment == "production" %}{% include edit-source.html %}{% endif %}
</nav>

<div class="doc-wrapper">
<div class="doc-main">

<h1>{{ page.title | escape }}</h1>
<h3>Module: {{ page.module | escape }}</h3>

Expand All @@ -31,3 +34,14 @@ <h3>Module: {{ page.module | escape }}</h3>
{% endif -%}

{{ content }}

</div>

<script type="text/javascript" src="/assets/searchhelp.js"></script>
<aside class="doc-sidebar">
<h2 style="text-align:center;font-weigt:bold;">ALS Packages</h2>
<nav style="margin-top:-10px">
{% include sidebar.html %}
</nav>
</aside>
</div>
Loading