Open zsviczian opened 3 years ago
Namespace-SB-JSON.zip
function getLocation(uid) { if (window.location.href.includes('/page/')) return window.location.href.substring(window.location.origin.length+1,window.location.href.length-9)+uid; else return window.location.href.substring(window.location.origin.length+1,window.location.href.length)+'/page/'+uid }
function pageLink(title, uid) { return [:div {:class "dont-focus-block"} [:a {:class "rm-page__title", :href "${getLocation(uid)}"} "${title}"]]; }
[:div {:class "dont-focus-block"} [:a {:class "rm-page__title", :href "${getLocation(uid)}"} "${title}"]]
function toTwoDigits(number) { return ("0" + number).slice(-2); }
function msToDate(ms) { dt = new Date(ms); month = toTwoDigits(dt.getMonth()+1); day = toTwoDigits(dt.getDate()); year = dt.getFullYear(); uid = [month,day,year].join('-'); title = [year, month, day].join('-'); return pageLink(title,uid); }
function buildTable(value, index, array) { hiccup = hiccup + '[:tr [:td ' + pageLink(value[0], value[1]) + '] '; hiccup = hiccup + '[:td ' + msToDate(value[2]) + ']] '; }
var results = window.roamAlphaAPI.q([:find ?title ?uid ?time :in $ ?starts_with :where [?page :node/title ?title] [?page :block/uid ?uid] [?page :edit/time ?time] [(clojure.string/starts-with? ?title ?starts_with)]],namespace).forEach(buildTable); hiccup = hiccup + ']]' roam42.smartBlocks.activeWorkflow.outputAdditionalBlock(hiccup, false);```%>
[:find ?title ?uid ?time :in $ ?starts_with :where [?page :node/title ?title] [?page :block/uid ?uid] [?page :edit/time ?time] [(clojure.string/starts-with? ?title ?starts_with)]]
Functionally similar to https://github.com/roamhacker/SmartBlocks/issues/184 but this outputs results to a :hiccup table.
None
Very cool, thanks!
This SmartBlock does not seem to work any longer? The only output I get is: Results:<%CURSOR%>
Results:<%CURSOR%>
Namespace-SB-JSON.zip
✂️ Copy of your #42SmartBlock from Roam
42SmartBlock Namespace
function getLocation(uid) { if (window.location.href.includes('/page/')) return window.location.href.substring(window.location.origin.length+1,window.location.href.length-9)+uid; else return window.location.href.substring(window.location.origin.length+1,window.location.href.length)+'/page/'+uid }
function pageLink(title, uid) { return
[:div {:class "dont-focus-block"} [:a {:class "rm-page__title", :href "${getLocation(uid)}"} "${title}"]]
; }function toTwoDigits(number) { return ("0" + number).slice(-2); }
function msToDate(ms) { dt = new Date(ms); month = toTwoDigits(dt.getMonth()+1); day = toTwoDigits(dt.getDate()); year = dt.getFullYear(); uid = [month,day,year].join('-'); title = [year, month, day].join('-'); return pageLink(title,uid); }
function buildTable(value, index, array) { hiccup = hiccup + '[:tr [:td ' + pageLink(value[0], value[1]) + '] '; hiccup = hiccup + '[:td ' + msToDate(value[2]) + ']] '; }
var results = window.roamAlphaAPI.q(
[:find ?title ?uid ?time :in $ ?starts_with :where [?page :node/title ?title] [?page :block/uid ?uid] [?page :edit/time ?time] [(clojure.string/starts-with? ?title ?starts_with)]]
,namespace).forEach(buildTable); hiccup = hiccup + ']]' roam42.smartBlocks.activeWorkflow.outputAdditionalBlock(hiccup, false);```%>📋 Describe the SmartBlock
Functionally similar to https://github.com/roamhacker/SmartBlocks/issues/184 but this outputs results to a :hiccup table.
✅ Describe any prerequisites or dependencies that are required for this SmartBlock
None
📷 Screenshot of your #42SmartBlock workflow/template from Roam
💡 Additional Info