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

add tags using handlebars, update styles #37

Merged
merged 3 commits into from
Nov 6, 2023
Merged
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
1 change: 1 addition & 0 deletions preview-src/examples/quickstart.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:astra-link: https://astra.datastax.com
:astra-nodejs-link: https://docs.datastax.com/en/astra-serverless/docs/develop/sdks/rest-nodejs-client.html
:astra-json-link: https://docs.datastax.com/en/astra-serverless/docs/develop/dev-with-json.html
:page-tags: Machine Learning Frameworks, Embeding Services, Astra, SDK
:keywords: Machine Learning Frameworks, Embeding Services, Astra, SDK

== Objective
Expand Down
9 changes: 5 additions & 4 deletions src/css/toc.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
color: var(--toc-heading-font-color);
font-size: calc(16 / var(--rem-base) * 1rem);
font-weight: var(--body-font-weight-bold);
line-height: 1.3;
margin: 0 -0.5px;
line-height: 1.5;
margin: 0;
padding-bottom: var(--ds-space-2);
}

Expand Down Expand Up @@ -103,7 +103,7 @@

.toc .toc-menu a.is-active {
border-left-color: var(--link-font-color);
color: var(--doc-font-color);
color: var(--link-font-color);
}

.sidebar.toc .toc-menu a:focus {
Expand Down Expand Up @@ -131,7 +131,8 @@
flex-wrap: wrap;
}

.toc .toc-tags span,
.toc .toc-tags .tag,
.tags-container .tag,
.tags-container span {
display: flex;
padding: var(--ds-space-q) var(--ds-space-1h);
Expand Down
3 changes: 2 additions & 1 deletion src/css/vars.css
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@
--table-footer-background: linear-gradient(to bottom, var(--ds-background-level1) 0%, var(--ds-background-body) 100%);
/* toc */
--toc-font-color: var(--ds-text-secondary);
--toc-heading-font-color: var(--doc-font-color);
--toc-menu-font-weight: var(--body-font-weight-bold);
--toc-heading-font-color: var(--ds-text-primary);
--toc-border-color: var(--ds-divider);
--toc-line-height: 1.5;
/* footer */
Expand Down
10 changes: 10 additions & 0 deletions src/helpers/split.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict'

module.exports = (val, char) => {
if (typeof val === 'string') {
const arr = val.split(char)
return arr
} else {
throw new Error('{{split}} helper expects a string argument')
}
}
33 changes: 6 additions & 27 deletions src/js/08-toc-rail.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
;(function () {
'use strict'
/* content rail */

/* toc container */
var toc = document.querySelector('aside.toc.sidebar')

if (toc) {
tags(toc)
}

function tags (toc) {
var tagList = document.getElementsByTagName('meta').keywords
if (tagList) {
var title = document.createElement('h3')
title.textContent = 'Tags'
var list = tagList.content.split(',')
var container = toc.querySelector('.toc-tags')
var tags = document.createElement('div')
list.forEach((s) => {
var el = document.createElement('span')
el.textContent = s
tags.appendChild(el)
})
container.appendChild(title)
container.appendChild(tags)
}
}
})()
// ;(function () {
// 'use strict'
// // content
//
// })()
11 changes: 10 additions & 1 deletion src/partials/toc.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
<aside class="toc sidebar" data-title="{{{or page.attributes.toctitle 'Contents'}}}" data-levels="{{{or page.attributes.toclevels 2}}}">
<div class="toc-menu-container">
<div class="toc-menu"></div>
<div class="toc-menu toc-tags"></div>
<div class="toc-menu toc-tags">
{{#if page.attributes.tags}}
<h3>Tags</h3>
<div>
{{#each (split page.attributes.tags ", ") }}
<span class="tag">{{this}}</span>
{{/each}}
</div>
{{/if}}
</div>
<div class="toc-menu toc-dev">
{{#if page.versions}}
<h3>Developer Resources</h3>
Expand Down
Loading