Fork me on GitHub
#babashka
<
2023-07-02
>
didibus09:07:25

Seems there's missing functions in the included selmer?

----- Error --------------------------------------------------------------------
Type:     java.lang.Exception
Message:  get-filter does not exist
Location: selmer/filter_parser.clj:15:3

----- Context ------------------------------------------------------------------
11:
12:   You can escape doublequotes inside doublequotes. And you can put colons
13:   inside doublequotes which will be ignored for the purpose of separating
14:   arguments."
15:   (:require
      ^--- get-filter does not exist
16:    [selmer.filters :refer [get-filter]]
17:    [selmer.util :refer [*escape-variables* parse-accessor]]
18:    [clojure.string :as str]))
19:
20: ;;; More Utils

----- Stack trace --------------------------------------------------------------
selmer.filter-parser          - selmer/filter_parser.clj:15:3

borkdude13:07:36

I’ll take a look later today, thanks for reporting

borkdude15:07:25

I think this will fix the problem: https://github.com/babashka/babashka/pull/1585 When the current master build finishes, you can install with:

bash <(curl ) --dev-build --dir /tmp

didibus07:07:30

Now I get:

----- Error --------------------------------------------------------------------
Type:     java.lang.Exception
Message:  parse-accessor does not exist
Location: selmer/filter_parser.clj:15:3

----- Context ------------------------------------------------------------------
11:
12:   You can escape doublequotes inside doublequotes. And you can put colons
13:   inside doublequotes which will be ignored for the purpose of separating
14:   arguments."
15:   (:require
      ^--- parse-accessor does not exist
16:    [selmer.filters :refer [get-filter]]
17:    [selmer.util :refer [*escape-variables* parse-accessor]]
18:    [clojure.string :as str]))
19:
20: ;;; More Utils

----- Stack trace --------------------------------------------------------------
selmer.filter-parser          - selmer/filter_parser.clj:15:3

borkdude07:07:39

Based on the previous commit you can probably infer how to fix it. Can you maybe provide the full example of what you’re trying to do?

didibus08:07:01

(require '[selmer.filter-parser :as htmlp])
(require '[selmer.parser :as html])

(defn resolve-selmer-args
  [args context-map]
  (map #(if (htmlp/literal? %)
          (htmlp/parse-literal %)
          (html/render % context-map)) args))

borkdude13:07:05

But this example doesn't contain a reference to selmer.filter get-filter etc which we added yesterday?

borkdude13:07:52

Can you explain in words what you're trying to do as well? I've never touched this part of selmer before, so it's an opportunity for me to learn

borkdude13:07:00

I think we're dealing with an X-Y problem here. You weren't after selmer.filter but you wanted to make selmer.filter-parser work and you tried to load Selmer from source, if I'm understanding correctly

didibus16:07:25

Yes, that's the weird part. I don't directly use the functions it's complaining about.

didibus16:07:39

Oh... Is it because I have Selmer in my deps.edn ? I'm trying to make my script work in both BB and Clojure, which is why I added Selmer in my deps.edn as well. And I have bb.edn configured to use the deps from the deps.edn. Does that mean BB will use the Selmer from the deps instead of the one it has already? And is that why it's not working?

borkdude16:07:50

bb will only load namespaces from source that weren't already built-in

borkdude17:07:15

it might be an idea to finish the PR for Selmer and then update Selmer in bb and expose that new function

💯 2