hematite 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/_layouts/calendar.html +3 -2
- data/assets/js/layout/calendar.mjs +10 -5
- metadata +1 -1
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
|
@@ -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,7 +26,7 @@ function getCalendarData(elem, formatElemLabels) {
|
|
26
26
|
for (const child of elem.children) {
|
27
27
|
let tagName = child.tagName.toLowerCase();
|
28
28
|
|
29
|
-
if (tagName ==
|
29
|
+
if (tagName == dateHeaderTag) {
|
30
30
|
let errored = false;
|
31
31
|
|
32
32
|
try {
|
@@ -35,6 +35,11 @@ function getCalendarData(elem, formatElemLabels) {
|
|
35
35
|
errored = true;
|
36
36
|
} else {
|
37
37
|
lastHeaderId = child.getAttribute("id");
|
38
|
+
|
39
|
+
if (lastHeaderId == null && formatElemLabels) {
|
40
|
+
lastHeaderId = escape(child.innerText);
|
41
|
+
child.setAttribute("id", lastHeaderId);
|
42
|
+
}
|
38
43
|
}
|
39
44
|
}
|
40
45
|
catch (e) {
|
@@ -417,8 +422,8 @@ class Calendar {
|
|
417
422
|
/// Creates a visual calendar, pulling input from [inputElem]
|
418
423
|
/// and writing output to [outputElem]. If [includePosts], all post-formatted
|
419
424
|
/// articles are also included.
|
420
|
-
function calendarSetup(sourceElem, outputElem, calendarTitleElem, includePosts) {
|
421
|
-
let data = getCalendarData(sourceElem, true);
|
425
|
+
function calendarSetup(sourceElem, outputElem, calendarTitleElem, includePosts, dateHeaderTag) {
|
426
|
+
let data = getCalendarData(sourceElem, true, dateHeaderTag ?? DATE_SPEC_ELEM_TAG);
|
422
427
|
|
423
428
|
if (includePosts) {
|
424
429
|
data = addPostData(data);
|