mirror of
https://gitee.com/huanghongxun/HMCL-docs.git
synced 2026-06-21 13:25:32 +08:00
添加一种新的 frontmatter 格式 (#466)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
aa9f72ebfe
commit
8898bb5997
13
_plugins/front_matter_enhancer.rb
Normal file
13
_plugins/front_matter_enhancer.rb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
module Jekyll
|
||||||
|
class Document
|
||||||
|
YAML_FRONT_MATTER_REGEXP = %r!\A(?:---|/\* @frontmatter)\s*\n(.*?\n?)^((?:---|\*/|\.\.\.)\s*$\n?)!m.freeze
|
||||||
|
end
|
||||||
|
|
||||||
|
module Utils
|
||||||
|
def has_yaml_header?(file)
|
||||||
|
File.open(file, "rb", &:readline).match? %r!\A(---|/\* @frontmatter)\s*\r?\n!
|
||||||
|
rescue EOFError
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
/* @frontmatter
|
||||||
---
|
*/
|
||||||
|
|
||||||
@charset "utf-8";
|
@charset "utf-8";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
/* @frontmatter
|
||||||
---
|
*/
|
||||||
|
|
||||||
@charset "utf-8";
|
@charset "utf-8";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
/* @frontmatter
|
||||||
---
|
*/
|
||||||
|
|
||||||
@charset "utf-8";
|
@charset "utf-8";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
/* @frontmatter
|
||||||
---
|
*/
|
||||||
|
|
||||||
@charset "utf-8";
|
@charset "utf-8";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
/* @frontmatter
|
||||||
---
|
*/
|
||||||
|
|
||||||
@charset "utf-8";
|
@charset "utf-8";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
/* @frontmatter
|
||||||
---
|
*/
|
||||||
|
|
||||||
@charset "utf-8";
|
@charset "utf-8";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
/* @frontmatter
|
||||||
---
|
*/
|
||||||
|
|
||||||
@charset "utf-8";
|
@charset "utf-8";
|
||||||
|
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
---
|
/* @frontmatter
|
||||||
---
|
*/
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
/* @frontmatter
|
||||||
---
|
*/
|
||||||
|
|
||||||
@charset "utf-8";
|
@charset "utf-8";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
/* @frontmatter
|
||||||
---
|
*/
|
||||||
|
|
||||||
@charset "utf-8";
|
@charset "utf-8";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
/* @frontmatter
|
||||||
---
|
*/
|
||||||
|
|
||||||
@charset "utf-8";
|
@charset "utf-8";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
/* @frontmatter
|
||||||
---
|
*/
|
||||||
|
|
||||||
@charset "utf-8";
|
@charset "utf-8";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
/* @frontmatter
|
||||||
---
|
*/
|
||||||
|
|
||||||
@charset "utf-8";
|
@charset "utf-8";
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
---
|
/* @frontmatter
|
||||||
layout: null
|
layout: null
|
||||||
---
|
*/
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
const PREFIX = "HMCL_DOCS_SETTINGS_", data = {}, bus = new EventTarget(), configs = /*{%comment%}*/{}/*{%endcomment%}*/ /**{{'/'}}{{ site.data.settings | jsonify }}/**/;
|
const PREFIX = "HMCL_DOCS_SETTINGS_", data = {}, bus = new EventTarget(), configs = /*{%comment%}*/{}/*{%endcomment%}*/ /**{{'/'}}{{ site.data.settings | jsonify }}/**/;
|
||||||
window.addEventListener("storage", ({ key, newValue }) => key !== null && key.startsWith(PREFIX) && newValue !== data[key] && bus.dispatchEvent(new CustomEvent(key, { detail: (data[key] = newValue) })));
|
window.addEventListener("storage", ({ key, newValue }) => key !== null && key.startsWith(PREFIX) && newValue !== data[key] && bus.dispatchEvent(new CustomEvent(key, { detail: (data[key] = newValue) })));
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
---
|
/* @frontmatter
|
||||||
layout: null
|
layout: null
|
||||||
---
|
*/
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", function () {
|
window.addEventListener("DOMContentLoaded", function () {
|
||||||
var skinLink = document.getElementById("skin");
|
var skinLink = document.getElementById("skin");
|
||||||
var darkModeQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
var darkModeQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user