1
0
Fork 0
digital-anti-bad-habit-note.../.obsidian/plugins/templater-obsidian/main.js

21 lines
193 KiB
JavaScript
Raw Normal View History

2024-12-03 23:58:57 +00:00
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var Yi=Object.create;var or=Object.defineProperty;var Hi=Object.getOwnPropertyDescriptor;var Gi=Object.getOwnPropertyNames;var Vi=Object.getPrototypeOf,Wi=Object.prototype.hasOwnProperty;var Fn=r=>or(r,"__esModule",{value:!0});var Ki=(r,e)=>{Fn(r);for(var t in e)or(r,t,{get:e[t],enumerable:!0})},Ui=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Gi(e))!Wi.call(r,n)&&n!=="default"&&or(r,n,{get:()=>e[n],enumerable:!(t=Hi(e,n))||t.enumerable});return r},V=r=>Ui(Fn(or(r!=null?Yi(Vi(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var Mn=(()=>{for(var r=new Uint8Array(128),e=0;e<64;e++)r[e<26?e+65:e<52?e+71:e<62?e-4:e*4-205]=e;return t=>{for(var n=t.length,o=new Uint8Array((n-(t[n-1]=="=")-(t[n-2]=="="))*3/4|0),s=0,a=0;s<n;){var A=r[t.charCodeAt(s++)],c=r[t.charCodeAt(s++)],d=r[t.charCodeAt(s++)],f=r[t.charCodeAt(s++)];o[a++]=A<<2|c>>4,o[a++]=c<<4|d>>2,o[a++]=d<<6|f}return o}})();Ki(exports,{default:()=>hn});var vr=V(require("obsidian"));var M=V(require("obsidian"));var Pn=V(require("obsidian"));function K(r){let e=new Pn.Notice("",8e3);r instanceof w&&r.console_msg?(e.noticeEl.innerHTML=`<b>Templater Error</b>:<br/>${r.message}<br/>Check console for more information`,console.error("Templater Error:",r.message,`
`,r.console_msg)):e.noticeEl.innerHTML=`<b>Templater Error</b>:<br/>${r.message}`}var w=class extends Error{constructor(e,t){super(e);this.console_msg=t;this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}};async function ye(r,e){try{return await r()}catch(t){return t instanceof w?K(t):K(new w(e,t.message)),null}}function ce(r,e){try{return r()}catch(t){return K(new w(e,t.message)),null}}var Ce=V(require("obsidian"));function sr(r){return new Promise(e=>setTimeout(e,r))}function Bn(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qn(){return/(<%(?:-|_)?\s*[*~]{0,1})\+((?:.|\s)*?%>)/g}function zi(r,e){e=(0,Ce.normalizePath)(e);let t=r.vault.getAbstractFileByPath(e);if(!t)throw new w(`Folder "${e}" doesn't exist`);if(!(t instanceof Ce.TFolder))throw new w(`${e} is a file, not a folder`);return t}function lt(r,e){e=(0,Ce.normalizePath)(e);let t=r.vault.getAbstractFileByPath(e);if(!t)throw new w(`File "${e}" doesn't exist`);if(!(t instanceof Ce.TFile))throw new w(`${e} is a folder, not a file`);return t}function Ie(r,e){let t=zi(r,e),n=[];return Ce.Vault.recurseChildren(t,o=>{o instanceof Ce.TFile&&n.push(o)}),n.sort((o,s)=>o.path.localeCompare(s.path)),n}function pt(r,e,t){if(t<0||t===r.length)return;let n=r[e];r[e]=r[t],r[t]=n}function xt(r){return r.workspace.activeEditor?.file??r.workspace.getActiveFile()}function On(r){let e=r.lastIndexOf("/");return e!==-1?r.slice(0,e):""}function kr(r){return r!==null&&typeof r=="object"}function Cn(r){let e=r.toString(),t=e.indexOf("(");return e.substring(t+1,e.indexOf(")")).replace(/ /g,"").split(",")}var ii=V(require("obsidian"));var ri=V(require("obsidian"));var W="top",ee="bottom",Q="right",U="left",ar="auto",et=[W,ee,Q,U],We="start",ct="end",In="clippingParents",lr="viewport",Et="popper",Sn="reference",Tr=et.reduce(function(r,e){return r.concat([e+"-"+We,e+"-"+ct])},[]),pr=[].concat(et,[ar]).reduce(function(r,e){return r.concat([e,e+"-"+We,e+"-"+ct])},[]),Ji="beforeRead",Xi="read",Qi="afterRead",Zi="beforeMain",eo="main",to="afterMain",ro="beforeWrite",no="write",io="afterWrite",Dn=[Ji,Xi,Qi,Zi,eo,to,ro,no,io];function re(r){return r?(r.nodeName||"").toLowerCase():null}function L(r){if(r==null)return window;if(r.toString()!=="[object Window]"){var e=r.ownerDocument;return e&&e.defaultView||window}return r}function he(r){var e=L(r).Element;return r instanceof e||r instanceof Element}function te(r){var e=L(r).HTMLElement;return r instanceof e||r instanceof HTMLElement}function kt(r){if(typeof ShadowRoot=="undefined")return!1;var e=L(r).ShadowRoot;return r instanceof e||r instanceof ShadowRoot}function oo(r){var e=r.state;Object.keys(e.elements).forEach(function(t){var n=e.styles[t]||{},o=e.attributes[t]||{},s=e.elements[t];!te(s)||!re(s)||(Object.assign(s.style,n),Object.keys(o).forEach(function(a){var A=o[a];A===!1?s.removeAttribute(a):s.setAttribute(a,A===!0?"":A)}))})}function so(r){var e=r.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(n){var o=e.elements[n],s=e.attributes[n]||{},a=Object.keys(e.styles.hasOwnProperty(n)?e.styles[n]:t[n]),A=a.reduce(function(c,d){return c[d]="",c},{});!te(o)||!re(o)||(Object.assign(o.style,A),Object.keys(s).forEach(function(c){o.removeAttribute(c)}))})}}var $n={name:"applyStyles",enabled:!0,phase:"write",fn:oo,effect:so,requires:["computeStyles"]};function ne(r){return r.split("-")[0]}var xe=Math.max,At=Math.min,Ke=Math.round;function Tt(){var r=navigator.userAgentData;return r!=null&&r.brands&&Array.isArray(r.brands)?r.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Dt(){return!/^((?!chrome|android).)*safari/i.test(Tt())}function je(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var n=r.getBoundingClientRect(),o=1,s=1;e&&te(r)&&(o=r.offsetWidth>0&&Ke(n.width)/r.offsetWidth||1,s=r.offsetHeight>
> \u2014 ${s}`}catch{return new w("Error generating daily quote"),"Error generating daily quote"}}}generate_random_picture(){return async(e,t,n=!1)=>{try{let o=await this.getRequest(`https://templater-unsplash-2.fly.dev/${t?"?q="+t:""}`).then(a=>a.json),s=o.full;if(e&&!n)if(e.includes("x")){let[a,A]=e.split("x");s=s.concat(`&w=${a}&h=${A}`)}else s=s.concat(`&w=${e}`);return n?`![photo by ${o.photog}(${o.photogUrl}) on Unsplash|${e}](${s})`:`![photo by ${o.photog}(${o.photogUrl}) on Unsplash](${s})`}catch{return new w("Error generating random picture"),"Error generating random picture"}}}generate_request(){return async(e,t)=>{try{let o=await(await this.getRequest(e)).json;return t&&o?t.split(".").reduce((s,a)=>{if(s&&s.hasOwnProperty(a))return s[a];throw new Error(`Path ${t} not found in the JSON response`)},o):o}catch(n){throw console.error(n),new w("Error fetching and extracting value")}}}};var Wr=class extends ue{constructor(){super(...arguments);this.name="hooks";this.event_refs=[]}async create_static_templates(){this.static_functions.set("on_all_templates_executed",this.generate_on_all_templates_executed())}async create_dynamic_templates(){}async teardown(){this.event_refs.forEach(e=>{e.e.offref(e)}),this.event_refs=[]}generate_on_all_templates_executed(){return e=>{let t=this.plugin.app.workspace.on("templater:all-templates-executed",async()=>{await sr(1),e()});t&&this.event_refs.push(t)}}};var Kr=class extends ue{constructor(){super(...arguments);this.name="frontmatter"}async create_static_templates(){}async create_dynamic_templates(){let e=this.plugin.app.metadataCache.getFileCache(this.config.target_file);this.dynamic_functions=new Map(Object.entries(e?.frontmatter||{}))}async teardown(){}};var Se=V(require("obsidian"));var Ur=class extends Se.Modal{constructor(e,t,n,o){super(e);this.prompt_text=t;this.default_value=n;this.multi_line=o;this.submitted=!1}onOpen(){this.titleEl.setText(this.prompt_text),this.createForm()}onClose(){this.contentEl.empty(),this.submitted||this.reject(new w("Cancelled prompt"))}createForm(){let e=this.contentEl.createDiv();e.addClass("templater-prompt-div");let t;if(this.multi_line){t=new Se.TextAreaComponent(e);let n=this.contentEl.createDiv();n.addClass("templater-button-div");let o=new Se.ButtonComponent(n);o.buttonEl.addClass("mod-cta"),o.setButtonText("Submit").onClick(s=>{this.resolveAndClose(s)})}else t=new Se.TextComponent(e);this.value=this.default_value??"",t.inputEl.addClass("templater-prompt-input"),t.setPlaceholder("Type text here"),t.setValue(this.value),t.onChange(n=>this.value=n),t.inputEl.focus(),t.inputEl.addEventListener("keydown",n=>this.enterCallback(n))}enterCallback(e){e.isComposing||e.keyCode===229||(this.multi_line?Se.Platform.isDesktop&&e.key==="Enter"&&!e.shiftKey&&this.resolveAndClose(e):e.key==="Enter"&&this.resolveAndClose(e))}resolveAndClose(e){this.submitted=!0,e.preventDefault(),this.resolve(this.value),this.close()}async openAndGetValue(e,t){this.resolve=e,this.reject=t,this.open()}};var Ai=V(require("obsidian")),zr=class extends Ai.FuzzySuggestModal{constructor(e,t,n,o,s){super(e);this.text_items=t;this.items=n;this.submitted=!1;this.setPlaceholder(o),s&&(this.limit=s)}getItems(){return this.items}onClose(){this.submitted||this.reject(new w("Cancelled prompt"))}selectSuggestion(e,t){this.submitted=!0,this.close(),this.onChooseSuggestion(e,t)}getItemText(e){return this.text_items instanceof Function?this.text_items(e):this.text_items[this.items.indexOf(e)]||"Undefined Text Item"}onChooseItem(e){this.resolve(e)}async openAndGetValue(e,t){this.resolve=e,this.reject=t,this.open()}};var Jr=class extends ue{constructor(){super(...arguments);this.name="system"}async create_static_templates(){this.static_functions.set("clipboard",this.generate_clipboard()),this.static_functions.set("prompt",this.generate_prompt()),this.static_functions.set("suggester",this.generate_suggester())}async create_dynamic_templates(){}async teardown(){}generate_clipboard(){return async()=>await navigator.clipboard.readText()}generate_prompt(){return async(e,t,n=!1,o=!1)=>{let s=new
})`)(n,s,o)}catch(c){throw new w(`Failed to load user script at "${e.path}".`,c.message)}let A=o.default||s.exports;if(!A)throw new w(`Failed to load user script at "${e.path}". No exports detected.`);if(!(A instanceof Function))throw new w(`Failed to load user script at "${e.path}". Default export is not a function.`);t.set(`${e.basename}`,A)}async generate_object(){let e=await this.generate_user_script_functions();return Object.fromEntries(e)}};var tn=class{constructor(e){this.plugin=e;this.user_system_functions=new Zr(e),this.user_script_functions=new en(e)}async generate_object(e){let t={},n={};return this.plugin.settings.enable_system_commands&&(t=await this.user_system_functions.generate_object(e)),this.plugin.settings.user_scripts_folder&&(n=await this.user_script_functions.generate_object()),{...t,...n}}};var Bo=V(require("obsidian")),De;(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.USER_INTERNAL=1]="USER_INTERNAL"})(De||(De={}));var rn=class{constructor(e){this.plugin=e;this.internal_functions=new Qr(this.plugin),this.user_functions=new tn(this.plugin)}async init(){await this.internal_functions.init()}async teardown(){await this.internal_functions.teardown()}additional_functions(){return{app:this.plugin.app,obsidian:Bo}}async generate_object(e,t=1){let n={},o=this.additional_functions(),s=await this.internal_functions.generate_object(e),a={};switch(Object.assign(n,o),t){case 0:Object.assign(n,s);break;case 1:a=await this.user_functions.generate_object(e),Object.assign(n,{...s,user:a});break}return n}};var Lo={},v,Fe=new Array(32).fill(void 0);Fe.push(void 0,null,!0,!1);function de(r){return Fe[r]}var Wt=Fe.length;function qo(r){r<36||(Fe[r]=Wt,Wt=r)}function nn(r){let e=de(r);return qo(r),e}var ui=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});ui.decode();var fr=new Uint8Array;function dr(){return fr.byteLength===0&&(fr=new Uint8Array(v.memory.buffer)),fr}function rt(r,e){return ui.decode(dr().subarray(r,r+e))}function nt(r){Wt===Fe.length&&Fe.push(Fe.length+1);let e=Wt;return Wt=Fe[e],Fe[e]=r,e}var Me=0,gr=new TextEncoder("utf-8"),Oo=typeof gr.encodeInto=="function"?function(r,e){return gr.encodeInto(r,e)}:function(r,e){let t=gr.encode(r);return e.set(t),{read:r.length,written:t.length}};function Je(r,e,t){if(t===void 0){let A=gr.encode(r),c=e(A.length);return dr().subarray(c,c+A.length).set(A),Me=A.length,c}let n=r.length,o=e(n),s=dr(),a=0;for(;a<n;a++){let A=r.charCodeAt(a);if(A>127)break;s[o+a]=A}if(a!==n){a!==0&&(r=r.slice(a)),o=t(o,n,n=a+r.length*3);let A=dr().subarray(o+a,o+n);a+=Oo(r,A).written}return Me=a,o}function Co(r){return r==null}var hr=new Int32Array;function ge(){return hr.byteLength===0&&(hr=new Int32Array(v.memory.buffer)),hr}function on(r){let e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){let o=r.description;return o==null?"Symbol":`Symbol(${o})`}if(e=="function"){let o=r.name;return typeof o=="string"&&o.length>0?`Function(${o})`:"Function"}if(Array.isArray(r)){let o=r.length,s="[";o>0&&(s+=on(r[0]));for(let a=1;a<o;a++)s+=", "+on(r[a]);return s+="]",s}let t=/\[object ([^\]]+)\]/.exec(toString.call(r)),n;if(t.length>1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message}
${r.stack}`:n}function Io(r,e){if(!(r instanceof e))throw new Error(`expected instance of ${e.name}`);return r.ptr}var jr=32;function So(r){if(jr==1)throw new Error("out of js stack");return Fe[--jr]=r,jr}function sn(r,e){try{return r.apply(this,e)}catch(t){v.__wbindgen_exn_store(nt(t))}}var jt=class{static __wrap(e){let t=Object.create(jt.prototype);return t.ptr=e,t}__destroy_into_raw(){let e=this.ptr;return this.ptr=0,e}free(){let e=this.__destroy_into_raw();v.__wbg_parserconfig_free(e)}get interpolate(){let e=v.__wbg_get_parserconfig_interpolate(this.ptr);return String.fromCodePoint(e)}set interpolate(e){v.__wbg_set_parserconfig_interpolate(this.ptr,e.codePointAt(0))}get execution(){let e=v.__wbg_get_parserconfig_execution(this.ptr);return String.fromCodePoint(e)}set execution(e){v.__wbg_set_parserconfig_execution(this.ptr,e.codePointAt(0))}get single_whitespace(){let e=v.__wbg_get_parserconfig_single_whitespace(this.ptr);return String.fromCodePoint(e)}set single_whitespace(e){v.__wbg_set_parserconfig_single_whitespace(this.ptr,e.codePointAt(0))}get multiple_whitespace(){let e=v.__wbg_get_parserconfig_multiple_whitespace(this.ptr);return String.fromCodePoint(e)}set multiple_whitespace(e){v.__wbg_set_parserconfig_multiple_whitespace(this.ptr,e.codePointAt(0))}constructor(e,t,n,o,s,a,A){let c=Je(e,v.__wbindgen_malloc,v.__wbindgen_realloc),d=Me,f=Je(t,v.__wbindgen_malloc,v.__wbindgen_realloc),b=Me,k=Je(A,v.__wbindgen_malloc,v.__wbindgen_realloc),x=Me,O=v.parserconfig_new(c,d,f,b,n.codePointAt(0),o.codePointAt(0),s.codePointAt(0),a.codePointAt(0),k,x);return jt.__wrap(O)}get opening_tag(){try{let n=v.__wbindgen_add_to_stack_pointer(-16);v.parserconfig_opening_tag(n,this.ptr);var e=ge()[n/4+0],t=ge()[n/4+1];return rt(e,t)}finally{v.__wbindgen_add_to_stack_pointer(16),v.__wbindgen_free(e,t)}}set opening_tag(e){let t=Je(e,v.__wbindgen_malloc,v.__wbindgen_realloc),n=Me;v.parserconfig_set_opening_tag(this.ptr,t,n)}get closing_tag(){try{let n=v.__wbindgen_add_to_stack_pointer(-16);v.parserconfig_closing_tag(n,this.ptr);var e=ge()[n/4+0],t=ge()[n/4+1];return rt(e,t)}finally{v.__wbindgen_add_to_stack_pointer(16),v.__wbindgen_free(e,t)}}set closing_tag(e){let t=Je(e,v.__wbindgen_malloc,v.__wbindgen_realloc),n=Me;v.parserconfig_set_closing_tag(this.ptr,t,n)}get global_var(){try{let n=v.__wbindgen_add_to_stack_pointer(-16);v.parserconfig_global_var(n,this.ptr);var e=ge()[n/4+0],t=ge()[n/4+1];return rt(e,t)}finally{v.__wbindgen_add_to_stack_pointer(16),v.__wbindgen_free(e,t)}}set global_var(e){let t=Je(e,v.__wbindgen_malloc,v.__wbindgen_realloc),n=Me;v.parserconfig_set_global_var(this.ptr,t,n)}},qt=class{static __wrap(e){let t=Object.create(qt.prototype);return t.ptr=e,t}__destroy_into_raw(){let e=this.ptr;return this.ptr=0,e}free(){let e=this.__destroy_into_raw();v.__wbg_renderer_free(e)}constructor(e){Io(e,jt);var t=e.ptr;e.ptr=0;let n=v.renderer_new(t);return qt.__wrap(n)}render_content(e,t){try{let a=v.__wbindgen_add_to_stack_pointer(-16),A=Je(e,v.__wbindgen_malloc,v.__wbindgen_realloc),c=Me;v.renderer_render_content(a,this.ptr,A,c,So(t));var n=ge()[a/4+0],o=ge()[a/4+1],s=ge()[a/4+2];if(s)throw nn(o);return nn(n)}finally{v.__wbindgen_add_to_stack_pointer(16),Fe[jr++]=void 0}}};async function Do(r,e){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(n){if(r.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let t=await r.arrayBuffer();return await WebAssembly.instantiate(t,e)}else{let t=await WebAssembly.instantiate(r,e);return t instanceof WebAssembly.Instance?{instance:t,module:r}:t}}function $o(){let r={};return r.wbg={},r.wbg.__wbindgen_object_drop_ref=function(e){nn(e)},r.wbg.__wbindgen_string_new=function(e,t){let n=rt(e,t);return nt(n)},r.wbg.__wbindgen_string_get=function(e,t){let n=de
`,a+1))!==-1;o++,s=a);s+=1;let A=e.slice(s,t).length;return{line:o,ch:A}}replace_and_get_cursor_positions(e){let t=[],n,o=new RegExp("<%\\s*tp.file.cursor\\((?<order>[0-9]*)\\)\\s*%>","g");for(;(n=o.exec(e))!=null;)t.push(n);if(t.length===0)return{};t.sort((c,d)=>Number(c.groups&&c.groups.order)-Number(d.groups&&d.groups.order));let s=t[0][0];t=t.filter(c=>c[0]===s);let a=[],A=0;for(let c of t){let d=c.index-A;if(a.push(this.get_editor_position_from_index(e,d)),e=e.replace(new RegExp(Bn(c[0])),""),A+=c[0].length,c[1]==="")break}return{new_content:e,positions:a}}set_cursor_location(e){let t=this.app.workspace.activeEditor;if(!t||!t.editor)return;let n=t.editor,o=[];for(let a of e)o.push({from:a});let s={selections:o};n.transaction(s)}};var wi=V(require("obsidian"));var Ho={app:{name:"app",description:"This module exposes the app instance. Prefer to use this over the global app instance."},config:{name:"config",description:`This module exposes Templater's running configuration.
This is mostly useful when writing scripts requiring some context information.
`,functions:{template_file:{name:"template_file",description:"The `TFile` object representing the template file.",definition:"tp.config.template_file"},target_file:{name:"target_file",description:"The `TFile` object representing the target file where the template will be inserted.",definition:"tp.config.target_file"},run_mode:{name:"run_mode",description:"The `RunMode`, representing the way Templater was launched (Create new from template, Append to active file, ...).",definition:"tp.config.run_mode"},active_file:{name:"active_file",description:"The active file (if existing) when launching Templater.",definition:"tp.config.active_file?"}}},date:{name:"date",description:"This module contains every internal function related to dates.",functions:{now:{name:"now",description:"Retrieves the date.",definition:'tp.date.now(format: string = "YYYY-MM-DD", offset?: number\u23AEstring, reference?: string, reference_format?: string)',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/).'},{name:"offset",description:"Duration to offset the date from. If a number is provided, duration will be added to the date in days. You can also specify the offset as a string using the ISO 8601 format."},{name:"reference",description:"The date referential, e.g. set this to the note's title."},{name:"reference_format",description:"The format for the reference date. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/)."}],examples:[{name:"Date now",example:"<% tp.date.now() %>"},{name:"Date now with format",example:'<% tp.date.now("Do MMMM YYYY") %>'},{name:"Last week",example:'<% tp.date.now("YYYY-MM-DD", -7) %>'},{name:"Next week",example:'<% tp.date.now("YYYY-MM-DD", 7) %>'},{name:"Last month",example:'<% tp.date.now("YYYY-MM-DD", "P-1M") %>'},{name:"Next year",example:'<% tp.date.now("YYYY-MM-DD", "P1Y") %>'},{name:"File's title date + 1 day (tomorrow)",example:'<% tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD") %>'},{name:"File's title date - 1 day (yesterday)",example:'<% tp.date.now("YYYY-MM-DD", -1, tp.file.title, "YYYY-MM-DD") %>'}]},tomorrow:{name:"tomorrow",description:"Retrieves tomorrow's date.",definition:'tp.date.tomorrow(format: string = "YYYY-MM-DD")',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/).'}],examples:[{name:"Date tomorrow",example:"<% tp.date.tomorrow() %>"},{name:"Date tomorrow with format",example:'<% tp.date.tomorrow("Do MMMM YYYY") %>'}]},yesterday:{name:"yesterday",description:"Retrieves yesterday's date.",definition:'tp.date.yesterday(format: string = "YYYY-MM-DD")',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/).'}],examples:[{name:"Date yesterday",example:"<% tp.date.yesterday() %>"},{name:"Date yesterday with format",example:'<% tp.date.yesterday("Do MMMM YYYY") %>'}]},weekday:{name:"weekday",description:"",definition:'tp.date.weekday(format: string = "YYYY-MM-DD", weekday: number, reference?: string, reference_format?: string)',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/).'},{name:"weekday",description:"Week day number. If the locale assigns Monday as the first day of the week, `0` will be Monday, `-7` will be last week's day."},{name:"reference",description:"The date referential, e.g. set this to the note's title."},{name:"reference_format",description:"The format for the reference date. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/)."}],examples:[{name:"This week's Monday",example:'<% tp.date.weekday("YYYY-MM-DD", 0) %>'},{name:"Next Monday",example:'<% tp.date.weekday("YYYY-MM-DD", 7) %>'},{name:"File's title Monday",example:'<% tp.date.weekday("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD") %>'},{nam
You can navigate between the different cursors using the configured hotkey in Obsidian settings.
`,definition:"tp.file.cursor(order?: number)",args:[{name:"order",description:`The order of the different cursors jump, e.g. it will jump from 1 to 2 to 3, and so on.
If you specify multiple tp.file.cursor with the same order, the editor will switch to multi-cursor.
`}],examples:[{name:"File cursor",example:"<% tp.file.cursor() %>"},{name:"File multi-cursor",example:"<% tp.file.cursor(1) %>Content<% tp.file.cursor(1) %>"}]},cursor_append:{name:"cursor_append",description:"Appends some content after the active cursor in the file.",definition:"tp.file.cursor_append(content: string)",args:[{name:"content",description:"The content to append after the active cursor."}],examples:[{name:"File cursor append",example:'<% tp.file.cursor_append("Some text") %>'}]},exists:{name:"exists",description:"Check to see if a file exists by it's file path. The full path to the file, relative to the Vault and containing the extension, must be provided.",definition:"tp.file.exists(filepath: string)",args:[{name:"filepath",description:"The full file path of the file we want to check existence for."}],examples:[{name:"File existence",example:'<% await tp.file.exists("MyFolder/MyFile.md") %>'},{name:"File existence of current file",example:'<% await tp.file.exists(tp.file.folder(true) + "/" + tp.file.title + ".md") %>'}]},find_tfile:{name:"find_tfile",description:"Search for a file and returns its `TFile` instance.",definition:"tp.file.find_tfile(filename: string)",args:[{name:"filename",description:"The filename we want to search and resolve as a `TFile`."}],examples:[{name:"File find TFile",example:'<% tp.file.find_tfile("MyFile").basename %>'}]},folder:{name:"folder",description:"Retrieves the file's folder name.",definition:"tp.file.folder(absolute: boolean = false)",args:[{name:"absolute",description:"If set to `true`, returns the vault-absolute path of the folder. If `false`, only returns the basename of the folder (the last part). Defaults to `false`."}],examples:[{name:"File folder (Folder)",example:"<% tp.file.folder() %>"},{name:"File folder with vault-absolute path (Path/To/Folder)",example:"<% tp.file.folder(true) %>"}]},include:{name:"include",description:"Includes the file's link content. Templates in the included content will be resolved.",definition:"tp.file.include(include_link: string \u23AE TFile)",args:[{name:"include_link",description:'The link to the file to include, e.g. `"[[MyFile]]"`, or a TFile object. Also supports sections or blocks inclusions.'}],examples:[{name:"File include",example:'<% tp.file.include("[[Template1]]") %>'},{name:"File include TFile",example:'<% tp.file.include(tp.file.find_tfile("MyFile")) %>'},{name:"File include section",example:'<% tp.file.include("[[MyFile#Section1]]") %>'},{name:"File include block",example:'<% tp.file.include("[[MyFile#^block1]]") %>'}]},last_modified_date:{name:"last_modified_date",description:"Retrieves the file's last modification date.",definition:'tp.file.last_modified_date(format: string = "YYYY-MM-DD HH:mm")',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD HH:mm"`. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/).'}],examples:[{name:"File last modified date",example:"<% tp.file.last_modified_date() %>"},{name:"File last modified date with format",example:'<% tp.file.last_modified_date("dddd Do MMMM YYYY HH:mm") %>'}]},move:{name:"move",description:"Moves the file to the desired vault location.",definition:"tp.file.move(new_path: string, file_to_move?: TFile)",args:[{name:"new_path",description:'The new vault relative path of the file, without the file extension. Note: the new path needs to include the folder and the filename, e.g. `"/Notes/MyNote"`.'},{name:"file_to_move",description:"The file to move, defaults to the current file."}],examples:[{name:"File move",example:'<% await tp.file.move("/A/B/" + tp.file.title) %>'},{name:"File move and rename",example:'<% await tp.file.move("/A/B/NewTitle") %>'}]},path:{name:"path",description:"Retrieves the file's absolute path on the system.",definition:"tp.file.path(relative: boolean = false)",args:[{name:"relative",description:"If set to `true`, only retrieves the vault's relative path."}],examples:[{name:"File path",example:"<% tp.file.path() %>"},{name:"File relative path (relative to vault root)",example:"<% tp.file.path
/* nosourcemap */