Skip to content

<%current page%> not compatible with page-properties #8357

Open

Description

@alxlg

Search first

  • I searched and no similar issues were found

What Happened?

It seems a macro like this one, combining <%current page%> and page-property can't work, maybe because the former provide a lowercase value and the latter accept only original case values:

"key" "{{query (page-property key <%current page%>)}}"

An equivalent query but that manually lowercase a value works as expexted:

#+BEGIN_QUERY
{
 :query [
       :find  (pull ?p [*])
:in $ ?current-page
       :where
        [?p :block/properties ?props]
        [(get ?props :test/parent) ?prop]
       [(str "(?i)" ?current-page) ?regex_s]
       [(re-pattern ?regex_s) ?regex]
       [(str ?prop) ?prop_str]
       [(re-find ?regex ?prop_str)]
       
       ]
:inputs [:current-page]
}
#+END_QUERY

Reproduce the Bug

Define a macro like this:

"key" "{{query (page-property key <%current page%>)}}"

Assign to a page the property key:: [[Page]].

Go to [[Page]], insert {{key}} macro defined above: no results.

Replace {{key}} with {{query (page-property key [[Page]])}}: it works

Expected Behavior

The macro above should return the same results as if it was manually expanded and <%current page%> replaced with the current page name.

Screenshots

No response

Desktop or Mobile Platform Information

Desktop & Android, 0.8.15

Additional Context

https://discord.com/channels/725182569297215569/743139225746145311/1063522650237964389

Are you willing to submit a PR?

  • I'm willing to submit a PR (Thank you!)

Activity

  1. added
    :type/enhancement
    estimate: medium
    on Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    :type/enhancementestimate: mediumquerytemplate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions