Skip to content

Commit

Permalink
Merge pull request #135 from leomoon/master
Browse files Browse the repository at this point in the history
Multiple improvements with version bump
  • Loading branch information
leomoon authored Jun 30, 2024
2 parents e8cca5f + 10d9b8d commit c3dfa25
Show file tree
Hide file tree
Showing 93 changed files with 31,651 additions and 3,305 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,16 @@ services:
- Use this as Nginx configuration for WikiDocs:
```
...
location /wikidocs/ {
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php?doc=$1 last;
}
try_files $uri $uri/ =404;
}
location ~* \.(css|js|jpg|jpeg|png|gif|ico|svg)$ {
try_files $uri =404;
add_header Cache-Control "public, max-age=3600";
}
location / {
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php?doc=$1 last;
}
try_files $uri $uri/ =404;
}
```
- Copy the configuration sample file `cp datasets/config.sample.inc.php datasets/config.inc.php`
- Edit the configuration file `nano datasets/config.inc.php`
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.27
1.0.28
1 change: 1 addition & 0 deletions bootstrap.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
require_once(BASE."libraries/parsedown-extra-0.8.1/ParsedownExtra.php");
require_once(BASE."libraries/parsedown-extended-1.1.2-modified/ParsedownExtended.php");
require_once(BASE."libraries/parsedown-filter-0.0.1/ParsedownFilter.php");
require_once(BASE."libraries/parsedown-plus-0.0.5/ParsedownPlus.php");

// if behind https reverse proxy, set HTTPS property correctly
if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO']=='https'){$_SERVER['HTTPS']='on';}
Expand Down
14 changes: 10 additions & 4 deletions helpers/katex-0.16.7/README.md → helpers/katex-0.16.10/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# [<img src="https://katex.org/img/katex-logo-black.svg" width="130" alt="KaTeX">](https://katex.org/)
<h1><a href="https://katex.org/">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://katex.org/img/katex-logo.svg">
<img alt="KaTeX" width=130 src="https://katex.org/img/katex-logo-black.svg">
</picture>
</a></h1>

[![npm](https://img.shields.io/npm/v/katex.svg)](https://www.npmjs.com/package/katex)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![CI](https://github.com/KaTeX/KaTeX/workflows/CI/badge.svg?branch=main&event=push)](https://github.com/KaTeX/KaTeX/actions?query=workflow%3ACI)
Expand Down Expand Up @@ -31,13 +37,13 @@ Try out KaTeX [on the demo page](https://katex.org/#demo)!
<!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected].7/dist/katex.min.css" integrity="sha384-3UiQGuEI4TTMaFmGIZumfRPtfKQ3trwQE2JgosJxCnGmQpL/lJdjpcHkaaFwHlcI" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected].10/dist/katex.min.css" integrity="sha384-wcIxkf4k558AjM3Yz3BBFQUbk/zgIYC2R0QpeeYb+TwlBVMrlgLqwRjRtGZiK7ww" crossorigin="anonymous">

<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="https://cdn.jsdelivr.net/npm/[email protected].7/dist/katex.min.js" integrity="sha384-G0zcxDFp5LWZtDuRMnBkk3EphCK1lhEf4UEyEM693ka574TZGwo4IWwS6QLzM/2t" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected].10/dist/katex.min.js" integrity="sha384-hIoBPJpTUs74ddyc4bFZSM1TVlQDA60VBbJS0oA934VSz82sBx1X7kSx2ATBDIyd" crossorigin="anonymous"></script>

<!-- To automatically render math in text elements, include the auto-render extension: -->
<script defer src="https://cdn.jsdelivr.net/npm/[email protected].7/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"
<script defer src="https://cdn.jsdelivr.net/npm/[email protected].10/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>
</head>
...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ var external_katex_ = __webpack_require__(771);
var external_katex_default = /*#__PURE__*/__webpack_require__.n(external_katex_);
;// CONCATENATED MODULE: ./contrib/auto-render/splitAtDelimiters.js
/* eslint no-constant-condition:0 */
var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) {
const findEndOfMath = function (delimiter, text, startIndex) {
// Adapted from
// https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx
var index = startIndex;
var braceLevel = 0;
var delimLength = delimiter.length;
let index = startIndex;
let braceLevel = 0;
const delimLength = delimiter.length;

while (index < text.length) {
var character = text[index];
const character = text[index];

if (braceLevel <= 0 && text.slice(index, index + delimLength) === delimiter) {
return index;
Expand All @@ -116,18 +116,16 @@ var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) {
return -1;
};

var escapeRegex = function escapeRegex(string) {
const escapeRegex = function (string) {
return string.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
};

var amsRegex = /^\\begin{/;
const amsRegex = /^\\begin{/;

var splitAtDelimiters = function splitAtDelimiters(text, delimiters) {
var index;
var data = [];
var regexLeft = new RegExp("(" + delimiters.map(function (x) {
return escapeRegex(x.left);
}).join("|") + ")");
const splitAtDelimiters = function (text, delimiters) {
let index;
const data = [];
const regexLeft = new RegExp("(" + delimiters.map(x => escapeRegex(x.left)).join("|") + ")");

while (true) {
index = text.search(regexLeft);
Expand All @@ -145,21 +143,19 @@ var splitAtDelimiters = function splitAtDelimiters(text, delimiters) {
} // ... so this always succeeds:


var i = delimiters.findIndex(function (delim) {
return text.startsWith(delim.left);
});
const i = delimiters.findIndex(delim => text.startsWith(delim.left));
index = findEndOfMath(delimiters[i].right, text, delimiters[i].left.length);

if (index === -1) {
break;
}

var rawData = text.slice(0, index + delimiters[i].right.length);
var math = amsRegex.test(rawData) ? rawData : text.slice(delimiters[i].left.length, index);
const rawData = text.slice(0, index + delimiters[i].right.length);
const math = amsRegex.test(rawData) ? rawData : text.slice(delimiters[i].left.length, index);
data.push({
type: "math",
data: math,
rawData: rawData,
rawData,
display: delimiters[i].display
});
text = text.slice(index + delimiters[i].right.length);
Expand All @@ -184,8 +180,8 @@ var splitAtDelimiters = function splitAtDelimiters(text, delimiters) {
* API, we should copy it before mutating.
*/

var renderMathInText = function renderMathInText(text, optionsCopy) {
var data = auto_render_splitAtDelimiters(text, optionsCopy.delimiters);
const renderMathInText = function (text, optionsCopy) {
const data = auto_render_splitAtDelimiters(text, optionsCopy.delimiters);

if (data.length === 1 && data[0].type === 'text') {
// There is no formula in the text.
Expand All @@ -194,14 +190,14 @@ var renderMathInText = function renderMathInText(text, optionsCopy) {
return null;
}

var fragment = document.createDocumentFragment();
const fragment = document.createDocumentFragment();

for (var i = 0; i < data.length; i++) {
for (let i = 0; i < data.length; i++) {
if (data[i].type === "text") {
fragment.appendChild(document.createTextNode(data[i].data));
} else {
var span = document.createElement("span");
var math = data[i].data; // Override any display mode defined in the settings with that
const span = document.createElement("span");
let math = data[i].data; // Override any display mode defined in the settings with that
// defined by the text itself

optionsCopy.displayMode = data[i].display;
Expand Down Expand Up @@ -229,30 +225,30 @@ var renderMathInText = function renderMathInText(text, optionsCopy) {
return fragment;
};

var renderElem = function renderElem(elem, optionsCopy) {
for (var i = 0; i < elem.childNodes.length; i++) {
var childNode = elem.childNodes[i];
const renderElem = function (elem, optionsCopy) {
for (let i = 0; i < elem.childNodes.length; i++) {
const childNode = elem.childNodes[i];

if (childNode.nodeType === 3) {
// Text node
// Concatenate all sibling text nodes.
// Webkit browsers split very large text nodes into smaller ones,
// so the delimiters may be split across different nodes.
var textContentConcat = childNode.textContent;
var sibling = childNode.nextSibling;
var nSiblings = 0;
let textContentConcat = childNode.textContent;
let sibling = childNode.nextSibling;
let nSiblings = 0;

while (sibling && sibling.nodeType === Node.TEXT_NODE) {
textContentConcat += sibling.textContent;
sibling = sibling.nextSibling;
nSiblings++;
}

var frag = renderMathInText(textContentConcat, optionsCopy);
const frag = renderMathInText(textContentConcat, optionsCopy);

if (frag) {
// Remove extra text nodes
for (var j = 0; j < nSiblings; j++) {
for (let j = 0; j < nSiblings; j++) {
childNode.nextSibling.remove();
}

Expand All @@ -264,30 +260,26 @@ var renderElem = function renderElem(elem, optionsCopy) {
i += nSiblings;
}
} else if (childNode.nodeType === 1) {
(function () {
// Element node
var className = ' ' + childNode.className + ' ';
var shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(function (x) {
return className.indexOf(' ' + x + ' ') === -1;
});

if (shouldRender) {
renderElem(childNode, optionsCopy);
}
})();
// Element node
const className = ' ' + childNode.className + ' ';
const shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(x => className.indexOf(' ' + x + ' ') === -1);

if (shouldRender) {
renderElem(childNode, optionsCopy);
}
} // Otherwise, it's something else, and ignore it.

}
};

var renderMathInElement = function renderMathInElement(elem, options) {
const renderMathInElement = function (elem, options) {
if (!elem) {
throw new Error("No element provided to render");
}

var optionsCopy = {}; // Object.assign(optionsCopy, option)
const optionsCopy = {}; // Object.assign(optionsCopy, option)

for (var option in options) {
for (const option in options) {
if (options.hasOwnProperty(option)) {
optionsCopy[option] = options[option];
}
Expand All @@ -303,7 +295,7 @@ var renderMathInElement = function renderMathInElement(elem, options) {
right: "\\)",
display: false
}, // LaTeX uses $…$, but it ruins the display of normal `$` in text:
{left: "$", right: "$", display: false},
// {left: "$", right: "$", display: false},
// $ must come after $$
// Render AMS environments even if outside $$…$$ delimiters.
{
Expand Down
1 change: 1 addition & 0 deletions helpers/katex-0.16.10/contrib/auto-render.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c3dfa25

Please sign in to comment.