mirror of
https://github.com/avitex/avitex.github.io
synced 2025-01-15 20:39:57 +00:00
Compare commits
4 Commits
e8188dad73
...
1aa90ec3f6
Author | SHA1 | Date | |
---|---|---|---|
|
1aa90ec3f6 | ||
|
9868ccb7d0 | ||
|
f8099a6ec1 | ||
|
f93b184983 |
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -10,7 +10,7 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Build and deploy
|
- name: Build and deploy
|
||||||
uses: shalzz/zola-deploy-action@v0.12.0
|
uses: shalzz/zola-deploy-action@v0.15.2
|
||||||
env:
|
env:
|
||||||
PAGES_BRANCH: master
|
PAGES_BRANCH: master
|
||||||
BUILD_DIR: .
|
BUILD_DIR: .
|
||||||
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2018-2021 James Dyson
|
Copyright (c) 2018-2022 James Dyson
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -2,11 +2,12 @@ title = "1bit.pw"
|
|||||||
base_url = "https://1bit.pw"
|
base_url = "https://1bit.pw"
|
||||||
description = "Home of avitex"
|
description = "Home of avitex"
|
||||||
|
|
||||||
|
minify_html = true
|
||||||
compile_sass = true
|
compile_sass = true
|
||||||
|
generate_feed = true
|
||||||
build_search_index = true
|
build_search_index = true
|
||||||
generate_rss = true
|
|
||||||
|
|
||||||
taxonomies = [{ name = "blog/tags", rss = true }]
|
taxonomies = [{ name = "blog/tags", feed = true }]
|
||||||
|
|
||||||
[markdown]
|
[markdown]
|
||||||
highlight_code = true
|
highlight_code = true
|
||||||
|
@ -10,8 +10,8 @@ PRs are always welcome, see my [about page](@/about/_index.md) to contact me.
|
|||||||
|
|
||||||
## Rust
|
## Rust
|
||||||
|
|
||||||
{{ projects(lang="rust") }}
|
{{ projects(for_lang="rust") }}
|
||||||
|
|
||||||
## Elixir
|
## Elixir
|
||||||
|
|
||||||
{{ projects(lang="elixir") }}
|
{{ projects(for_lang="elixir") }}
|
@ -39,13 +39,13 @@ function makeTeaser(body, terms) {
|
|||||||
});
|
});
|
||||||
var termFound = false;
|
var termFound = false;
|
||||||
var index = 0;
|
var index = 0;
|
||||||
var weighted = []; // contains elements of ['word', weight, index_in_document]
|
var weighted = []; // contains elements of ["word", weight, index_in_document]
|
||||||
|
|
||||||
// split in sentences, then words
|
// split in sentences, then words
|
||||||
var sentences = body.toLowerCase().split('. ');
|
var sentences = body.toLowerCase().split(". ");
|
||||||
|
|
||||||
for (var i in sentences) {
|
for (var i in sentences) {
|
||||||
var words = sentences[i].split(' ');
|
var words = sentences[i].split(" ");
|
||||||
var value = FIRST_WORD_WEIGHT;
|
var value = FIRST_WORD_WEIGHT;
|
||||||
|
|
||||||
for (var j in words) {
|
for (var j in words) {
|
||||||
@ -113,44 +113,40 @@ function makeTeaser(body, terms) {
|
|||||||
|
|
||||||
// add <em/> around search terms
|
// add <em/> around search terms
|
||||||
if (word[1] === TERM_WEIGHT) {
|
if (word[1] === TERM_WEIGHT) {
|
||||||
teaser.push('<b>');
|
teaser.push("<b>");
|
||||||
}
|
}
|
||||||
startIndex = word[2] + word[0].length;
|
startIndex = word[2] + word[0].length;
|
||||||
teaser.push(body.substring(word[2], startIndex));
|
teaser.push(body.substring(word[2], startIndex));
|
||||||
|
|
||||||
if (word[1] === TERM_WEIGHT) {
|
if (word[1] === TERM_WEIGHT) {
|
||||||
teaser.push('</b>');
|
teaser.push("</b>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
teaser.push('…');
|
teaser.push("…");
|
||||||
return teaser.join('');
|
return teaser.join("");
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatSearchResultItem(item, terms) {
|
function formatSearchResultItem(item, terms) {
|
||||||
return '<div class="result">'
|
return '<div class="search-results__item">'
|
||||||
+ `<a href="${item.ref}">${item.doc.title}</a>`
|
+ `<a href="${item.ref}">${item.doc.title}</a>`
|
||||||
+ `<div class="summary">${makeTeaser(item.doc.body, terms)}</div>`
|
+ `<div>${makeTeaser(item.doc.body, terms)}</div>`
|
||||||
+ '</div>';
|
+ '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function initSearch() {
|
function initSearch() {
|
||||||
var $searchComponent = document.getElementById('search');
|
var $searchInput = document.getElementById("search");
|
||||||
if ($searchComponent === null) {
|
var $searchResults = document.querySelector(".search-results");
|
||||||
return;
|
var $searchResultsItems = document.querySelector(".search-results__items");
|
||||||
}
|
|
||||||
var $searchInput = $searchComponent.querySelector('input');
|
|
||||||
var $searchResults = $searchComponent.querySelector('.results-container');
|
|
||||||
var $searchResultsItems = $searchComponent.querySelector('.results');
|
|
||||||
var MAX_ITEMS = 10;
|
var MAX_ITEMS = 10;
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
bool: 'AND',
|
bool: "AND",
|
||||||
fields: {
|
fields: {
|
||||||
title: {boost: 2},
|
title: {boost: 2},
|
||||||
body: {boost: 1},
|
body: {boost: 1},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var currentTerm = '';
|
var currentTerm = "";
|
||||||
var index = elasticlunr.Index.load(window.searchIndex);
|
var index = elasticlunr.Index.load(window.searchIndex);
|
||||||
|
|
||||||
$searchInput.addEventListener("keyup", debounce(function() {
|
$searchInput.addEventListener("keyup", debounce(function() {
|
||||||
@ -158,31 +154,38 @@ function initSearch() {
|
|||||||
if (term === currentTerm || !index) {
|
if (term === currentTerm || !index) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$searchResults.style.display = term === '' ? 'none' : 'block';
|
$searchResults.style.display = term === "" ? "none" : "block";
|
||||||
$searchResultsItems.innerHTML = '';
|
$searchResultsItems.innerHTML = "";
|
||||||
if (term === '') {
|
if (term === "") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var results = index.search(term, options);
|
var results = index.search(term, options);
|
||||||
if (results.length === 0) {
|
if (results.length === 0) {
|
||||||
$searchResults.style.display = 'none';
|
$searchResults.style.display = "none";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentTerm = term;
|
currentTerm = term;
|
||||||
for (var i = 0; i < Math.min(results.length, MAX_ITEMS); i++) {
|
for (var i = 0; i < Math.min(results.length, MAX_ITEMS); i++) {
|
||||||
var item = document.createElement('li');
|
var item = document.createElement("li");
|
||||||
item.innerHTML = formatSearchResultItem(results[i], term.split(' '));
|
item.innerHTML = formatSearchResultItem(results[i], term.split(" "));
|
||||||
$searchResultsItems.appendChild(item);
|
$searchResultsItems.appendChild(item);
|
||||||
}
|
}
|
||||||
}, 150));
|
}, 150));
|
||||||
|
|
||||||
|
window.addEventListener('click', function(e) {
|
||||||
|
if ($searchResults.style.display == "block" && !$searchResults.contains(e.target)) {
|
||||||
|
$searchResults.style.display = "none";
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.readyState === 'complete' ||
|
|
||||||
(document.readyState !== 'loading' && !document.documentElement.doScroll)
|
if (document.readyState === "complete" ||
|
||||||
|
(document.readyState !== "loading" && !document.documentElement.doScroll)
|
||||||
) {
|
) {
|
||||||
initSearch();
|
initSearch();
|
||||||
} else {
|
} else {
|
||||||
document.addEventListener('DOMContentLoaded', initSearch);
|
document.addEventListener("DOMContentLoaded", initSearch);
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
{% import "post_macros.html" as post_macros %}
|
{% import "post_macros.html" as post_macros %}
|
||||||
{% block title %}Tag {{ term.name }} - {{ config.title }}{% endblock %}
|
{% block title %}Tag {{ term.name }} - {{ config.title }}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Tag: <code>{{ term.name }}</code> <small>(<a href="{{ get_taxonomy_url(kind="blog/tags", name=term.name) }}rss.xml">RSS</a>)</small></h1>
|
<h1>Tag: <code>{{ term.name }}</code> <small>(<a href="{{ get_taxonomy_url(kind="blog/tags", name=term.name) }}atom.xml">RSS</a>)</small></h1>
|
||||||
{% for page in term.pages %}
|
{% for page in term.pages %}
|
||||||
{{ post_macros::page_in_list(page=page) }}
|
{{ post_macros::page_in_list(page=page) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<link rel="stylesheet" href="{{ get_url(path="site.css", cachebust=true) | safe }}" />
|
<link rel="stylesheet" href="{{ get_url(path="site.css", cachebust=true) | safe }}" />
|
||||||
<link rel="stylesheet" href="{{ get_url(path="fonts.min.css") | safe }}" />
|
<link rel="stylesheet" href="{{ get_url(path="fonts.min.css") | safe }}" />
|
||||||
<link rel="icon" type="image/png" href="{{ get_url(path="favicon.png") | safe }}" />
|
<link rel="icon" type="image/png" href="{{ get_url(path="favicon.png") | safe }}" />
|
||||||
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ get_url(path="rss.xml") | safe }}" />
|
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ get_url(path="atom.xml") | safe }}" />
|
||||||
<title>{% block title %}{{ config.title }}{% endblock title %}</title>
|
<title>{% block title %}{{ config.title }}{% endblock title %}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for project_name, project in data.project %}
|
{% for project_name, project in data.project %}
|
||||||
{% if project.lang == lang %}
|
{% if project.lang == for_lang %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>{{ project_name }}</code></td>
|
<td><code>{{ project_name }}</code></td>
|
||||||
<td><a href="https://github.com/{{ project.github }}">github</a></td>
|
<td><a href="https://github.com/{{ project.github }}">github</a></td>
|
||||||
|
Loading…
Reference in New Issue
Block a user