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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33a9343899a06710bc66a1bbadc2e81a377ca066f1b0c57126ec3d3b08ce89e3
4
- data.tar.gz: db89ee0c111feebe18b0411ba01e2f0e10f1e0a5ecefac096aff01aeca43ade1
3
+ metadata.gz: 394cf1d6b7f212788ff66ad9dc2c60b1221cf49604145762a0f5db8dd2cd5032
4
+ data.tar.gz: cdc7d2cae9907ff2de79bb08ddecb259dbd4e6bf9ee2bc02f06da8cbb43d10e7
5
5
  SHA512:
6
- metadata.gz: e290a89db9e35033d53b704c681386cc4a774cf85004ba1aeab4ee741e3542de0bc6f74de558e03aed6244774bbb6b983bc90b97a35a991e581f06e4c034cad8
7
- data.tar.gz: d92178564273303b60a94ef7b8e94d1adda7ef45ff30d3f65f7b39da1b3f07f983020c631f35155fe1482cf480ede04aa15280cb55945b8f0a8f4dbbf5b94d72
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
data/_sass/_calendar.scss CHANGED
@@ -58,6 +58,6 @@
58
58
  }
59
59
 
60
60
  &.today {
61
- box-shadow: inset 1px -2px 3px var(--shadow-color-light);
61
+ box-shadow: inset 1px -1px 5px var(--shadow-color-light);
62
62
  }
63
63
  }
@@ -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 == DATE_SPEC_ELEM_TAG) {
30
- // Remove '-rd' and '-th' suffixes.
29
+ if (tagName == dateHeaderTag) {
30
+ let errored = false;
31
+
31
32
  try {
32
33
  lastDate = DateUtil.parse(child.innerText);
33
- lastHeaderId = child.getAttribute("id");
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
- child.innerText = stringLookup(`invalid_date`, dateText);
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.toLowerCase().indexOf(query) != -1)
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.3
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-18 00:00:00.000000000 Z
11
+ date: 2022-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll