Skip to content
This repository has been archived by the owner on Nov 8, 2021. It is now read-only.

enh: Add docs #85

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "_docs"]
path = _docs
url = https://github.com/scorbett123/docs.git
Copy link
Author

Choose a reason for hiding this comment

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

This would need to be changed to a custom docs repo, however I thought that a submodule would mean that the docs could be separated out meaning that they are easier to contribute to.

2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
source 'https://rubygems.org'

gemspec

gem "webrick", "~> 1.7"
18 changes: 18 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,25 @@ discord_url: https://kamiblue.org/discord
downloads_api_ver: v1
build_number: 893
theme: jekyll-theme-cayman
include:
- _docs
gems:
- jekyll-seo-tag
- jekyll-redirect-from
- liquid
defaults:
- scope:
path: _docs
values:
layout: docs
- scope:
path: ''
values:
layout: default

collections:
docs:
output: true



10 changes: 10 additions & 0 deletions _includes/options.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div class=scrollArea>
<div class="scrollBar">
<div class="internalScrollArea">
<a href=".././">
<div class="project-name">KAMI Blue</div>
</a>
{% include subnav.html nav=site.data.nav %}
</div>
</div>
</div>
18 changes: 18 additions & 0 deletions _includes/subnav.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% for item in include.nav %}
{% if item.title %}
{% if item.url %}
<a href="{{ item.url }}">
<div {% if item.url== page.url %} class="currentDoc" {% endif %}> {{ item.title }}</div>
</a>


{% endif %}

{% if item.subnav %}
<div style="padding-top: 1rem"> {{ item.title }}</div>
<div style="padding:1rem">
{% include subnav.html nav=item.subnav %}
</div>
{% endif %}
{% endif %}
{% endfor %}
1 change: 1 addition & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ <h2 class="project-tagline">{{ page.description | default: site.description | de
<a href="/modules">Modules</a>
<a href="/contributing">Contributing</a>
<a href="/support">Support</a>
<a href="/docs/docs">Docs</a>
</nav>

<main id="content" class="main-content" role="main">
Expand Down
64 changes: 64 additions & 0 deletions _layouts/docs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="{{ site.lang | default: " en-US" }}">
<head>

{% if site.google_analytics %}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
<script>
window.dataLayer = window.dataLayer || [];

function gtag() {
dataLayer.push(arguments);
}

gtag('js', new Date());
gtag('config', '{{ site.google_analytics }}');
</script>
{% endif %}
<script data-ad-client="ca-pub-7708188084469659" async
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<meta charset="UTF-8">

{% seo %}
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#9b90ff">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="shortcut icon" type="image/png" href="/favicon.png"/>
<link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}">

<!-- Google / Search Engine Tags -->
<meta itemprop="name" content="KAMI Blue">
<meta itemprop="description" content="A Minecraft utility mod for anarchy servers">
<meta itemprop="image"
content="https://raw.githubusercontent.com/kami-blue/assets/assets/assets/icons/kamiSmall.png">

<!-- Facebook Meta Tags -->
<meta property="og:url" content="https://kamiblue.org">
<meta property="og:type" content="website">
<meta property="og:title" content="KAMI Blue">
<meta property="og:description" content="A Minecraft utility mod for anarchy servers">
<meta property="og:image"
content="https://raw.githubusercontent.com/kami-blue/assets/assets/assets/icons/kamiSmall.png">

<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="KAMI Blue">
<meta name="twitter:description" content="A Minecraft utility mod for anarchy servers">
<meta name="twitter:image"
content="https://raw.githubusercontent.com/kami-blue/assets/assets/assets/icons/kamiSmall.png">

<!-- Embed icon -->
<meta content="/favicon.png" property="og:image">
</head>
<body>

<main id="content" class="grid" role="main">
<div>
{% include options.html %}
</div>
<div class="docContent">{{ content }}</div>


</main>
</body>
</html>
47 changes: 47 additions & 0 deletions _plugins/loadDocList.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
module Options
Jekyll::Hooks.register :site, :pre_render do |site|

site.data["nav"] = []
x = site.pages
x = x.sort_by { |x| x.url.split("/").length() } # make sure entries are in a nice order
x.each { |page|
if page.url.index("/_docs") == 0 # only run when it is a doc

title = page.url.dup
title[".html"] = "" # remove .html from the end of file names.
title["/_docs/"] = ""
site.data["nav"] << do_for_sub(site.data["nav"], title.dup, page.url)

end
}

end

def Options.do_for_sub(current, title, full_url)
if title.split("/").length() > 1
x = get_pos_in_array(current, title.partition("/").first)
if x != nil
current[x]["subnav"] << do_for_sub(current[x]["subnav"], title.partition("/").last, full_url)
else
current << { "title" => title.partition("/").first, "subnav" => do_for_sub([], title.partition("/").last, full_url) }
end
else
current << { "title" => title.partition("/").first, "url" => full_url }

end
return current
end

def Options.get_pos_in_array(array, title)
array.each_with_index do |item, i|
if item.is_a? Array
next
end
if item["title"] == title
return i
end
end

nil
end
end
67 changes: 67 additions & 0 deletions _sass/jekyll-theme-cayman.scss
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ a {
.project-name {
margin-top: 0;
margin-bottom: 0.1rem;
color: white;

&:hover {
color: white;
}

@include large {
font-size: 3.25rem;
Expand Down Expand Up @@ -476,3 +481,65 @@ h2 {
h1 {
font-size: 2rem;
}

.grid {
display: grid;
grid-template-columns: 20% auto;
}

.scrollBar {
max-height: 100vh;
overflow-y: auto;
overflow-x: hidden;
position: fixed;
width: 20%
}

.scrollArea {
background-color: $header-bg-color;
height: 100%;
position: fixed;
width: 20%
}

.internalScrollArea {
padding: 1rem;
color: $header-heading-color;
height: 100%;

a {
color: #848197;

&:hover {
color: white;
text-decoration: none;
}
}
}

.currentDoc {
background-color: blue;
border-radius: 3px;
padding: 5px 5px;
color: white;
}

.docContent {
padding: 1rem
}

::-webkit-scrollbar {
width: 10px;
}

::-webkit-scrollbar-track {
background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
background: #888;
}

::-webkit-scrollbar-thumb:hover {
background: #555;
}