hematite 0.0.3 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_layouts/calendar.html +3 -2
- data/_sass/_calendar.scss +1 -1
- data/assets/js/layout/calendar.mjs +22 -8
- data/assets/js/search.mjs +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 394cf1d6b7f212788ff66ad9dc2c60b1221cf49604145762a0f5db8dd2cd5032
|
4
|
+
data.tar.gz: cdc7d2cae9907ff2de79bb08ddecb259dbd4e6bf9ee2bc02f06da8cbb43d10e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58323b2f1fc1a8bc8cd445fd1da5f68ce6fee23ccf68c0b798f1c74452a276d8989585b995967e1bde31c0e38129383074eb7c87e9bfc53e616cf6a5c02b7abf
|
7
|
+
data.tar.gz: cc70aa6d874e4867c86a4f349aa8d8d0d62891e1a871d6fb0553e1cc039aac02d3fb2bfcc1737b6bf1ee96222a2dfa8bd46d85a94ce0fb7253cfacd9c3d679f6
|
data/_layouts/calendar.html
CHANGED
@@ -21,10 +21,11 @@ layout: default
|
|
21
21
|
null,
|
22
22
|
{% endif %}
|
23
23
|
{% if page.include_posts %}
|
24
|
-
true
|
24
|
+
true,
|
25
25
|
{% else %}
|
26
|
-
false
|
26
|
+
false,
|
27
27
|
{% endif %}
|
28
|
+
{{ page.calendar_date_elem | default: "h1" | jsonify }},
|
28
29
|
);
|
29
30
|
|
30
31
|
// Remove the title if we're not using it — it can mess with
|
data/_sass/_calendar.scss
CHANGED
@@ -15,8 +15,8 @@ const CALENDAR_DATE_FMT_OPTIONS =
|
|
15
15
|
let nextViewModeSelectorId = 0;
|
16
16
|
|
17
17
|
/// Pull calendar data from [elem]. If [formatElemLabels], apply special calendar markup
|
18
|
-
/// to the contents of [elem], changing [elem].
|
19
|
-
function getCalendarData(elem, formatElemLabels) {
|
18
|
+
/// to the contents of [elem], fix missing ids on headers, etc., changing [elem].
|
19
|
+
function getCalendarData(elem, formatElemLabels, dateHeaderTag) {
|
20
20
|
let result = [];
|
21
21
|
|
22
22
|
// Last date set by a header we've encountered
|
@@ -26,14 +26,28 @@ function getCalendarData(elem, formatElemLabels) {
|
|
26
26
|
for (const child of elem.children) {
|
27
27
|
let tagName = child.tagName.toLowerCase();
|
28
28
|
|
29
|
-
if (tagName ==
|
30
|
-
|
29
|
+
if (tagName == dateHeaderTag) {
|
30
|
+
let errored = false;
|
31
|
+
|
31
32
|
try {
|
32
33
|
lastDate = DateUtil.parse(child.innerText);
|
33
|
-
|
34
|
+
if (isNaN(lastDate)) {
|
35
|
+
errored = true;
|
36
|
+
} else {
|
37
|
+
lastHeaderId = child.getAttribute("id");
|
38
|
+
|
39
|
+
if (lastHeaderId == null && formatElemLabels) {
|
40
|
+
lastHeaderId = escape(child.innerText);
|
41
|
+
child.setAttribute("id", lastHeaderId);
|
42
|
+
}
|
43
|
+
}
|
34
44
|
}
|
35
45
|
catch (e) {
|
36
|
-
|
46
|
+
errored = true;
|
47
|
+
}
|
48
|
+
|
49
|
+
if (errored) {
|
50
|
+
child.innerText = stringLookup(`invalid_date`, child.innerText);
|
37
51
|
lastDate = null;
|
38
52
|
}
|
39
53
|
}
|
@@ -408,8 +422,8 @@ class Calendar {
|
|
408
422
|
/// Creates a visual calendar, pulling input from [inputElem]
|
409
423
|
/// and writing output to [outputElem]. If [includePosts], all post-formatted
|
410
424
|
/// articles are also included.
|
411
|
-
function calendarSetup(sourceElem, outputElem, calendarTitleElem, includePosts) {
|
412
|
-
let data = getCalendarData(sourceElem, true);
|
425
|
+
function calendarSetup(sourceElem, outputElem, calendarTitleElem, includePosts, dateHeaderTag) {
|
426
|
+
let data = getCalendarData(sourceElem, true, dateHeaderTag ?? DATE_SPEC_ELEM_TAG);
|
413
427
|
|
414
428
|
if (includePosts) {
|
415
429
|
data = addPostData(data);
|
data/assets/js/search.mjs
CHANGED
@@ -116,13 +116,13 @@ class Searcher {
|
|
116
116
|
for (const page of data) {
|
117
117
|
// Remove HTML tags.
|
118
118
|
let content = this.filterContent_(page.content);
|
119
|
-
content += '\n' + page.title;
|
119
|
+
content += '\n' + (page.title ?? "");
|
120
120
|
|
121
121
|
let pageData = {
|
122
122
|
title: page.title,
|
123
123
|
url: page.url,
|
124
124
|
numMatches: 0,
|
125
|
-
titleMatches: (page.title
|
125
|
+
titleMatches: (page.title?.toLowerCase()?.indexOf(query) != -1)
|
126
126
|
};
|
127
127
|
|
128
128
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hematite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henry Heino
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|