Skip to content

Commit f6491d1

Browse files
committed
rename theme
1 parent 25420df commit f6491d1

File tree

161 files changed

+6649
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+6649
-2
lines changed

config/_default/hugo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ copyright = "Edmonton Go"
44
languageCode = "en"
55

66

7-
theme = "hugo-clarity"
7+
theme = "clarity"
88
DefaultContentLanguage = "en"
99

1010
[taxonomies]

themes/clarity/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_Store
2+
public

themes/clarity/LICENSE.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2020 Chip Zoller and Dan Weru
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+
23+
Hugo Theme Template
24+
=================================================================================
25+
The MIT License (MIT)
26+
27+
Original work Copyright (c) 2014 Steve Francia
28+
29+
Staticman's reCAPTCHA support
30+
=================================================================================
31+
32+
The MIT License (MIT)
33+
34+
Original work Copyright (c) 2019 Praveen Lobo and Munif Tanjim
35+
The MIT License (MIT)
36+

themes/clarity/README.md

Lines changed: 999 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: "{{ dateFormat "January" (now.AddDate 0 1 0) }} {{ dateFormat "2006" .Date }} Meetup"
3+
description: "description"
4+
date: "{{ dateFormat "2006-01-02" .Date }}"
5+
draft: true
6+
tags:
7+
- "golang"
8+
---
9+
{{< description >}}
10+
11+
Meetup #00 {{< meetdate >}}. Please RSVP as [Meetup](https://meetup.com)
12+
13+
We will be meeting online using this [Online Meeting](https://meet.jit.si/moderated/faf57089abb075e1133167ba9129db0f31ee7d315de64ad5e9e152aabd2276f7) at 6:30pm MST.
14+
15+
## Agenda
16+
17+
### Talk
18+
19+
Talk description
20+
21+
## News
22+
23+
- News
24+
25+
## Events
26+
27+
- Edmonton Go - [{{ dateFormat "January" (now.AddDate 0 2 0) }}](/meetup/{{ dateFormat "2006-01" (now.AddDate 0 2 0) }}/)

themes/clarity/archetypes/post.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: "{{ replace .Name "-" " " | title }}" # Title of the blog post.
3+
date: {{ .Date }} # Date of post creation.
4+
description: "Article description." # Description used for search engine.
5+
featured: true # Sets if post is a featured post, making it appear on the sidebar. A featured post won't be listed on the sidebar if it's the current page
6+
draft: true # Sets whether to render this page. Draft of true will not be rendered.
7+
toc: false # Controls if a table of contents should be generated for first-level links automatically.
8+
# menu: main
9+
usePageBundles: false # Set to true to group assets like images in the same folder as this post.
10+
featureImage: "/images/path/file.jpg" # Sets featured image on blog post.
11+
featureImageAlt: 'Description of image' # Alternative text for featured image.
12+
featureImageCap: 'This is the featured image.' # Caption (optional).
13+
thumbnail: "/images/path/thumbnail.png" # Sets thumbnail image appearing inside card on homepage.
14+
shareImage: "/images/path/share.png" # Designate a separate image for social media sharing.
15+
codeMaxLines: 10 # Override global value for how many lines within a code block before auto-collapsing.
16+
codeLineNumbers: false # Override global value for showing of line numbers within code block.
17+
figurePositionShow: true # Override global value for showing the figure label.
18+
showRelatedInArticle: false # Override global value for showing related posts in this series at the end of the content.
19+
categories:
20+
- Technology
21+
tags:
22+
- Tag_name1
23+
- Tag_name2
24+
---
25+
26+
**Insert Lead paragraph here.**

themes/clarity/assets/js/code.js

Lines changed: 277 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,277 @@
1+
const codeActionButtons = [
2+
{
3+
icon: 'copy',
4+
id: 'copy',
5+
title: 'Copy Code',
6+
show: true
7+
},
8+
{
9+
icon: 'order',
10+
id: 'lines',
11+
title: 'Toggle Line Numbers',
12+
show: true
13+
},
14+
{
15+
icon: 'carly',
16+
id: 'wrap',
17+
title: 'Toggle Line Wrap',
18+
show: false
19+
},
20+
{
21+
icon: 'expand',
22+
id: 'expand',
23+
title: 'Toggle code block expand',
24+
show: false
25+
}
26+
];
27+
28+
const body = elem('body');
29+
const maxLines = parseInt(body.dataset.code);
30+
const copyId = 'panel_copy';
31+
const wrapId = 'panel_wrap';
32+
const linesId = 'panel_lines';
33+
const panelExpand = 'panel_expand';
34+
const panelExpanded = 'panel_expanded';
35+
const panelHide = 'panel_hide';
36+
const panelFrom = 'panel_from';
37+
const panelBox = 'panel_box';
38+
const fullHeight = 'initial';
39+
const highlightWrap = 'highlight_wrap'
40+
41+
function wrapOrphanedPreElements() {
42+
const pres = elems('pre');
43+
Array.from(pres).forEach(function(pre){
44+
const parent = pre.parentNode;
45+
const isOrpaned = !containsClass(parent, 'highlight');
46+
if(isOrpaned) {
47+
const preWrapper = createEl();
48+
preWrapper.className = 'highlight';
49+
const outerWrapper = createEl();
50+
outerWrapper.className = highlightWrap;
51+
wrapEl(pre, preWrapper);
52+
wrapEl(preWrapper, outerWrapper);
53+
}
54+
})
55+
/*
56+
@Todo
57+
1. Add UI control to orphaned blocks
58+
*/
59+
}
60+
61+
wrapOrphanedPreElements();
62+
63+
function codeBlocks() {
64+
const markedCodeBlocks = elems('code');
65+
const blocks = Array.from(markedCodeBlocks).filter(function(block){
66+
return hasClasses(block) && !Array.from(block.classList).includes('noClass');
67+
}).map(function(block){
68+
return block
69+
});
70+
return blocks;
71+
}
72+
73+
function codeBlockFits(block) {
74+
// return false if codeblock overflows
75+
const blockWidth = block.offsetWidth;
76+
const highlightBlockWidth = block.parentNode.parentNode.offsetWidth;
77+
return blockWidth <= highlightBlockWidth ? true : false;
78+
}
79+
80+
function maxHeightIsSet(elem) {
81+
let maxHeight = elem.style.maxHeight;
82+
return maxHeight.includes('px')
83+
}
84+
85+
function restrainCodeBlockHeight(lines) {
86+
const lastLine = lines[maxLines-1];
87+
let maxCodeBlockHeight = fullHeight;
88+
if(lastLine) {
89+
const lastLinePos = lastLine.offsetTop;
90+
if(lastLinePos !== 0) {
91+
maxCodeBlockHeight = `${lastLinePos}px`;
92+
const codeBlock = lines[0].parentNode;
93+
const outerBlock = codeBlock.closest('.highlight');
94+
const isExpanded = containsClass(outerBlock, panelExpanded);
95+
if(!isExpanded) {
96+
codeBlock.dataset.height = maxCodeBlockHeight;
97+
codeBlock.style.maxHeight = maxCodeBlockHeight;
98+
}
99+
}
100+
}
101+
}
102+
103+
const blocks = codeBlocks();
104+
105+
function collapseCodeBlock(block) {
106+
const lines = elems(lineClass, block);
107+
const codeLines = lines.length;
108+
if (codeLines > maxLines) {
109+
const expandDot = createEl()
110+
pushClass(expandDot, panelExpand);
111+
pushClass(expandDot, panelFrom);
112+
expandDot.title = "Toggle code block expand";
113+
expandDot.textContent = "...";
114+
const outerBlock = block.closest('.highlight');
115+
window.setTimeout(function(){
116+
const expandIcon = outerBlock.nextElementSibling.lastElementChild;
117+
deleteClass(expandIcon, panelHide);
118+
}, 150)
119+
120+
restrainCodeBlockHeight(lines);
121+
const highlightElement = block.parentNode.parentNode;
122+
highlightElement.appendChild(expandDot);
123+
}
124+
}
125+
126+
blocks.forEach(function(block){
127+
collapseCodeBlock(block);
128+
})
129+
130+
function actionPanel() {
131+
const panel = createEl();
132+
panel.className = panelBox;
133+
134+
codeActionButtons.forEach(function(button) {
135+
// create button
136+
const btn = createEl('a');
137+
btn.href = '#';
138+
btn.title = button.title;
139+
btn.className = `icon panel_icon panel_${button.id}`;
140+
button.show ? false : pushClass(btn, panelHide);
141+
// load icon inside button
142+
btn.style.backgroundImage = `url(${baseURL}${iconsPath}${button.icon}.svg)`;
143+
// append button on panel
144+
panel.appendChild(btn);
145+
});
146+
147+
return panel;
148+
}
149+
150+
function toggleLineNumbers(elems) {
151+
elems.forEach(function (elem, index) {
152+
// mark the code element when there are no lines
153+
modifyClass(elem, 'pre_nolines')
154+
});
155+
restrainCodeBlockHeight(elems);
156+
}
157+
158+
function toggleLineWrap(elem) {
159+
modifyClass(elem, 'pre_wrap');
160+
// retain max number of code lines on line wrap
161+
const lines = elems(lineClass, elem);
162+
restrainCodeBlockHeight(lines);
163+
}
164+
165+
function copyCode(codeElement) {
166+
lineNumbers = elems('.ln', codeElement);
167+
// remove line numbers before copying
168+
if(lineNumbers.length) {
169+
lineNumbers.forEach(function(line){
170+
line.remove();
171+
});
172+
}
173+
174+
const codeToCopy = codeElement.textContent;
175+
// copy code
176+
copyToClipboard(codeToCopy);
177+
}
178+
179+
function disableCodeLineNumbers(block){
180+
const lines = elems(lineClass, block)
181+
toggleLineNumbers(lines);
182+
}
183+
184+
(function codeActions(){
185+
const blocks = codeBlocks();
186+
187+
const highlightWrapId = highlightWrap;
188+
blocks.forEach(function(block){
189+
// disable line numbers if disabled globally
190+
const showLines = elem('body').dataset.lines;
191+
parseBoolean(showLines) === false ? disableCodeLineNumbers(block) : false;
192+
193+
const highlightElement = block.parentNode.parentNode;
194+
// wrap code block in a div
195+
const highlightWrapper = createEl();
196+
highlightWrapper.className = highlightWrapId;
197+
wrapEl(highlightElement, highlightWrapper);
198+
199+
const panel = actionPanel();
200+
// show wrap icon only if the code block needs wrapping
201+
const wrapIcon = elem(`.${wrapId}`, panel);
202+
codeBlockFits(block) ? false : deleteClass(wrapIcon, panelHide);
203+
204+
// append buttons
205+
highlightWrapper.appendChild(panel);
206+
});
207+
208+
function isItem(target, id) {
209+
// if is item or within item
210+
return target.matches(`.${id}`) || target.closest(`.${id}`);
211+
}
212+
213+
function showActive(target, targetClass,activeClass = 'active') {
214+
const active = activeClass;
215+
const targetElement = target.matches(`.${targetClass}`) ? target : target.closest(`.${targetClass}`);
216+
217+
deleteClass(targetElement, active);
218+
setTimeout(function() {
219+
modifyClass(targetElement, active)
220+
}, 50)
221+
}
222+
223+
doc.addEventListener('click', function(event){
224+
// copy code block
225+
const target = event.target;
226+
const isCopyIcon = isItem(target, copyId);
227+
const isWrapIcon = isItem(target, wrapId);
228+
const isLinesIcon = isItem(target, linesId);
229+
const isExpandIcon = isItem(target, panelExpand);
230+
const isActionable = isCopyIcon || isWrapIcon || isLinesIcon || isExpandIcon;
231+
232+
if(isActionable) {
233+
event.preventDefault();
234+
showActive(target, 'icon');
235+
const codeElement = target.closest(`.${highlightWrapId}`).firstElementChild.firstElementChild;
236+
let lineNumbers = elems(lineClass, codeElement);
237+
238+
isWrapIcon ? toggleLineWrap(codeElement) : false;
239+
240+
isLinesIcon ? toggleLineNumbers(lineNumbers) : false;
241+
242+
if (isExpandIcon) {
243+
let thisCodeBlock = codeElement.firstElementChild;
244+
const outerBlock = thisCodeBlock.closest('.highlight');
245+
if(maxHeightIsSet(thisCodeBlock)) {
246+
thisCodeBlock.style.maxHeight = fullHeight;
247+
// mark code block as expanded
248+
pushClass(outerBlock, panelExpanded)
249+
} else {
250+
thisCodeBlock.style.maxHeight = thisCodeBlock.dataset.height;
251+
// unmark code block as expanded
252+
deleteClass(outerBlock, panelExpanded)
253+
}
254+
}
255+
256+
if(isCopyIcon) {
257+
// clone code element
258+
const codeElementClone = codeElement.cloneNode(true);
259+
copyCode(codeElementClone);
260+
}
261+
}
262+
});
263+
264+
(function addLangLabel() {
265+
const blocks = codeBlocks();
266+
blocks.forEach(function(block){
267+
let label = block.dataset.lang;
268+
label = label === 'sh' ? 'bash' : label;
269+
if(label !== "fallback") {
270+
const labelEl = createEl();
271+
labelEl.textContent = label;
272+
pushClass(labelEl, 'lang');
273+
block.closest(`.${highlightWrap}`).appendChild(labelEl);
274+
}
275+
});
276+
})();
277+
})();

themes/clarity/assets/js/custom.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// add custom js in this file

0 commit comments

Comments
 (0)