add: wikibonsai changes.

This commit is contained in:
manunamz
2023-10-03 10:58:17 -04:00
parent 8e2152a560
commit f87f774b2a
26 changed files with 4811 additions and 54 deletions
+77
View File
@@ -0,0 +1,77 @@
---
// import { getCollection } from 'astro:content';
import { generateBackRefs } from '../wikibonsai/backrefs';
const { frontmatter } = Astro.props;
const res = await generateBackRefs(frontmatter.fname);
const backattrs = res.backattrs;
const backlinks = res.backlinks;
---
<style>
li {
list-style: '';
}
.back-refs {
padding: 2em 1em 6em 1em;
margin: 2em;
border: 1px solid #ccc!important;
border-radius: 25px;
}
.title {
color: #4F534F;
text-align: center;
margin-bottom: 1em;
}
.sections {
display: flex;
align-items: start;
justify-content: space-evenly;
}
.section-title {
color: #4F534F;
text-align: center;
}
.attrtype {
padding-left: 0px;
}
</style>
<div class="back-refs">
<h5 class="title">Links To This Page</h5>
<div class="sections">
<div>
<span class="section-title">Attributes</span>
<ul class="attrtype">
{Object.entries(backattrs).map(([type, attrs]) =>
<li>
{type} :
<ul>
{attrs.map((attr: any) =>
<li>
{attr.htmlHref ?
<a class="wiki" href={attr.htmlHref}>{attr.htmlText}</a>
:
<a class="invalid">{attr.htmlText}</a>
}
</li>
)}
</ul>
</li>
)}
</ul>
</div>
<div>
<span class="section-title">Links</span>
<ul>
{backlinks.map((link: any) =>
<li>
{link.htmlHref ?
<a class="wiki" href={link.htmlHref}>{link.htmlText}{link.type ? ` (${link.type})` : ''}</a>
:
<a class="invalid">{link.htmlText}{link.linktype ? ` (${link.linktype})` : ''}</a>
}
</li>
)}
</ul>
</div>
</div>
+25
View File
@@ -0,0 +1,25 @@
---
import { getCollection } from 'astro:content';
import { SITE_TITLE } from '../consts';
import { bonsai } from '../wikibonsai/semtree';
const { nodes } = Astro.props;
const root = bonsai ? bonsai.root : '';
const tree = bonsai ? bonsai.tree : [];
---
<!-- from: https://stackoverflow.com/questions/74126716/how-to-self-reference-astro-component -->
<ul class="branch">
{nodes.map(node =>
<li>
{node.url ?
<a class="wiki" href={node.url}>{node.text}</a>
:
<a class="invalid">{node.text}</a>
}
<Astro.self nodes={node.children.map(child =>
tree.find(treeNode => treeNode.text == child)
)} />
</li>
)}
</ul>
+48
View File
@@ -0,0 +1,48 @@
---
import { SITE_TITLE } from '../consts';
import { bonsai } from '../wikibonsai/semtree';
const { current } = Astro.props;
const root = bonsai ? bonsai.root : '';
const tree = bonsai ? bonsai.tree : [];
const curNode = tree.find(node => node.text == current);
const ancestors = curNode ? curNode.ancestors : [];
const ancestorNodes = ancestors.map(n => tree.find(tn => tn.text == n));
---
<style>
ol {
list-style: '> ';
display: flex;
align-self: center;
overflow-x: scroll;
white-space: nowrap;
padding-left: 0em;
}
li {
padding-right: 1.5em;
}
.site-item {
list-style: none;
}
</style>
<nav calss="bread-crumbs">
<ol>
<li class="site-item">
<a href="/">{SITE_TITLE}</a>
</li>
{ancestorNodes.map(node =>
<li>
{node.url ?
<a class="wiki" href={node.url}>{node.text}</a>
:
<a class="invalid">{node.text}</a>
}
</li>
)}
<li>
{current}
</li>
</ol>
</nav>
+3 -17
View File
@@ -3,23 +3,9 @@ const today = new Date();
---
<footer>
&copy; {today.getFullYear()} Your name here. All rights reserved.
<p>🪴 Grown with 💚 from an <a href="https://github.com/wikibonsai/astro-wikibonsai">astro-wikibonsai</a></p>
<div class="social-links">
<a href="https://m.webtoo.ls/@astro" target="_blank">
<span class="sr-only">Follow Astro on Mastodon</span>
<svg
viewBox="0 0 16 16"
aria-hidden="true"
width="32"
height="32"
astro-icon="social/mastodon"
><path
fill="currentColor"
d="M11.19 12.195c2.016-.24 3.77-1.475 3.99-2.603.348-1.778.32-4.339.32-4.339 0-3.47-2.286-4.488-2.286-4.488C12.062.238 10.083.017 8.027 0h-.05C5.92.017 3.942.238 2.79.765c0 0-2.285 1.017-2.285 4.488l-.002.662c-.004.64-.007 1.35.011 2.091.083 3.394.626 6.74 3.78 7.57 1.454.383 2.703.463 3.709.408 1.823-.1 2.847-.647 2.847-.647l-.06-1.317s-1.303.41-2.767.36c-1.45-.05-2.98-.156-3.215-1.928a3.614 3.614 0 0 1-.033-.496s1.424.346 3.228.428c1.103.05 2.137-.064 3.188-.189zm1.613-2.47H11.13v-4.08c0-.859-.364-1.295-1.091-1.295-.804 0-1.207.517-1.207 1.541v2.233H7.168V5.89c0-1.024-.403-1.541-1.207-1.541-.727 0-1.091.436-1.091 1.296v4.079H3.197V5.522c0-.859.22-1.541.66-2.046.456-.505 1.052-.764 1.793-.764.856 0 1.504.328 1.933.983L8 4.39l.417-.695c.429-.655 1.077-.983 1.934-.983.74 0 1.336.259 1.791.764.442.505.661 1.187.661 2.046v4.203z"
></path></svg
>
</a>
<a href="https://twitter.com/astrodotbuild" target="_blank">
<a href="https://twitter.com/wibomd" target="_blank">
<span class="sr-only">Follow Astro on Twitter</span>
<svg viewBox="0 0 16 16" aria-hidden="true" width="32" height="32" astro-icon="social/twitter"
><path
@@ -28,7 +14,7 @@ const today = new Date();
></path></svg
>
</a>
<a href="https://github.com/withastro/astro" target="_blank">
<a href="https://github.com/wikibonsai/wikibonsai" target="_blank">
<span class="sr-only">Go to Astro's GitHub repo</span>
<svg viewBox="0 0 16 16" aria-hidden="true" width="32" height="32" astro-icon="social/github"
><path
+3 -11
View File
@@ -8,20 +8,12 @@ import { SITE_TITLE } from '../consts';
<h2><a href="/">{SITE_TITLE}</a></h2>
<div class="internal-links">
<HeaderLink href="/">Home</HeaderLink>
<HeaderLink href="/map">Map</HeaderLink>
<HeaderLink href="/blog">Blog</HeaderLink>
<HeaderLink href="/about">About</HeaderLink>
</div>
<div class="social-links">
<a href="https://m.webtoo.ls/@astro" target="_blank">
<span class="sr-only">Follow Astro on Mastodon</span>
<svg viewBox="0 0 16 16" aria-hidden="true" width="32" height="32"
><path
fill="currentColor"
d="M11.19 12.195c2.016-.24 3.77-1.475 3.99-2.603.348-1.778.32-4.339.32-4.339 0-3.47-2.286-4.488-2.286-4.488C12.062.238 10.083.017 8.027 0h-.05C5.92.017 3.942.238 2.79.765c0 0-2.285 1.017-2.285 4.488l-.002.662c-.004.64-.007 1.35.011 2.091.083 3.394.626 6.74 3.78 7.57 1.454.383 2.703.463 3.709.408 1.823-.1 2.847-.647 2.847-.647l-.06-1.317s-1.303.41-2.767.36c-1.45-.05-2.98-.156-3.215-1.928a3.614 3.614 0 0 1-.033-.496s1.424.346 3.228.428c1.103.05 2.137-.064 3.188-.189zm1.613-2.47H11.13v-4.08c0-.859-.364-1.295-1.091-1.295-.804 0-1.207.517-1.207 1.541v2.233H7.168V5.89c0-1.024-.403-1.541-1.207-1.541-.727 0-1.091.436-1.091 1.296v4.079H3.197V5.522c0-.859.22-1.541.66-2.046.456-.505 1.052-.764 1.793-.764.856 0 1.504.328 1.933.983L8 4.39l.417-.695c.429-.655 1.077-.983 1.934-.983.74 0 1.336.259 1.791.764.442.505.661 1.187.661 2.046v4.203z"
></path></svg
>
</a>
<a href="https://twitter.com/astrodotbuild" target="_blank">
<a href="https://twitter.com/wibomd" target="_blank">
<span class="sr-only">Follow Astro on Twitter</span>
<svg viewBox="0 0 16 16" aria-hidden="true" width="32" height="32"
><path
@@ -30,7 +22,7 @@ import { SITE_TITLE } from '../consts';
></path></svg
>
</a>
<a href="https://github.com/withastro/astro" target="_blank">
<a href="https://github.com/wikibonsai/wikibonsai" target="_blank">
<span class="sr-only">Go to Astro's GitHub repo</span>
<svg viewBox="0 0 16 16" aria-hidden="true" width="32" height="32"
><path