Skip to content

Commit

Permalink
dataview: fix inline queries (#449)
Browse files Browse the repository at this point in the history
Co-authored-by: Ole Eskild Steensen <[email protected]>
  • Loading branch information
julesvirallinen and oleeskild authored Oct 1, 2023
1 parent c921e98 commit 9d25440
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/GardenPageCompiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export class GardenPageCompiler {
const code = inlineQuery[0];
const query = inlineQuery[1];

const dataviewResult = dvApi.tryEvaluate(query, {
const dataviewResult = dvApi.tryEvaluate(query.trim(), {
// @ts-expect-error errors are caught
this: dvApi.page(path),
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[summary:: this note is about foo]
8 changes: 8 additions & 0 deletions src/dg-testVault/P Plugins/PD Dataview/PD2 Inline queries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
dg-publish: true
---




`= [[PD0 - note with summary]].summary`
17 changes: 17 additions & 0 deletions src/test/snapshot/snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ P Plugins/PE Excalidraw/PE1 Transcluded excalidraw.md


<style> .container {font-family: sans-serif; text-align: center;} .button-wrapper button {z-index: 1;height: 40px; width: 100px; margin: 10px;padding: 5px;} .excalidraw .App-menu_top .buttonList { display: flex;} .excalidraw-wrapper { height: 800px; margin: 50px; position: relative;} :root[dir="ltr"] .excalidraw .layer-ui__wrapper .zen-mode-transition.App-menu_bottom--transition-left {transform: none;} </style><script src="https://cdn.jsdelivr.net/npm/react@17/umd/react.production.min.js"></script><script src="https://cdn.jsdelivr.net/npm/react-dom@17/umd/react-dom.production.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@excalidraw/excalidraw@0/dist/excalidraw.production.min.js"></script><div id="Drawing_2023-09-23_2241.09.excalidraw.md1"></div><script>(function(){const InitialData={"type":"excalidraw","version":2,"source":"https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/1.9.19","elements":[{"id":"CZsgDfedEqsrXkSK9gQJH","type":"rectangle","x":-231.33984375,"y":-252.75,"width":222,"height":93.296875,"angle":0,"strokeColor":"#1e1e1e","backgroundColor":"transparent","fillStyle":"hachure","strokeWidth":1,"strokeStyle":"solid","roughness":1,"opacity":100,"groupIds":[],"frameId":null,"roundness":{"type":3},"seed":834466567,"version":54,"versionNonce":1029562215,"isDeleted":false,"boundElements":[{"id":"ezIUrt6yrVW9zFYWBb6Fx","type":"arrow"}],"updated":1695498089101,"link":null,"locked":false},{"id":"SvNLuaih","type":"text","x":-179.35546875,"y":-209.0703125,"width":41.89994812011719,"height":25,"angle":0,"strokeColor":"#1e1e1e","backgroundColor":"transparent","fillStyle":"hachure","strokeWidth":1,"strokeStyle":"solid","roughness":1,"opacity":100,"groupIds":[],"frameId":null,"roundness":null,"seed":1422140583,"version":5,"versionNonce":655470793,"isDeleted":false,"boundElements":null,"updated":1695498085088,"link":null,"locked":false,"text":"beep","rawText":"beep","fontSize":20,"fontFamily":1,"textAlign":"left","verticalAlign":"top","baseline":18,"containerId":null,"originalText":"beep","lineHeight":1.25},{"id":"ezIUrt6yrVW9zFYWBb6Fx","type":"arrow","x":-8.67578125,"y":-157.16796875,"width":105.06640625,"height":109.1796875,"angle":0,"strokeColor":"#1e1e1e","backgroundColor":"transparent","fillStyle":"hachure","strokeWidth":1,"strokeStyle":"solid","roughness":1,"opacity":100,"groupIds":[],"frameId":null,"roundness":{"type":2},"seed":1011929737,"version":32,"versionNonce":1434943559,"isDeleted":false,"boundElements":null,"updated":1695498089101,"link":null,"locked":false,"points":[[0,0],[105.06640625,109.1796875]],"lastCommittedPoint":null,"startBinding":{"elementId":"CZsgDfedEqsrXkSK9gQJH","focus":-0.4142254509017335,"gap":2.28515625},"endBinding":null,"startArrowhead":null,"endArrowhead":"arrow"},{"id":"DCQM7O8k","type":"text","x":112.515625,"y":-27.84375,"width":42.17994689941406,"height":25,"angle":0,"strokeColor":"#1e1e1e","backgroundColor":"transparent","fillStyle":"hachure","strokeWidth":1,"strokeStyle":"solid","roughness":1,"opacity":100,"groupIds":[],"frameId":null,"roundness":null,"seed":358308487,"version":5,"versionNonce":1560033513,"isDeleted":false,"boundElements":null,"updated":1695498093145,"link":null,"locked":false,"text":"boop","rawText":"boop","fontSize":20,"fontFamily":1,"textAlign":"left","verticalAlign":"top","baseline":18,"containerId":null,"originalText":"boop","lineHeight":1.25},{"id":"rN0xD5d1otB0Txp8mrVKE","type":"rectangle","x":94.73046875,"y":-44.63671875,"width":76.48046875,"height":59.0703125,"angle":0,"strokeColor":"#1e1e1e","backgroundColor":"transparent","fillStyle":"hachure","strokeWidth":1,"strokeStyle":"solid","roughness":1,"opacity":100,"groupIds":[],"frameId":null,"roundness":{"type":3},"seed":1024447145,"version":54,"versionNonce":1399780105,"isDeleted":false,"boundElements":null,"updated":1695498097327,"link":null,"locked":false},{"id":"EAi6LVWi5tLJIMLTDPXa7","type":"line","x":93.21875,"y":24.30078125,"width":80.23046875,"height":83.078125,"angle":0,"strokeColor":"#1e1e1e","backgroundColor":"transparent","fillStyle":"hachure","strokeWidth":1,"strokeStyle":"solid","roughness":1,"opacity":100,"groupIds":[],"frameId":null,"roundness":{"type":2},"seed":795411751,"version":27,"versionNonce":309139625,"isDeleted":false,"boundElements":null,"updated":1695498103612,"link":null,"locked":false,"points":[[0,0],[-80.23046875,83.078125]],"lastCommittedPoint":null,"startBinding":null,"endBinding":null,"startArrowhead":null,"endArrowhead":null},{"id":"LIzHXsQpdg5HRqdFJywOn","type":"rectangle","x":-90.056640625,"y":115.9765625,"width":103,"height":59,"angle":0,"strokeColor":"#1e1e1e","backgroundColor":"transparent","fillStyle":"hachure","strokeWidth":1,"strokeStyle":"solid","roughness":1,"opacity":100,"groupIds":[],"frameId":null,"roundness":{"type":3},"seed":611720073,"version":64,"versionNonce":2050110535,"isDeleted":false,"boundElements":[{"type":"text","id":"ASLeSCTL"}],"updated":1695498114978,"link":null,"locked":false},{"id":"ASLeSCTL","type":"text","x":-64.65660858154297,"y":132.9765625,"width":52.19993591308594,"height":25,"angle":0,"strokeColor":"#1e1e1e","backgroundColor":"transparent","fillStyle":"hachure","strokeWidth":1,"strokeStyle":"solid","roughness":1,"opacity":100,"groupIds":[],"frameId":null,"roundness":null,"seed":1398305225,"version":6,"versionNonce":1100335623,"isDeleted":false,"boundElements":null,"updated":1695498114039,"link":null,"locked":false,"text":"bebop","rawText":"bebop","fontSize":20,"fontFamily":1,"textAlign":"center","verticalAlign":"middle","baseline":18,"containerId":"LIzHXsQpdg5HRqdFJywOn","originalText":"bebop","lineHeight":1.25}],"appState":{"theme":"light","viewBackgroundColor":"#ffffff","currentItemStrokeColor":"#1e1e1e","currentItemBackgroundColor":"transparent","currentItemFillStyle":"hachure","currentItemStrokeWidth":1,"currentItemStrokeStyle":"solid","currentItemRoughness":1,"currentItemOpacity":100,"currentItemFontFamily":1,"currentItemFontSize":20,"currentItemTextAlign":"left","currentItemStartArrowhead":null,"currentItemEndArrowhead":"arrow","scrollX":339,"scrollY":360.9765625,"zoom":{"value":1},"currentItemRoundness":"round","gridSize":null,"gridColor":{"Bold":"#C9C9C9FF","Regular":"#EDEDEDFF"},"currentStrokeOptions":null,"previousGridSize":null,"frameRendering":{"enabled":true,"clip":true,"name":true,"outline":true}},"files":{}};InitialData.scrollToContent=true;App=()=>{const e=React.useRef(null),t=React.useRef(null),[n,i]=React.useState({width:void 0,height:void 0});return React.useEffect(()=>{i({width:t.current.getBoundingClientRect().width,height:t.current.getBoundingClientRect().height});const e=()=>{i({width:t.current.getBoundingClientRect().width,height:t.current.getBoundingClientRect().height})};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[t]),React.createElement(React.Fragment,null,React.createElement("div",{className:"excalidraw-wrapper",ref:t},React.createElement(ExcalidrawLib.Excalidraw,{ref:e,width:n.width,height:n.height,initialData:InitialData,viewModeEnabled:!0,zenModeEnabled:!0,gridModeEnabled:!1})))},excalidrawWrapper=document.getElementById("Drawing_2023-09-23_2241.09.excalidraw.md1");ReactDOM.render(React.createElement(App),excalidrawWrapper);})();</script>
==========
P Plugins/PD Dataview/PD2 Inline queries.md
==========
---
{"dg-publish":true,"permalink":"/p-plugins/pd-dataview/pd-2-inline-queries/"}
---





this note is about foo

==========
P Plugins/PD Dataview/PD1 Dataview.md
==========
Expand All @@ -63,9 +76,13 @@ P Plugins/PD Dataview/PD1 Dataview.md

I'm a list of all files in this folder:

- [[P Plugins/PD Dataview/PD0 - note with summary\|PD0 - note with summary]]
- [[P Plugins/PD Dataview/PD1 Dataview\|PD1 Dataview]]
- [[P Plugins/PD Dataview/PD2 Inline queries\|PD2 Inline queries]]
- [[P Plugins/PE Excalidraw/PE1 Embedded excalidraw\|PE1 Embedded excalidraw]]
- [[P Plugins/PE Excalidraw/PE1 Transcluded excalidraw\|PE1 Transcluded excalidraw]]


{ .block-language-dataview}

==========
Expand Down

0 comments on commit 9d25440

Please sign in to comment.