From 6dcec618d0ff0a2270f787f62267a0622275c69d Mon Sep 17 00:00:00 2001 From: Jieiku Date: Mon, 22 May 2023 22:37:44 -0700 Subject: Load Tinysearch/Stork On Demand --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 4f4d844..6c52a69 100644 --- a/README.md +++ b/README.md @@ -162,13 +162,18 @@ stork demo: https://jieiku.github.io/abridge-stork/ **Switch to tinysearch:** First you have to install tinysearch so that you can build the index: +(you also need to download the latest stork.wasm into the abridge static folder) ```shell +sudo pacman -S install wasm-pack binaryen git clone https://github.com/tinysearch/tinysearch cd tinysearch cargo build --release sudo cp ./target/release/tinysearch /usr/local/bin/tinysearch exit # reload shell environment + +cd ~/.dev/abridge/static +curl -s https://api.github.com/repos/jameslittle230/stork/releases/latest | grep "browser_download_url.*stork.wasm" | cut -d : -f 2,3 | tr -d \" | wget -i - ``` Switch abridge to tinysearch: @@ -192,6 +197,7 @@ git clone https://github.com/jameslittle230/stork cd stork cargo build --release sudo cp ./target/release/stork /usr/local/bin/stork + exit # reload shell environment ``` @@ -305,7 +311,7 @@ Abridge Alternate Bundles: Support Files: - theme.min.js (not a bundle, just a minification of theme.js) -- katexbundle.min.js - includes: katex.min.js mathtex-script-type.min.js auto-render.min.js katexoptions.js +- katexbundle.min.js - includes: katex.min.js mathtex-script-type.min.js katex-auto-render.min.js katexoptions.js - search_bundle.min.js: includes: search_index.en, elasticlunr, search (loaded on demand by search_facade) ### Global Configuration -- cgit v1.3.1 From d86932ad935e5e50de05c4c7125a5930b1862c1d Mon Sep 17 00:00:00 2001 From: Jieiku Date: Mon, 22 May 2023 23:35:14 -0700 Subject: Update Readme, Examples, Screenshot --- README.md | 574 ++++++++++--------------------------- content/overview-abridge.fr.md | 46 ++- content/overview-abridge.md | 46 ++- content/overview-code-blocks.fr.md | 66 +++-- content/overview-code-blocks.md | 66 +++-- screenshot.png | Bin 109213 -> 122329 bytes templates/posts.html | 3 + 7 files changed, 304 insertions(+), 497 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 6c52a69..af5b2c3 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Maintenance of this project is made possible by all the 2.22 KB Leanified: 11 B (0.48%) -Processing: android-chrome-192x192.png -2.51 KB -> 2.48 KB Leanified: 33 B (1.28%) -Processing: android-chrome-512x512.png -5.49 KB -> 5.25 KB Leanified: 241 B **(4.29%)** -Processing: apple-touch-icon.png -2.57 KB -> 2.54 KB Leanified: 30 B (1.14%) -Processing: banner.png -13.07 KB -> 12.93 KB Leanified: 138 B (1.03%) -Processing: mstile-150x150.png -2.24 KB -> 2.20 KB Leanified: 38 B (1.66%) -Processing: favicon-16x16.png -559 B -> 366 B Leanified: 193 B **(34.53%)** -Processing: favicon-32x32.png -969 B -> 663 B Leanified: 306 B **(31.58%)** -Processing: favicon.ico -2.59 KB -> 1.90 KB Leanified: 703 B **(26.53%)** -``` - -Google lighthouse will often notice when your pictures could be more compressed, this may even help SEO. - - ### Pre gzip/brotli content to serve with nginx: If you are serving your site with nginx, you can pre gzip your content. @@ -630,24 +368,18 @@ rsync -zvrh ~/.dev/abridge/public/ web:/var/www/abridge Nginx does not come by default with brotli support, but adding it was not difficult. -## Reporting Issues - -We use GitHub Issues as the official bug tracker for **abridge**. -Please search [existing issues](https://github.com/jieiku/abridge/issues). -It’s possible someone has already reported the same problem. -If your problem or idea is not addressed yet, [open a new issue](https://github.com/jieiku/abridge/issues/new). +(Netlify brotli gzips your files automatically, no exta work required.) ## Contributing and Philosophy We'd love your help! Especially with fixes to issues. -The overall idea behind abridge is to be lightweight and fast, and to work properly even if javascript is disabled. +The overall idea behind abridge is to be lightweight, fast, and to work properly even if javascript is disabled. -The only feature that some people may consider a necessity that relies on javascript is the Search. +The only feature that may be considered a necessity that relies on javascript is the Search. -Any feature added to abridge that relies on javascript will do so with it disabled by default. +New features that rely on javascript will do so with it disabled by default unless lightweight and useful. ## License -**abridge** is distributed under the terms of the -[MIT license](https://github.com/jieiku/abridge/blob/master/LICENSE). +**abridge** is distributed under the terms of the [MIT license](https://github.com/jieiku/abridge/blob/master/LICENSE). diff --git a/content/overview-abridge.fr.md b/content/overview-abridge.fr.md index d38ced9..1fda697 100644 --- a/content/overview-abridge.fr.md +++ b/content/overview-abridge.fr.md @@ -16,11 +16,49 @@ Vous pouvez ensuite modifier ou commenter les valeurs de ce fichier si nécessai Vous devez également décommenter la ligne #theme = "abridge" dans votre fichier racine zola config.toml. Cela indique à votre site racine zola d'utiliser le thème abrégé dans le dossier des thèmes. -Vous pouvez définir le nombre d'éléments qui apparaissent sur la page d'accueil en modifiant `themes\abridge\content\_index.md` le fichier et en ajustant `paginate_by = 5` +## Pagination -Vous pouvez définir la largeur globale de la page en éditant `themes\abridge\sass\_variables.scss` le fichier et en ajustant ces deux lignes: +Vous pouvez définir le nombre d'éléments qui apparaissent sur la page d'accueil en modifiant `content\_index.md` le fichier et en ajustant `paginate_by = 3` + +## Sass Overrides + +Les variables SCSS abrégées peuvent être remplacées en modifiant `sass\abridge.scss` fichier dans le dossier sass racine de votre projet. + +### Page Width + +```scss +$mw:75%,// largeur maximale +``` + +### Abridge Theme Modes ```scss -$mw:50% !default;// largeur maximale -$mb:1200px !default;// valeur à laquelle passer de la disposition fluide à l'utilisation de la largeur maximale +$abridgeMode: "switcher",//valeurs valides : switcher, auto, dark, light ``` + +### Colors and Styles + +Vous pouvez spécifier le modèle de couleur que vous souhaitez utiliser comme base: +```scss +$color: "orange",// modèle de couleur à utiliser/remplacer: orange, blue, blueshade +``` + +Remplacez ensuite les couleurs individuelles si nécessaire: +```scss +/// Dark Colors +$f1d: #ccc,// Font Color Primary +$f2d: #ddd,// Font Color Headers +$c1d: #111,// Background Color Primary +$c2d: #222,// Background Color Secondary +... +``` + +### Footer Social Icons + +Vous devez configurer les icônes sociales que vous prévoyez d'utiliser. (rend la taille du fichier css plus petite) + +Pour les désactiver tous simplement, vous pouvez définir `$enable-icons: false` + +Sinon, activez uniquement les icônes dont vous avez besoin, par exemple pour le courrier que vous définiriez `$icon-mail: true` + +Vous devez ensuite désactiver toutes les icônes que vous n'utilisez pas. diff --git a/content/overview-abridge.md b/content/overview-abridge.md index 93e740b..f68ef2f 100644 --- a/content/overview-abridge.md +++ b/content/overview-abridge.md @@ -16,11 +16,49 @@ You can then edit or comment out the values in this file as necessary. You should also uncomment out the line #theme = "abridge" in your root zola config.toml file. This tells your root zola site to use the abridge theme in the themes folder. -You can set the number of items that appear on the home page by editing `themes\abridge\content\_index.md` file and adjusting `paginate_by = 5` +## Pagination -You can set the overal page width by editing `themes\abridge\sass\_variables.scss` file, and adjusting these two lines: +You can set the number of items that appear on the home page by editing `content\_index.md` file and adjusting `paginate_by = 3` + +## Sass Overrides + +Abridge SCSS variables can be overrided by editing `sass\abridge.scss` file in your project's root sass folder. + +### Page Width + +```scss +$mw:75%,// max-width +``` + +### Abridge Theme Modes ```scss -$mw:50% !default;// max-width -$mb:1200px !default;// value at which to switch from fluid layout to using max-width +$abridgeMode: "switcher",//valid values: switcher, auto, dark, light ``` + +### Colors and Styles + +You can specify which color template you want to use as a base: +```scss +$color: "orange",// color template to use/override: orange, blue, blueshade +``` + +Then override individual colors as needed: +```scss +/// Dark Colors +$f1d: #ccc,// Font Color Primary +$f2d: #ddd,// Font Color Headers +$c1d: #111,// Background Color Primary +$c2d: #222,// Background Color Secondary +... +``` + +### Footer Social Icons + +You should configure which social icons you plan to use. (makes the css file size smaller) + +To simply turn them all off you can set `$enable-icons: false` + +Otherwise enable only the icons you need, eg for mail you would set `$icon-mail: true` + +You should then disable all the icons that you do not use. diff --git a/content/overview-code-blocks.fr.md b/content/overview-code-blocks.fr.md index a21c15a..b640069 100644 --- a/content/overview-code-blocks.fr.md +++ b/content/overview-code-blocks.fr.md @@ -99,6 +99,38 @@ taxonomies = [ ``` +### CSS +```css +html { + font-size: var(--fs); +} + +.c { + text-align: center; +} +``` + +### SCSS +```scss + +$font: Roboto system-ui -apple-system BlinkMacSystemFont "Segoe UI" Oxygen Ubuntu Cantarell "Fira Sans" "Droid Sans" "Helvetica Neue" "Noto Sans" Helvetica Arial sans-serif !default; +$font-mono: ui-monospace Menlo Monaco Consolas "SF Mono" "Cascadia Mono" "Segoe UI Mono" "DejaVu Sans Mono" "Liberation Mono" "Roboto Mono" "Oxygen Mono" "Ubuntu Monospace" "Ubuntu Mono" "Source Code Pro" "Fira Mono" "Droid Sans Mono" "Courier New" Courier monospace !default; + +@mixin font { + // convert space separated list to comma separated list + $font: list.join($font, "", $separator: comma); + $font: functions.remove($font, ""); + $font-mono: list.join($font-mono, "", $separator: comma); + $font-mono: functions.remove($font-mono, ""); + + $font: functions.font-var($font, $fontExt-Main, $findFont-Main); + $font-mono: functions.font-var($font-mono, $fontExt-Code, $findFont-Code); + + #{--ff}: $font; + #{--fm}: $font-mono;//code +} +``` + ### javascript ```javascript function closeSearch() {//close the search displaying the regular page. @@ -343,37 +375,3 @@ for yr in lwr..upr do end end ``` - -### SCSS -```scss - -$font: "Roboto", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Noto Sans", Helvetica, Arial, sans-serif !default; -$font-mono: ui-monospace, Menlo, Monaco, Consolas, "SF Mono", "Cascadia Mono", "Segoe UI Mono", "DejaVu Sans Mono", "Liberation Mono", "Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Ubuntu Mono", "Source Code Pro", "Fira Mono", "Droid Sans Mono", "Courier New", Courier, monospace !default; - -@mixin root { - #{--ff}: $font; - #{--fm}: $font-mono;//code - - --fs: 1rem; //font-size - - // Responsive typography - @if $enable-responsive-typography { - @if map-get($breakpoints, "lg") { - @media (min-width: map-get($breakpoints, "lg")) { - --fs: 1.08rem; - } - } - } -} -``` - -### CSS -```css -html { - font-size: var(--fs); -} - -.c { - text-align: center; -} -``` diff --git a/content/overview-code-blocks.md b/content/overview-code-blocks.md index 916dcc1..46f5922 100644 --- a/content/overview-code-blocks.md +++ b/content/overview-code-blocks.md @@ -99,6 +99,38 @@ taxonomies = [ ``` +### CSS +```css +html { + font-size: var(--fs); +} + +.c { + text-align: center; +} +``` + +### SCSS +```scss + +$font: Roboto system-ui -apple-system BlinkMacSystemFont "Segoe UI" Oxygen Ubuntu Cantarell "Fira Sans" "Droid Sans" "Helvetica Neue" "Noto Sans" Helvetica Arial sans-serif !default; +$font-mono: ui-monospace Menlo Monaco Consolas "SF Mono" "Cascadia Mono" "Segoe UI Mono" "DejaVu Sans Mono" "Liberation Mono" "Roboto Mono" "Oxygen Mono" "Ubuntu Monospace" "Ubuntu Mono" "Source Code Pro" "Fira Mono" "Droid Sans Mono" "Courier New" Courier monospace !default; + +@mixin font { + // convert space separated list to comma separated list + $font: list.join($font, "", $separator: comma); + $font: functions.remove($font, ""); + $font-mono: list.join($font-mono, "", $separator: comma); + $font-mono: functions.remove($font-mono, ""); + + $font: functions.font-var($font, $fontExt-Main, $findFont-Main); + $font-mono: functions.font-var($font-mono, $fontExt-Code, $findFont-Code); + + #{--ff}: $font; + #{--fm}: $font-mono;//code +} +``` + ### javascript ```javascript function closeSearch() {//close the search displaying the regular page. @@ -343,37 +375,3 @@ for yr in lwr..upr do end end ``` - -### SCSS -```scss - -$font: "Roboto", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Noto Sans", Helvetica, Arial, sans-serif !default; -$font-mono: ui-monospace, Menlo, Monaco, Consolas, "SF Mono", "Cascadia Mono", "Segoe UI Mono", "DejaVu Sans Mono", "Liberation Mono", "Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Ubuntu Mono", "Source Code Pro", "Fira Mono", "Droid Sans Mono", "Courier New", Courier, monospace !default; - -@mixin root { - #{--ff}: $font; - #{--fm}: $font-mono;//code - - --fs: 1rem; //font-size - - // Responsive typography - @if $enable-responsive-typography { - @if map-get($breakpoints, "lg") { - @media (min-width: map-get($breakpoints, "lg")) { - --fs: 1.08rem; - } - } - } -} -``` - -### CSS -```css -html { - font-size: var(--fs); -} - -.c { - text-align: center; -} -``` diff --git a/screenshot.png b/screenshot.png index 7b001a0..cd3a293 100644 Binary files a/screenshot.png and b/screenshot.png differ diff --git a/templates/posts.html b/templates/posts.html index e4562ab..b4e123e 100644 --- a/templates/posts.html +++ b/templates/posts.html @@ -51,6 +51,9 @@ This Template can also be used as the rendering template for Sections, eg: examp {%- if section_item.title %}

{{ section_item.title }}

{%- endif %} + + {{ section_item.content | safe }} + {%- for year, posts in section_item.pages | group_by(attribute="year") %} {%- if not hide_section_dates %} {%- if section_item.title %} -- cgit v1.3.1 From c25f6e9ac5f2ac596c261aa52f81d31698f901ee Mon Sep 17 00:00:00 2001 From: Jieiku Date: Mon, 5 Jun 2023 16:04:05 -0700 Subject: link to the proper language feed in HEAD --- README.md | 2 +- static/js/elasticlunr.js | 691 +++++++++++++++++++++++++++++++++++++++++++++ static/stork.st | Bin 270712 -> 312789 bytes templates/404.html | 6 +- templates/macros/head.html | 2 +- 5 files changed, 696 insertions(+), 5 deletions(-) create mode 100644 static/js/elasticlunr.js (limited to 'README.md') diff --git a/README.md b/README.md index af5b2c3..55dddc1 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ $abridgeMode: "switcher",//valid values: switcher, auto, dark, light - Switcher automatically displays a dark or light version depending on browser/OS settings, and has a javascript user clickable theme switcher. - Auto automatically displays a dark or light version depending on browser/OS settings. - Dark is the dark theme always. -- Light is the dark theme always. +- Light is the light theme always. ### Colors and Styles diff --git a/static/js/elasticlunr.js b/static/js/elasticlunr.js new file mode 100644 index 0000000..d96ce65 --- /dev/null +++ b/static/js/elasticlunr.js @@ -0,0 +1,691 @@ +/** + * elasticlunr - http://weixsong.github.io + * Lightweight full-text search engine in Javascript for browser search and offline search. - 0.9.6 + * + * Copyright (C) 2017 Oliver Nightingale + * Copyright (C) 2017 Wei Song + * MIT Licensed + * @license + */ +! function() { + function e(e) { + if (null === e || "object" != typeof e) return e; + var t = e.constructor(); + for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]); + return t + } + var t = function(e) { + var n = new t.Index; + return n.pipeline.add(t.trimmer, t.stopWordFilter, t.stemmer), e && e.call(n, n), n + }; + t.version = "0.9.5", lunr = t, t.utils = {}, t.utils.warn = function(e) { + return function(t) { + e.console && console.warn && console.warn(t) + } + }(this), t.utils.toString = function(e) { + return void 0 === e || null === e ? "" : e.toString() + }, t.EventEmitter = function() { + this.events = {} + }, t.EventEmitter.prototype.addListener = function() { + var e = Array.prototype.slice.call(arguments), + t = e.pop(), + n = e; + if ("function" != typeof t) throw new TypeError("last argument must be a function"); + n.forEach(function(e) { + this.hasHandler(e) || (this.events[e] = []), this.events[e].push(t) + }, this) + }, t.EventEmitter.prototype.removeListener = function(e, t) { + if (this.hasHandler(e)) { + var n = this.events[e].indexOf(t); - 1 !== n && (this.events[e].splice(n, 1), 0 == this.events[e].length && delete this.events[e]) + } + }, t.EventEmitter.prototype.emit = function(e) { + if (this.hasHandler(e)) { + var t = Array.prototype.slice.call(arguments, 1); + this.events[e].forEach(function(e) { + e.apply(void 0, t) + }, this) + } + }, t.EventEmitter.prototype.hasHandler = function(e) { + return e in this.events + }, t.tokenizer = function(e) { + if (!arguments.length || null === e || void 0 === e) return []; + if (Array.isArray(e)) { + var n = e.filter(function(e) { + return null === e || void 0 === e ? !1 : !0 + }); + n = n.map(function(e) { + return t.utils.toString(e).toLowerCase() + }); + var i = []; + return n.forEach(function(e) { + var n = e.split(t.tokenizer.seperator); + i = i.concat(n) + }, this), i + } + return e.toString().trim().toLowerCase().split(t.tokenizer.seperator) + }, t.tokenizer.defaultSeperator = /[\s\-]+/, t.tokenizer.seperator = t.tokenizer.defaultSeperator, t.tokenizer.setSeperator = function(e) { + null !== e && void 0 !== e && "object" == typeof e && (t.tokenizer.seperator = e) + }, t.tokenizer.resetSeperator = function() { + t.tokenizer.seperator = t.tokenizer.defaultSeperator + }, t.tokenizer.getSeperator = function() { + return t.tokenizer.seperator + }, t.Pipeline = function() { + this._queue = [] + }, t.Pipeline.registeredFunctions = {}, t.Pipeline.registerFunction = function(e, n) { + n in t.Pipeline.registeredFunctions && t.utils.warn("Overwriting existing registered function: " + n), e.label = n, t.Pipeline.registeredFunctions[n] = e + }, t.Pipeline.getRegisteredFunction = function(e) { + return e in t.Pipeline.registeredFunctions != !0 ? null : t.Pipeline.registeredFunctions[e] + }, t.Pipeline.warnIfFunctionNotRegistered = function(e) { + var n = e.label && e.label in this.registeredFunctions; + n || t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n", e) + }, t.Pipeline.load = function(e) { + var n = new t.Pipeline; + return e.forEach(function(e) { + var i = t.Pipeline.getRegisteredFunction(e); + if (!i) throw new Error("Cannot load un-registered function: " + e); + n.add(i) + }), n + }, t.Pipeline.prototype.add = function() { + var e = Array.prototype.slice.call(arguments); + e.forEach(function(e) { + t.Pipeline.warnIfFunctionNotRegistered(e), this._queue.push(e) + }, this) + }, t.Pipeline.prototype.after = function(e, n) { + t.Pipeline.warnIfFunctionNotRegistered(n); + var i = this._queue.indexOf(e); + if (-1 === i) throw new Error("Cannot find existingFn"); + this._queue.splice(i + 1, 0, n) + }, t.Pipeline.prototype.before = function(e, n) { + t.Pipeline.warnIfFunctionNotRegistered(n); + var i = this._queue.indexOf(e); + if (-1 === i) throw new Error("Cannot find existingFn"); + this._queue.splice(i, 0, n) + }, t.Pipeline.prototype.remove = function(e) { + var t = this._queue.indexOf(e); - 1 !== t && this._queue.splice(t, 1) + }, t.Pipeline.prototype.run = function(e) { + for (var t = [], n = e.length, i = this._queue.length, o = 0; n > o; o++) { + for (var r = e[o], s = 0; i > s && (r = this._queue[s](r, o, e), void 0 !== r && null !== r); s++); + void 0 !== r && null !== r && t.push(r) + } + return t + }, t.Pipeline.prototype.reset = function() { + this._queue = [] + }, t.Pipeline.prototype.get = function() { + return this._queue + }, t.Pipeline.prototype.toJSON = function() { + return this._queue.map(function(e) { + return t.Pipeline.warnIfFunctionNotRegistered(e), e.label + }) + }, t.Index = function() { + this._fields = [], this._ref = "id", this.pipeline = new t.Pipeline, this.documentStore = new t.DocumentStore, this.index = {}, this.eventEmitter = new t.EventEmitter, this._idfCache = {}, this.on("add", "remove", "update", function() { + this._idfCache = {} + }.bind(this)) + }, t.Index.prototype.on = function() { + var e = Array.prototype.slice.call(arguments); + return this.eventEmitter.addListener.apply(this.eventEmitter, e) + }, t.Index.prototype.off = function(e, t) { + return this.eventEmitter.removeListener(e, t) + }, t.Index.load = function(e) { + e.version !== t.version && t.utils.warn("version mismatch: current " + t.version + " importing " + e.version); + var n = new this; + n._fields = e.fields, n._ref = e.ref, n.documentStore = t.DocumentStore.load(e.documentStore), n.pipeline = t.Pipeline.load(e.pipeline), n.index = {}; + for (var i in e.index) n.index[i] = t.InvertedIndex.load(e.index[i]); + return n + }, t.Index.prototype.addField = function(e) { + return this._fields.push(e), this.index[e] = new t.InvertedIndex, this + }, t.Index.prototype.setRef = function(e) { + return this._ref = e, this + }, t.Index.prototype.saveDocument = function(e) { + return this.documentStore = new t.DocumentStore(e), this + }, t.Index.prototype.addDoc = function(e, n) { + if (e) { + var n = void 0 === n ? !0 : n, + i = e[this._ref]; + this.documentStore.addDoc(i, e), this._fields.forEach(function(n) { + var o = this.pipeline.run(t.tokenizer(e[n])); + this.documentStore.addFieldLength(i, n, o.length); + var r = {}; + o.forEach(function(e) { + e in r ? r[e] += 1 : r[e] = 1 + }, this); + for (var s in r) { + var u = r[s]; + u = Math.sqrt(u), this.index[n].addToken(s, { + ref: i, + tf: u + }) + } + }, this), n && this.eventEmitter.emit("add", e, this) + } + }, t.Index.prototype.removeDocByRef = function(e) { + if (e && this.documentStore.isDocStored() !== !1 && this.documentStore.hasDoc(e)) { + var t = this.documentStore.getDoc(e); + this.removeDoc(t, !1) + } + }, t.Index.prototype.removeDoc = function(e, n) { + if (e) { + var n = void 0 === n ? !0 : n, + i = e[this._ref]; + this.documentStore.hasDoc(i) && (this.documentStore.removeDoc(i), this._fields.forEach(function(n) { + var o = this.pipeline.run(t.tokenizer(e[n])); + o.forEach(function(e) { + this.index[n].removeToken(e, i) + }, this) + }, this), n && this.eventEmitter.emit("remove", e, this)) + } + }, t.Index.prototype.updateDoc = function(e, t) { + var t = void 0 === t ? !0 : t; + this.removeDocByRef(e[this._ref], !1), this.addDoc(e, !1), t && this.eventEmitter.emit("update", e, this) + }, t.Index.prototype.idf = function(e, t) { + var n = "@" + t + "/" + e; + if (Object.prototype.hasOwnProperty.call(this._idfCache, n)) return this._idfCache[n]; + var i = this.index[t].getDocFreq(e), + o = 1 + Math.log(this.documentStore.length / (i + 1)); + return this._idfCache[n] = o, o + }, t.Index.prototype.getFields = function() { + return this._fields.slice() + }, t.Index.prototype.search = function(e, n) { + if (!e) return []; + e = "string" == typeof e ? { + any: e + } : JSON.parse(JSON.stringify(e)); + var i = null; + null != n && (i = JSON.stringify(n)); + for (var o = new t.Configuration(i, this.getFields()).get(), r = {}, s = Object.keys(e), u = 0; u < s.length; u++) { + var a = s[u]; + r[a] = this.pipeline.run(t.tokenizer(e[a])) + } + var l = {}; + for (var c in o) { + var d = r[c] || r.any; + if (d) { + var f = this.fieldSearch(d, c, o), + h = o[c].boost; + for (var p in f) f[p] = f[p] * h; + for (var p in f) p in l ? l[p] += f[p] : l[p] = f[p] + } + } + var v, g = []; + for (var p in l) v = { + ref: p, + score: l[p] + }, this.documentStore.hasDoc(p) && (v.doc = this.documentStore.getDoc(p)), g.push(v); + return g.sort(function(e, t) { + return t.score - e.score + }), g + }, t.Index.prototype.fieldSearch = function(e, t, n) { + var i = n[t].bool, + o = n[t].expand, + r = n[t].boost, + s = null, + u = {}; + return 0 !== r ? (e.forEach(function(e) { + var n = [e]; + 1 == o && (n = this.index[t].expandToken(e)); + var r = {}; + n.forEach(function(n) { + var o = this.index[t].getDocs(n), + a = this.idf(n, t); + if (s && "AND" == i) { + var l = {}; + for (var c in s) c in o && (l[c] = o[c]); + o = l + } + n == e && this.fieldSearchStats(u, n, o); + for (var c in o) { + var d = this.index[t].getTermFrequency(n, c), + f = this.documentStore.getFieldLength(c, t), + h = 1; + 0 != f && (h = 1 / Math.sqrt(f)); + var p = 1; + n != e && (p = .15 * (1 - (n.length - e.length) / n.length)); + var v = d * a * h * p; + c in r ? r[c] += v : r[c] = v + } + }, this), s = this.mergeScores(s, r, i) + }, this), s = this.coordNorm(s, u, e.length)) : void 0 + }, t.Index.prototype.mergeScores = function(e, t, n) { + if (!e) return t; + if ("AND" == n) { + var i = {}; + for (var o in t) o in e && (i[o] = e[o] + t[o]); + return i + } + for (var o in t) o in e ? e[o] += t[o] : e[o] = t[o]; + return e + }, t.Index.prototype.fieldSearchStats = function(e, t, n) { + for (var i in n) i in e ? e[i].push(t) : e[i] = [t] + }, t.Index.prototype.coordNorm = function(e, t, n) { + for (var i in e) + if (i in t) { + var o = t[i].length; + e[i] = e[i] * o / n + } + return e + }, t.Index.prototype.toJSON = function() { + var e = {}; + return this._fields.forEach(function(t) { + e[t] = this.index[t].toJSON() + }, this), { + version: t.version, + fields: this._fields, + ref: this._ref, + documentStore: this.documentStore.toJSON(), + index: e, + pipeline: this.pipeline.toJSON() + } + }, t.Index.prototype.use = function(e) { + var t = Array.prototype.slice.call(arguments, 1); + t.unshift(this), e.apply(this, t) + }, t.DocumentStore = function(e) { + this._save = null === e || void 0 === e ? !0 : e, this.docs = {}, this.docInfo = {}, this.length = 0 + }, t.DocumentStore.load = function(e) { + var t = new this; + return t.length = e.length, t.docs = e.docs, t.docInfo = e.docInfo, t._save = e.save, t + }, t.DocumentStore.prototype.isDocStored = function() { + return this._save + }, t.DocumentStore.prototype.addDoc = function(t, n) { + this.hasDoc(t) || this.length++, this.docs[t] = this._save === !0 ? e(n) : null + }, t.DocumentStore.prototype.getDoc = function(e) { + return this.hasDoc(e) === !1 ? null : this.docs[e] + }, t.DocumentStore.prototype.hasDoc = function(e) { + return e in this.docs + }, t.DocumentStore.prototype.removeDoc = function(e) { + this.hasDoc(e) && (delete this.docs[e], delete this.docInfo[e], this.length--) + }, t.DocumentStore.prototype.addFieldLength = function(e, t, n) { + null !== e && void 0 !== e && 0 != this.hasDoc(e) && (this.docInfo[e] || (this.docInfo[e] = {}), this.docInfo[e][t] = n) + }, t.DocumentStore.prototype.updateFieldLength = function(e, t, n) { + null !== e && void 0 !== e && 0 != this.hasDoc(e) && this.addFieldLength(e, t, n) + }, t.DocumentStore.prototype.getFieldLength = function(e, t) { + return null === e || void 0 === e ? 0 : e in this.docs && t in this.docInfo[e] ? this.docInfo[e][t] : 0 + }, t.DocumentStore.prototype.toJSON = function() { + return { + docs: this.docs, + docInfo: this.docInfo, + length: this.length, + save: this._save + } + }, t.stemmer = function() { + var e = { + ational: "ate", + tional: "tion", + enci: "ence", + anci: "ance", + izer: "ize", + bli: "ble", + alli: "al", + entli: "ent", + eli: "e", + ousli: "ous", + ization: "ize", + ation: "ate", + ator: "ate", + alism: "al", + iveness: "ive", + fulness: "ful", + ousness: "ous", + aliti: "al", + iviti: "ive", + biliti: "ble", + logi: "log" + }, + t = { + icate: "ic", + ative: "", + alize: "al", + iciti: "ic", + ical: "ic", + ful: "", + ness: "" + }, + n = "[^aeiou]", + i = "[aeiouy]", + o = n + "[^aeiouy]*", + r = i + "[aeiou]*", + s = "^(" + o + ")?" + r + o, + u = "^(" + o + ")?" + r + o + "(" + r + ")?$", + a = "^(" + o + ")?" + r + o + r + o, + l = "^(" + o + ")?" + i, + c = new RegExp(s), + d = new RegExp(a), + f = new RegExp(u), + h = new RegExp(l), + p = /^(.+?)(ss|i)es$/, + v = /^(.+?)([^s])s$/, + g = /^(.+?)eed$/, + m = /^(.+?)(ed|ing)$/, + y = /.$/, + S = /(at|bl|iz)$/, + x = new RegExp("([^aeiouylsz])\\1$"), + w = new RegExp("^" + o + i + "[^aeiouwxy]$"), + I = /^(.+?[^aeiou])y$/, + b = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/, + E = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/, + D = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/, + F = /^(.+?)(s|t)(ion)$/, + _ = /^(.+?)e$/, + P = /ll$/, + k = new RegExp("^" + o + i + "[^aeiouwxy]$"), + z = function(n) { + var i, o, r, s, u, a, l; + if (n.length < 3) return n; + if (r = n.substr(0, 1), "y" == r && (n = r.toUpperCase() + n.substr(1)), s = p, u = v, s.test(n) ? n = n.replace(s, "$1$2") : u.test(n) && (n = n.replace(u, "$1$2")), s = g, u = m, s.test(n)) { + var z = s.exec(n); + s = c, s.test(z[1]) && (s = y, n = n.replace(s, "")) + } else if (u.test(n)) { + var z = u.exec(n); + i = z[1], u = h, u.test(i) && (n = i, u = S, a = x, l = w, u.test(n) ? n += "e" : a.test(n) ? (s = y, n = n.replace(s, "")) : l.test(n) && (n += "e")) + } + if (s = I, s.test(n)) { + var z = s.exec(n); + i = z[1], n = i + "i" + } + if (s = b, s.test(n)) { + var z = s.exec(n); + i = z[1], o = z[2], s = c, s.test(i) && (n = i + e[o]) + } + if (s = E, s.test(n)) { + var z = s.exec(n); + i = z[1], o = z[2], s = c, s.test(i) && (n = i + t[o]) + } + if (s = D, u = F, s.test(n)) { + var z = s.exec(n); + i = z[1], s = d, s.test(i) && (n = i) + } else if (u.test(n)) { + var z = u.exec(n); + i = z[1] + z[2], u = d, u.test(i) && (n = i) + } + if (s = _, s.test(n)) { + var z = s.exec(n); + i = z[1], s = d, u = f, a = k, (s.test(i) || u.test(i) && !a.test(i)) && (n = i) + } + return s = P, u = d, s.test(n) && u.test(n) && (s = y, n = n.replace(s, "")), "y" == r && (n = r.toLowerCase() + n.substr(1)), n + }; + return z + }(), t.Pipeline.registerFunction(t.stemmer, "stemmer"), t.stopWordFilter = function(e) { + return e && t.stopWordFilter.stopWords[e] !== !0 ? e : void 0 + }, t.clearStopWords = function() { + t.stopWordFilter.stopWords = {} + }, t.addStopWords = function(e) { + null != e && Array.isArray(e) !== !1 && e.forEach(function(e) { + t.stopWordFilter.stopWords[e] = !0 + }, this) + }, t.resetStopWords = function() { + t.stopWordFilter.stopWords = t.defaultStopWords + }, t.defaultStopWords = { + "": !0, + a: !0, + able: !0, + about: !0, + across: !0, + after: !0, + all: !0, + almost: !0, + also: !0, + am: !0, + among: !0, + an: !0, + and: !0, + any: !0, + are: !0, + as: !0, + at: !0, + be: !0, + because: !0, + been: !0, + but: !0, + by: !0, + can: !0, + cannot: !0, + could: !0, + dear: !0, + did: !0, + "do": !0, + does: !0, + either: !0, + "else": !0, + ever: !0, + every: !0, + "for": !0, + from: !0, + get: !0, + got: !0, + had: !0, + has: !0, + have: !0, + he: !0, + her: !0, + hers: !0, + him: !0, + his: !0, + how: !0, + however: !0, + i: !0, + "if": !0, + "in": !0, + into: !0, + is: !0, + it: !0, + its: !0, + just: !0, + least: !0, + let: !0, + like: !0, + likely: !0, + may: !0, + me: !0, + might: !0, + most: !0, + must: !0, + my: !0, + neither: !0, + no: !0, + nor: !0, + not: !0, + of: !0, + off: !0, + often: !0, + on: !0, + only: !0, + or: !0, + other: !0, + our: !0, + own: !0, + rather: !0, + said: !0, + say: !0, + says: !0, + she: !0, + should: !0, + since: !0, + so: !0, + some: !0, + than: !0, + that: !0, + the: !0, + their: !0, + them: !0, + then: !0, + there: !0, + these: !0, + they: !0, + "this": !0, + tis: !0, + to: !0, + too: !0, + twas: !0, + us: !0, + wants: !0, + was: !0, + we: !0, + were: !0, + what: !0, + when: !0, + where: !0, + which: !0, + "while": !0, + who: !0, + whom: !0, + why: !0, + will: !0, + "with": !0, + would: !0, + yet: !0, + you: !0, + your: !0 + }, t.stopWordFilter.stopWords = t.defaultStopWords, t.Pipeline.registerFunction(t.stopWordFilter, "stopWordFilter"), t.trimmer = function(e) { + if (null === e || void 0 === e) throw new Error("token should not be undefined"); + return e.replace(/^\W+/, "").replace(/\W+$/, "") + }, t.Pipeline.registerFunction(t.trimmer, "trimmer"), t.InvertedIndex = function() { + this.root = { + docs: {}, + df: 0 + } + }, t.InvertedIndex.load = function(e) { + var t = new this; + return t.root = e.root, t + }, t.InvertedIndex.prototype.addToken = function(e, t, n) { + for (var n = n || this.root, i = 0; i <= e.length - 1;) { + var o = e[i]; + o in n || (n[o] = { + docs: {}, + df: 0 + }), i += 1, n = n[o] + } + var r = t.ref; + n.docs[r] ? n.docs[r] = { + tf: t.tf + } : (n.docs[r] = { + tf: t.tf + }, n.df += 1) + }, t.InvertedIndex.prototype.hasToken = function(e) { + if (!e) return !1; + for (var t = this.root, n = 0; n < e.length; n++) { + if (!t[e[n]]) return !1; + t = t[e[n]] + } + return !0 + }, t.InvertedIndex.prototype.getNode = function(e) { + if (!e) return null; + for (var t = this.root, n = 0; n < e.length; n++) { + if (!t[e[n]]) return null; + t = t[e[n]] + } + return t + }, t.InvertedIndex.prototype.getDocs = function(e) { + var t = this.getNode(e); + return null == t ? {} : t.docs + }, t.InvertedIndex.prototype.getTermFrequency = function(e, t) { + var n = this.getNode(e); + return null == n ? 0 : t in n.docs ? n.docs[t].tf : 0 + }, t.InvertedIndex.prototype.getDocFreq = function(e) { + var t = this.getNode(e); + return null == t ? 0 : t.df + }, t.InvertedIndex.prototype.removeToken = function(e, t) { + if (e) { + var n = this.getNode(e); + null != n && t in n.docs && (delete n.docs[t], n.df -= 1) + } + }, t.InvertedIndex.prototype.expandToken = function(e, t, n) { + if (null == e || "" == e) return []; + var t = t || []; + if (void 0 == n && (n = this.getNode(e), null == n)) return t; + n.df > 0 && t.push(e); + for (var i in n) "docs" !== i && "df" !== i && this.expandToken(e + i, t, n[i]); + return t + }, t.InvertedIndex.prototype.toJSON = function() { + return { + root: this.root + } + }, t.Configuration = function(e, n) { + var e = e || ""; + if (void 0 == n || null == n) throw new Error("fields should not be null"); + this.config = {}; + var i; + try { + i = JSON.parse(e), this.buildUserConfig(i, n) + } catch (o) { + t.utils.warn("user configuration parse failed, will use default configuration"), this.buildDefaultConfig(n) + } + }, t.Configuration.prototype.buildDefaultConfig = function(e) { + this.reset(), e.forEach(function(e) { + this.config[e] = { + boost: 1, + bool: "OR", + expand: !1 + } + }, this) + }, t.Configuration.prototype.buildUserConfig = function(e, n) { + var i = "OR", + o = !1; + if (this.reset(), "bool" in e && (i = e.bool || i), "expand" in e && (o = e.expand || o), "fields" in e) + for (var r in e.fields) + if (n.indexOf(r) > -1) { + var s = e.fields[r], + u = o; + void 0 != s.expand && (u = s.expand), this.config[r] = { + boost: s.boost || 0 === s.boost ? s.boost : 1, + bool: s.bool || i, + expand: u + } + } else t.utils.warn("field name in user configuration not found in index instance fields"); + else this.addAllFields2UserConfig(i, o, n) + }, t.Configuration.prototype.addAllFields2UserConfig = function(e, t, n) { + n.forEach(function(n) { + this.config[n] = { + boost: 1, + bool: e, + expand: t + } + }, this) + }, t.Configuration.prototype.get = function() { + return this.config + }, t.Configuration.prototype.reset = function() { + this.config = {} + }, lunr.SortedSet = function() { + this.length = 0, this.elements = [] + }, lunr.SortedSet.load = function(e) { + var t = new this; + return t.elements = e, t.length = e.length, t + }, lunr.SortedSet.prototype.add = function() { + var e, t; + for (e = 0; e < arguments.length; e++) t = arguments[e], ~this.indexOf(t) || this.elements.splice(this.locationFor(t), 0, t); + this.length = this.elements.length + }, lunr.SortedSet.prototype.toArray = function() { + return this.elements.slice() + }, lunr.SortedSet.prototype.map = function(e, t) { + return this.elements.map(e, t) + }, lunr.SortedSet.prototype.forEach = function(e, t) { + return this.elements.forEach(e, t) + }, lunr.SortedSet.prototype.indexOf = function(e) { + for (var t = 0, n = this.elements.length, i = n - t, o = t + Math.floor(i / 2), r = this.elements[o]; i > 1;) { + if (r === e) return o; + e > r && (t = o), r > e && (n = o), i = n - t, o = t + Math.floor(i / 2), r = this.elements[o] + } + return r === e ? o : -1 + }, lunr.SortedSet.prototype.locationFor = function(e) { + for (var t = 0, n = this.elements.length, i = n - t, o = t + Math.floor(i / 2), r = this.elements[o]; i > 1;) e > r && (t = o), r > e && (n = o), i = n - t, o = t + Math.floor(i / 2), r = this.elements[o]; + return r > e ? o : e > r ? o + 1 : void 0 + }, lunr.SortedSet.prototype.intersect = function(e) { + for (var t = new lunr.SortedSet, n = 0, i = 0, o = this.length, r = e.length, s = this.elements, u = e.elements;;) { + if (n > o - 1 || i > r - 1) break; + s[n] !== u[i] ? s[n] < u[i] ? n++ : s[n] > u[i] && i++ : (t.add(s[n]), n++, i++) + } + return t + }, lunr.SortedSet.prototype.clone = function() { + var e = new lunr.SortedSet; + return e.elements = this.toArray(), e.length = e.elements.length, e + }, lunr.SortedSet.prototype.union = function(e) { + var t, n, i; + this.length >= e.length ? (t = this, n = e) : (t = e, n = this), i = t.clone(); + for (var o = 0, r = n.toArray(); o < r.length; o++) i.add(r[o]); + return i + }, lunr.SortedSet.prototype.toJSON = function() { + return this.toArray() + }, + function(e, t) { + "function" == typeof define && define.amd ? define(t) : "object" == typeof exports ? module.exports = t() : e.elasticlunr = t() + }(this, function() { + return t + }) +}(); diff --git a/static/stork.st b/static/stork.st index 59a0e31..a6aafe2 100644 Binary files a/static/stork.st and b/static/stork.st differ diff --git a/templates/404.html b/templates/404.html index 8c57830..f3fbfe9 100644 --- a/templates/404.html +++ b/templates/404.html @@ -22,9 +22,9 @@

Page not found, maybe moved{% if config.languages | length > 0 %} or not in this language{% endif %}. {% if config.build_search_index %}Try searching or{% endif %} go to homepage.

{# Iterate through each language and display the localised 404 message #} - {%- for language_name, language in config.languages -%} - {%- if language_name != config.default_language -%} -

{{ trans(key="404_not_found", lang=language_name) }}. {% if config.build_search_index %}{{ trans(key="404_try_search", lang=language_name) }}{% endif %} {{ trans(key="404_go_home", lang=language_name) }}.

+ {%- for lcode, language in config.languages -%} + {%- if lcode != config.default_language -%} +

{{ trans(key="404_not_found", lang=lcode) }}. {% if config.build_search_index %}{{ trans(key="404_try_search", lang=lcode) }}{% endif %} {{ trans(key="404_go_home", lang=lcode) }}.

{%- endif -%} {%- endfor -%} diff --git a/templates/macros/head.html b/templates/macros/head.html index 5a7221c..6bc0275 100644 --- a/templates/macros/head.html +++ b/templates/macros/head.html @@ -50,7 +50,7 @@ {%- macro feed(config) %} {%- if config.generate_feed %} - + {%- endif %} {%- endmacro %} -- cgit v1.3.1 From 05894a731f29e7d473481ec850a2b154c32befdb Mon Sep 17 00:00:00 2001 From: Jieiku Date: Sun, 30 Jul 2023 22:51:57 -0700 Subject: Update Documentation --- COPY-TO-ROOT-SASS/abridge.scss | 2 +- README.md | 18 ++++++++++++++++++ config.toml | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) (limited to 'README.md') diff --git a/COPY-TO-ROOT-SASS/abridge.scss b/COPY-TO-ROOT-SASS/abridge.scss index 6ab3895..103d91e 100644 --- a/COPY-TO-ROOT-SASS/abridge.scss +++ b/COPY-TO-ROOT-SASS/abridge.scss @@ -10,7 +10,7 @@ $abridgeMode: "switcher",//valid values: switcher, auto, dark, light $syntax-mode: "auto",// Force syntax mode: auto, dark, light - $switcherDefault: "dark",// default for nojs switcher: dark, light + $switcherDefault: "dark",// default nojs switcher mode: dark, light (make sure to also set js_switcher_default in config.toml) $color: "orange",// color template to use/override: orange, blue, blueshade diff --git a/README.md b/README.md index 55dddc1..0db22ce 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,24 @@ Saved changes will live reload in the browser. A lot of effort has been made to ensure Abridge features can be easily customized. +### Default Theme for nojs/noscript visitors. + +If you have abridge configured to use the switcher mode instead of auto/dark/light, then your site will have a button that allows the visitor to toggle the theme. + +If your visitor uses noscript or some other javascript blocking browser addon, then they will be stuck with whatever the configured default theme is for the switcher mode. + +To adjust this mode you would set the following two config values in abridge.scss **AND** config.toml: + +```scss +$switcherDefault: "dark",// default nojs switcher mode: dark, light (make sure to also set js_switcher_default in config.toml) +``` + +```toml +js_switcher_default = "dark" # default nojs switcher mode: dark, light (make sure to also set $switcherDefault in abridge.scss) +``` + +By default abrdige uses dark mode for the switcher, so unless you want to set the default mode to light for nojs visitors, then you do not need to worry about these settings. + ### Number of Items per page for pagination To change the number of items per page edit: `content/_index.md` and change the value for `paginate_by` diff --git a/config.toml b/config.toml index eebc404..495a088 100644 --- a/config.toml +++ b/config.toml @@ -205,7 +205,7 @@ integrity = true # increases site security, should normally be true. (setting to js_bundle = true # multiple javascript files combined into a single file (setting to false is useful during js development) js_switcher = true # The button that allows manually changing between light/dark mode. -js_switcher_default = "dark" # default switcher mode: dark, light +js_switcher_default = "dark" # default nojs switcher mode: dark, light (make sure to also set $switcherDefault in abridge.scss) js_copycode = true # The copy button on code blocks that allows you to copy them to the clipboard. -- cgit v1.3.1 From 0983915e23793c28dd0bee149fd2ec05a7e96a94 Mon Sep 17 00:00:00 2001 From: Jieiku Date: Tue, 15 Aug 2023 21:10:25 -0700 Subject: Lighthouse and YellowLabTools optimizations --- README.md | 7 +++++++ content/overview-images/ferris-gesture.png | Bin 18429 -> 6741 bytes content/overview-rich-content/index.fr.md | 8 ++++---- content/overview-rich-content/index.md | 8 ++++---- content/overview-rich-content/over9000-400.avif | Bin 0 -> 20795 bytes content/overview-rich-content/over9000-400.webp | Bin 24322 -> 0 bytes content/overview-rich-content/over9000-640.avif | Bin 0 -> 31511 bytes content/overview-rich-content/over9000-960.avif | Bin 0 -> 43170 bytes content/overview-rich-content/over9000-960.webp | Bin 39488 -> 0 bytes sass/abridge.scss | 20 +------------------- screenshot.png | Bin 122329 -> 53621 bytes static/android-chrome-192x192.png | Bin 2535 -> 1609 bytes static/android-chrome-192x192m.png | Bin 2273 -> 1170 bytes static/android-chrome-512x512.png | Bin 5377 -> 3937 bytes static/apple-touch-icon.png | Bin 2606 -> 1542 bytes static/banner.png | Bin 13241 -> 4582 bytes static/favicon-32x32.png | Bin 663 -> 559 bytes static/mstile-150x150.png | Bin 2251 -> 1202 bytes templates/base.html | 2 +- templates/macros/social.html | 4 ++-- templates/shortcodes/image.html | 2 +- templates/shortcodes/img.html | 7 +++++-- templates/shortcodes/imgswap.html | 14 ++++++++++---- 23 files changed, 35 insertions(+), 37 deletions(-) create mode 100644 content/overview-rich-content/over9000-400.avif delete mode 100644 content/overview-rich-content/over9000-400.webp create mode 100644 content/overview-rich-content/over9000-640.avif create mode 100644 content/overview-rich-content/over9000-960.avif delete mode 100644 content/overview-rich-content/over9000-960.webp (limited to 'README.md') diff --git a/README.md b/README.md index 0db22ce..be9f552 100644 --- a/README.md +++ b/README.md @@ -356,6 +356,13 @@ leanify -i 7777 *.png leanify -i 7777 *.ico ``` +With larger displays and greater pixel density becoming common it is probably a good idea to use atleast a littly bit of lossy compression. For example you can use pngquant with a 93% quality and you will often get images around 1/2 the size. Understand that pngquant is cumulative, so you should keep your original images somewhere, and only ever use pngquant once per image, if you use it again and again on the same image then you will lower the image quality each time. Always use oxipng afterwards, oxipng is lossless. + +```bash +pngquant --skip-if-larger --strip --quality=93-93 --speed 1 *.png +oxipng -o max --strip all -a -Z *.png +``` + ### Pre gzip/brotli content to serve with nginx: If you are serving your site with nginx, you can pre gzip your content. diff --git a/content/overview-images/ferris-gesture.png b/content/overview-images/ferris-gesture.png index e9c8708..67f6cd1 100644 Binary files a/content/overview-images/ferris-gesture.png and b/content/overview-images/ferris-gesture.png differ diff --git a/content/overview-rich-content/index.fr.md b/content/overview-rich-content/index.fr.md index 819b2db..e768252 100644 --- a/content/overview-rich-content/index.fr.md +++ b/content/overview-rich-content/index.fr.md @@ -34,18 +34,18 @@ Le `video` shortcode prend un `sources` paramètre (un tableau de chaînes) et r Le `image` shortcode renvoie une `` balise et accepte trois paramètres : `sources` (un tableau de chaînes), `fallback_path`, et `fallback_alt` (les deux chaînes). -Chaque chaîne du `sources` tableau doit être un chemin vers un fichier image d'un type différent (`webp`, `png`, `jpg`, etc). `fpath` et +Chaque chaîne du `sources` tableau doit être un chemin vers un fichier image d'un type différent (`avif`, `webp`, `png`, `jpg`, etc). `fpath` et `falt` sont utilisés pour créer une `` balise sur laquelle le navigateur peut se replier si les autres formats ne sont pas encore pris en charge, fw et fh définissent la largeur et la hauteur de la solution de repli ### Usage ```rs -{{/* image(sources=["over9000-960.webp", "over9000-640.webp", "over9000-400.webp"], fpath="over9000-640.webp", fw=640, fh=480, falt="ITS OVER 9000!") */}} +{{/* image(sources=["over9000-960.avif", "over9000-640.avif", "over9000-400.avif"], fpath="over9000-640.webp", fw=640, fh=480, falt="ITS OVER 9000!") */}} ``` ### Sortir ```html -{{ image(sources=["over9000-960.webp", "over9000-640.webp", "over9000-400.webp"], fpath="over9000-640.webp", fw=640, fh=480, falt="ITS OVER 9000!") }} +{{ image(sources=["over9000-960.avif", "over9000-640.avif", "over9000-400.avif"], fpath="over9000-640.webp", fw=640, fh=480, falt="ITS OVER 9000!") }} ``` -{{ image(sources=["over9000-960.webp", "over9000-640.webp", "over9000-400.webp"], fpath="over9000-640.webp", fw=640, fh=480, falt="ITS OVER 9000!") }} +{{ image(sources=["over9000-960.avif", "over9000-640.avif", "over9000-400.avif"], fpath="over9000-640.webp", fw=640, fh=480, falt="ITS OVER 9000!") }} ## GIF diff --git a/content/overview-rich-content/index.md b/content/overview-rich-content/index.md index 8f86d3b..4dc2285 100644 --- a/content/overview-rich-content/index.md +++ b/content/overview-rich-content/index.md @@ -41,19 +41,19 @@ parameters: `sources` (an array of strings), `fallback_path`, and `fallback_alt` (both strings). Each string in the `sources` array should be a path to an image file of -a different type (`webp`, `png`, `jpg`, etc). `fpath` and +a different type (`avif`, `webp`, `png`, `jpg`, etc). `fpath` and `falt` are used to create an `` tag for the browser to fall back on if the other formats aren't yet supported, fw and fh set the width and height of the fallback ### Usage ```rs -{{/* image(sources=["over9000-960.webp", "over9000-640.webp", "over9000-400.webp"], fpath="over9000-640.webp", fw=640, fh=480, falt="ITS OVER 9000!") */}} +{{/* image(sources=["over9000-960.avif", "over9000-640.avif", "over9000-400.avif"], fpath="over9000-640.webp", fw=640, fh=480, falt="ITS OVER 9000!") */}} ``` ### Output ```html -{{ image(sources=["over9000-960.webp", "over9000-640.webp", "over9000-400.webp"], fpath="over9000-640.webp", fw=640, fh=480, falt="ITS OVER 9000!") }} +{{ image(sources=["over9000-960.avif", "over9000-640.avif", "over9000-400.avif"], fpath="over9000-640.webp", fw=640, fh=480, falt="ITS OVER 9000!") }} ``` -{{ image(sources=["over9000-960.webp", "over9000-640.webp", "over9000-400.webp"], fpath="over9000-640.webp", fw=640, fh=480, falt="ITS OVER 9000!") }} +{{ image(sources=["over9000-960.avif", "over9000-640.avif", "over9000-400.avif"], fpath="over9000-640.webp", fw=640, fh=480, falt="ITS OVER 9000!") }} ## GIF diff --git a/content/overview-rich-content/over9000-400.avif b/content/overview-rich-content/over9000-400.avif new file mode 100644 index 0000000..e4c6b1d Binary files /dev/null and b/content/overview-rich-content/over9000-400.avif differ diff --git a/content/overview-rich-content/over9000-400.webp b/content/overview-rich-content/over9000-400.webp deleted file mode 100644 index 1b2876f..0000000 Binary files a/content/overview-rich-content/over9000-400.webp and /dev/null differ diff --git a/content/overview-rich-content/over9000-640.avif b/content/overview-rich-content/over9000-640.avif new file mode 100644 index 0000000..38d314b Binary files /dev/null and b/content/overview-rich-content/over9000-640.avif differ diff --git a/content/overview-rich-content/over9000-960.avif b/content/overview-rich-content/over9000-960.avif new file mode 100644 index 0000000..ae3584d Binary files /dev/null and b/content/overview-rich-content/over9000-960.avif differ diff --git a/content/overview-rich-content/over9000-960.webp b/content/overview-rich-content/over9000-960.webp deleted file mode 100644 index 28fba9c..0000000 Binary files a/content/overview-rich-content/over9000-960.webp and /dev/null differ diff --git a/sass/abridge.scss b/sass/abridge.scss index 5573482..2cde0d3 100644 --- a/sass/abridge.scss +++ b/sass/abridge.scss @@ -711,23 +711,9 @@ $syntax: true !default;//syntax highlighting for code blocks margin-bottom: 0; margin-top: 0.2rem; } - li { - display: inline-block; - margin: 0 .2rem; - } } main nav { - ul { - display: flex; - padding-left: 0; - } margin-top: var(--s2);//pagination margin - li { - margin: .2rem; - } - li.inp { - padding-top: .1rem; - } } .outp { padding: 0 .26rem .2rem; @@ -751,11 +737,7 @@ $syntax: true !default;//syntax highlighting for code blocks color: var(--a1);//pagination color current page } footer nav { - ul { - margin: 0; - padding: 0; - } - li { + i { margin: 0 .2rem .4rem; } } diff --git a/screenshot.png b/screenshot.png index cd3a293..ec8d65f 100644 Binary files a/screenshot.png and b/screenshot.png differ diff --git a/static/android-chrome-192x192.png b/static/android-chrome-192x192.png index 4eba45e..3a075c3 100644 Binary files a/static/android-chrome-192x192.png and b/static/android-chrome-192x192.png differ diff --git a/static/android-chrome-192x192m.png b/static/android-chrome-192x192m.png index f7e37a2..f1e485d 100644 Binary files a/static/android-chrome-192x192m.png and b/static/android-chrome-192x192m.png differ diff --git a/static/android-chrome-512x512.png b/static/android-chrome-512x512.png index 371daf4..b671d86 100644 Binary files a/static/android-chrome-512x512.png and b/static/android-chrome-512x512.png differ diff --git a/static/apple-touch-icon.png b/static/apple-touch-icon.png index b872d32..2923e41 100644 Binary files a/static/apple-touch-icon.png and b/static/apple-touch-icon.png differ diff --git a/static/banner.png b/static/banner.png index 775bff2..a4a46d5 100644 Binary files a/static/banner.png and b/static/banner.png differ diff --git a/static/favicon-32x32.png b/static/favicon-32x32.png index e68ac3c..df1736f 100644 Binary files a/static/favicon-32x32.png and b/static/favicon-32x32.png differ diff --git a/static/mstile-150x150.png b/static/mstile-150x150.png index 41ce573..7a18d2b 100644 Binary files a/static/mstile-150x150.png and b/static/mstile-150x150.png differ diff --git a/templates/base.html b/templates/base.html index 2ab46f8..fd3c553 100644 --- a/templates/base.html +++ b/templates/base.html @@ -9,7 +9,7 @@ {{- macros_head::stylesheets(config=config) }} - + {{- macros_head::stylesheets_preload(config=config) }} {{- macros_head::js(config=config) }} diff --git a/templates/macros/social.html b/templates/macros/social.html index 6ad83de..1221ce7 100644 --- a/templates/macros/social.html +++ b/templates/macros/social.html @@ -1,5 +1,5 @@ {%- macro social_links(config) %} - {%- endmacro %} diff --git a/templates/shortcodes/image.html b/templates/shortcodes/image.html index 8452ce9..4f9d3de 100644 --- a/templates/shortcodes/image.html +++ b/templates/shortcodes/image.html @@ -3,5 +3,5 @@ {% set type = source | split(pat=".") | last -%} {% endfor -%} - {{ falt | default(value='Image') }} + {{ falt | default(value='Image') }} diff --git a/templates/shortcodes/img.html b/templates/shortcodes/img.html index cf2a562..f23f783 100644 --- a/templates/shortcodes/img.html +++ b/templates/shortcodes/img.html @@ -24,5 +24,8 @@ {%- endif %} {%- set img = src | split(pat="/") | last %} -{%- set name = img | split(pat=".") | first %} - + +{%- if not alt %} + {%- set alt = img | split(pat=".") | first %} +{%- endif %} + diff --git a/templates/shortcodes/imgswap.html b/templates/shortcodes/imgswap.html index f8c983c..4397b29 100644 --- a/templates/shortcodes/imgswap.html +++ b/templates/shortcodes/imgswap.html @@ -25,8 +25,11 @@ {%- endif %} {%- set img = main_src | split(pat="/") | last %} - {%- set name = img | split(pat=".") | first %} - + + {%- if not alt %} + {%- set alt = img | split(pat=".") | first %} + {%- endif %} + {%- set dirtest = swap_src | trim_start_matches(pat="./") %} {%- if dirtest is containing("/") %} @@ -54,6 +57,9 @@ {%- endif %} {%- set img = swap_src | split(pat="/") | last %} - {%- set name = img | split(pat=".") | first %} - + + {%- if not alt %} + {%- set alt = img | split(pat=".") | first %} + {%- endif %} + -- cgit v1.3.1