hematite 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0b7b551f58a7671eec46167c18919a8ed1fe53f9c38eed9f15085c1db25cd9e
4
- data.tar.gz: 755475373480a27f8f8a1fe4bc89b7368b40c76213c521995170f46cf5e16647
3
+ metadata.gz: 394cf1d6b7f212788ff66ad9dc2c60b1221cf49604145762a0f5db8dd2cd5032
4
+ data.tar.gz: cdc7d2cae9907ff2de79bb08ddecb259dbd4e6bf9ee2bc02f06da8cbb43d10e7
5
5
  SHA512:
6
- metadata.gz: e2553c11c574e33d7e40c575e4282493444e9a0594d509537f1379fc10bb4531474f0ac67e1ea24a4564235a67fcc99612ad4e4da598086220397b92611933a4
7
- data.tar.gz: d3985945ba30a12d51bc72e3110fc92dbe31747759971d4f958c763a3669b102916689c3ed8084f405a074464c68929f6a66656a61f62bfd9dbe1d764f3d0994
6
+ metadata.gz: 58323b2f1fc1a8bc8cd445fd1da5f68ce6fee23ccf68c0b798f1c74452a276d8989585b995967e1bde31c0e38129383074eb7c87e9bfc53e616cf6a5c02b7abf
7
+ data.tar.gz: cc70aa6d874e4867c86a4f349aa8d8d0d62891e1a871d6fb0553e1cc039aac02d3fb2bfcc1737b6bf1ee96222a2dfa8bd46d85a94ce0fb7253cfacd9c3d679f6
@@ -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 == DATE_SPEC_ELEM_TAG) {
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);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hematite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henry Heino