paperlint 14.5.0 → 14.6.0

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.
@@ -133,6 +133,14 @@ button.term code { background: transparent; border: 0; padding: 0; }
133
133
  #tip .tip-arrow { position: absolute; width: 10px; height: 10px; background: var(--surface); transform: rotate(45deg); }
134
134
  #tip.below .tip-arrow { top: -6px; border-left: 1px solid var(--accent); border-top: 1px solid var(--accent); }
135
135
  #tip.above .tip-arrow { bottom: -6px; border-right: 1px solid var(--accent); border-bottom: 1px solid var(--accent); }
136
+ /* A source tag (#400): a small pill right above the block it names. The colour is the id's place in the
137
+ page's `sources`, one of five tokens of :root; text and edge are the colour, the fill a faint wash of it. */
138
+ .tagged { display: flex; flex-direction: column; gap: 6px; }
139
+ .tag { align-self: flex-start; font-size: 0.7rem; line-height: 1.2; letter-spacing: 0.08em; text-transform: uppercase;
140
+ font-weight: 500; padding: 3px 9px; border-radius: 999px; color: var(--tag); border: 1px solid var(--tag);
141
+ background: color-mix(in srgb, var(--tag) 14%, var(--bg)); }
142
+ .tag.s0 { --tag: var(--accent); } .tag.s1 { --tag: var(--good); } .tag.s2 { --tag: var(--mark); }
143
+ .tag.s3 { --tag: var(--bad); } .tag.s4 { --tag: var(--text); }
136
144
  .rulebox { display: flex; flex-direction: column; gap: 8px; }
137
145
  .clamped { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
138
146
  /* The clamp cuts at the padding box, so a code block's bottom padding is a border: no fourth line peeks in. */
@@ -537,6 +545,18 @@ button.more { width: auto; min-height: 44px; border: 0; color: var(--accent); pa
537
545
  n.setAttribute("data-test-meta", JSON.stringify(meta || {}));
538
546
  return n;
539
547
  }
548
+ // A block under its source tag (#400): the block itself when the page has no `sources` or the block names none.
549
+ // The tag shows the label in the language picked, else the page's own; its colour is the id's place in `sources`.
550
+ function tagged(block, id, kind) {
551
+ if (!id || !DATA.sources) return block;
552
+ var at = DATA.sources.map(function (s) { return s.id; }).indexOf(id);
553
+ var own = state.lang !== DATA.lang && DATA.translations ? DATA.translations[state.lang].sources : null;
554
+ var tag = mark(el("span", "tag s" + at, (own && own[id]) || DATA.sources[at].label), "source-tag", { source: id, block: kind });
555
+ var wrap = el("div", "tagged");
556
+ wrap.appendChild(tag);
557
+ wrap.appendChild(block);
558
+ return wrap;
559
+ }
540
560
  // Text with `backticks` shown as code spans; everything stays textContent, so nothing is parsed as HTML.
541
561
  function rich(tag, cls, text) {
542
562
  var n = el(tag, cls);
@@ -763,7 +783,7 @@ button.more { width: auto; min-height: 44px; border: 0; color: var(--accent); pa
763
783
  } else if (!ex.annotation) r.code.appendChild(el("span", "this", ex.mark_label || "\u25c0 this line"));
764
784
  });
765
785
  box.appendChild(pre);
766
- if (ex.caption) box.appendChild(rich("p", "said", ex.caption));
786
+ if (ex.caption) box.appendChild(tagged(rich("p", "said", ex.caption), ex.caption_from, "caption"));
767
787
  return box;
768
788
  }
769
789
  // ── terms with a note (#392): a dotted term opens ONE floating note, anchored to it ─────────────
@@ -964,7 +984,7 @@ button.more { width: auto; min-height: 44px; border: 0; color: var(--accent); pa
964
984
  // A card's quote comes first, under its title: the words asked about, then the code they are about.
965
985
  function evidence(card, item, ctx) {
966
986
  if (item.title) card.appendChild(rich("h3", "", item.title));
967
- if (item.quote) card.appendChild(quoteBlock(item, ctx));
987
+ if (item.quote) card.appendChild(tagged(quoteBlock(item, ctx), item.quote.from, "quote"));
968
988
  if (item.body !== undefined) {
969
989
  var body = rich("p", "body", item.body);
970
990
  card.appendChild(words().labels.body ? row(words().labels.body, body) : body);
@@ -983,8 +1003,8 @@ button.more { width: auto; min-height: 44px; border: 0; color: var(--accent); pa
983
1003
  }
984
1004
  if (item.file) card.appendChild(row("File", rich("p", "", item.file)));
985
1005
  if (item.context) card.appendChild(rich("p", "muted", item.context));
986
- if (item.situation && item.situation.summary) card.appendChild(situated("p", "situation", item.situation.summary, item.situation.line));
987
- if (item.excerpt) card.appendChild(excerptBlock(item.excerpt, ctx));
1006
+ if (item.situation && item.situation.summary) card.appendChild(tagged(situated("p", "situation", item.situation.summary, item.situation.line), item.situation.from, "situation"));
1007
+ if (item.excerpt) card.appendChild(tagged(excerptBlock(item.excerpt, ctx), item.excerpt.from, "excerpt"));
988
1008
  }
989
1009
  function labelOf(q, v) {
990
1010
  var o = q.options.filter(function (x) { return x.value === v; })[0];