|
120 | 120 | (push-node (text-node c)) |
121 | 121 | close-node))) |
122 | 122 |
|
123 | | -(defn footnote-label [{:as _ctx ::keys [footnote-offset]} token] |
| 123 | +(defn footnote-label [{:as _ctx ::keys [footnote-offset]} ^js token] |
124 | 124 | ;; TODO: consider initial offset in case we're parsing multiple inputs |
125 | 125 | (or (.. token -meta -label) |
126 | 126 | ;; inline labels won't have a label |
127 | 127 | (str "inline-note-" (+ footnote-offset (.. token -meta -id))))) |
128 | 128 |
|
129 | 129 | ;; footnotes |
130 | | -(defmethod apply-token "footnote_ref" [{:as ctx ::keys [label->footnote-ref]} token] |
| 130 | +(defmethod apply-token "footnote_ref" [{:as ctx ::keys [label->footnote-ref]} ^js token] |
131 | 131 | (let [label (footnote-label ctx token) |
132 | 132 | footnote-ref (or (get label->footnote-ref label) |
133 | 133 | {:type :footnote-ref :inline? (not (.. token -meta -label)) |
|
137 | 137 | (u/update-current-loc z/append-child footnote-ref) |
138 | 138 | (update ::label->footnote-ref assoc label footnote-ref)))) |
139 | 139 |
|
140 | | -(defmethod apply-token "footnote_open" [ctx token] |
| 140 | +(defmethod apply-token "footnote_open" [ctx ^js token] |
141 | 141 | ;; TODO unify in utils |
142 | 142 | (let [label (footnote-label ctx token)] |
143 | 143 | (-> ctx |
@@ -268,7 +268,7 @@ _this #should be a tag_, but this [_actually #foo shouldnt_](/bar/) is not." |
268 | 268 | ;; region data builder api |
269 | 269 | (defn pairs->kmap [pairs] (into {} (map (juxt (comp keyword first) second)) pairs)) |
270 | 270 | (defn apply-tokens [doc tokens] |
271 | | - (let [mapify-attrs-xf (map (fn [x] |
| 271 | + (let [mapify-attrs-xf (map (fn [^js x] |
272 | 272 | (set! x -attrs (pairs->kmap (.-attrs x))) |
273 | 273 | x))] |
274 | 274 | (reduce (mapify-attrs-xf apply-token) doc tokens))) |
|
0 commit comments