Skip to content

Commit

Permalink
Replace citeproc style struct slot cite-note with category
Browse files Browse the repository at this point in the history
  • Loading branch information
andras-simonyi committed Mar 2, 2024
1 parent 740ae9b commit 169b953
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion citeproc-context.el
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
(require 'citeproc-prange)
(require 'citeproc-style)

(declare-function citeproc-style-category "citeproc-style" (style))

(cl-defstruct (citeproc-context (:constructor citeproc-context--create))
"A struct representing the context for rendering CSL elements."
vars macros terms date-text date-numeric opts locale-opts
Expand Down Expand Up @@ -214,7 +216,7 @@ documentation of `citeproc-render-varlist-in-rt', while MODE is
the rendering mode, `bib' or `cite', and CITE-POS is a cite
position. Returns an appropriate attribute to be added or nil if
no internal links should be produced."
(let ((note-style (citeproc-style-cite-note style)))
(let ((note-style (string= (citeproc-style-category style) "note")))
(unless (or (and internal-links (not (memq internal-links '(auto bib-links))))
(and note-style (eq mode 'bib) (or (null internal-links)
(eq internal-links 'auto))))
Expand Down
16 changes: 8 additions & 8 deletions citeproc-style.el
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

(cl-defstruct (citeproc-style (:constructor citeproc-style--create))
"A struct representing a parsed and localized CSL style.
CATEGORY is the style's category as a string,
INFO is the style's general info (currently simply the
corresponding fragment of the parsed xml),
OPTS, BIB-OPTS, CITE-OPTS and LOCALE-OPTS are alists of general
Expand All @@ -49,16 +50,15 @@ BIB-SORT-ORDERS and CITE-SORT-ORDERS are the lists of sort orders
the n-th key should be in ascending or desending order,
CITE-LAYOUT-ATTRS contains the attributes of the citation layout
as an alist,
CITE-NOTE is non-nil iff the style's citation-format is \"note\",
DATE-TEXT and DATE-NUMERIC are the style's date formats,
LOCALE contains the locale to be used or nil if not set,
MACROS is an alist with macro names as keys and corresponding
anonymous rendering functions,
TERMS is the style's parsed term-list,
USES-YS-VAR is non-nil iff the style uses the YEAR-SUFFIX
CSL-variable."
info opts bib-opts bib-sort bib-sort-orders
bib-layout cite-opts cite-note cite-sort cite-sort-orders
category info opts bib-opts bib-sort bib-sort-orders
bib-layout cite-opts cite-sort cite-sort-orders
cite-layout cite-layout-attrs locale-opts macros terms
uses-ys-var date-text date-numeric locale)

Expand Down Expand Up @@ -98,12 +98,12 @@ in-style locale information will be loaded (if available)."
(--each (cddr parsed-style)
(pcase (car it)
('info
(let ((info-lst (cddr it)))
(let* ((info-lst (cddr it))
(category-info (cl-find-if (lambda (x) (eq 'category (car x)))
info-lst))
(category (cdaadr category-info)))
(setf (citeproc-style-info style) info-lst
(citeproc-style-cite-note style)
(not (not (member '(category
((citation-format . "note")))
info-lst))))))
(citeproc-style-category style) category)))
('locale
(let ((lang (alist-get 'lang (cadr it))))
(when (and (citeproc-locale--compatible-p lang locale)
Expand Down

0 comments on commit 169b953

Please sign in to comment.