Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught errors when activated with Periodic Notes #1129

Closed
michaelm2391 opened this issue Jun 17, 2023 · 6 comments
Closed

Uncaught errors when activated with Periodic Notes #1129

michaelm2391 opened this issue Jun 17, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@michaelm2391
Copy link

michaelm2391 commented Jun 17, 2023

Specs:

  • OS: Windows 10
  • Templater version: 1.16.0
  • Obsidian version: 1.3.5

I am receiving the following error in the console whenever I activate a new daily note using the Periodic Notes plugin:
Templater Error: Template parsing error, aborting. Unexpected identifier 'contents'

Templater is attempting to activate the following template. The only way to get the console to return no error is to activate the daily note without anything in this template; conversely, I've tried removing each line of code one-by-one, and in every such case it generates the error.

*Created: <% tp.file.creation_date() %>* 
*Modified: <% tp.file.last_modified_date() %>* 

<%* 
tR += "# 📆"; 
tR += tp.date.now("dddd DD MMMM Y") 
%>
<svg viewBox="0 0 3760 100">
  <title>Timeline 2022</title>
  <g class='bars'>
    <rect fill='#0066FF' x='0' width='310' height='25'></rect>
    <rect fill='#3366AA' x='320' width='280' height='25'></rect>
    <rect fill='#99AA33' x='610' width='310' height='25'></rect>
    <rect fill='#99EE33' x='930' width='300' height='25'></rect>
    <rect fill='green' x='1240' width='310' height='25'></rect>
    <rect fill='yellow' x='1560' width='300' height='25'></rect>
    <rect fill='gold' x='1870' width='310' height='25'></rect>
    <rect fill='cyan' x='2190' width='310' height='25'></rect>
    <rect fill='orange' x='2510' width='300' height='25'></rect>
    <rect fill='red' x='2820' width='310' height='25'></rect>
    <rect fill='brown' x='3140' width='300' height='25'></rect>
    <rect fill='white' x='3450' width='310' height='25'></rect>
  </g>
  <g class='labels' style="font-size:50px;" text-anchor="middle">
    <text fill='#747474' x='0' y='80' text-anchor="start">January</text>
    <text fill='#747474' x='320' y='80' text-anchor="start">February</text>
    <text fill='#747474' x='610' y='80' text-anchor="start">March</text>
    <text fill='#747474' x='930' y='80' text-anchor="start">April</text>
    <text fill='#747474' x='1240' y='80' text-anchor="start">May</text>
    <text fill='#747474' x='1560' y='80' text-anchor="start">June</text>
    <text fill='#747474' x='1870' y='80' text-anchor="start">July</text>
    <text fill='#747474' x='2190' y='80' text-anchor="start">August</text>
    <text fill='#747474' x='2510' y='80' text-anchor="start">September</text>
    <text fill='#747474' x='2820' y='80' text-anchor="start">October</text>
    <text fill='#747474' x='3140' y='80' text-anchor="start">November</text>
    <text fill='#747474' x='3450' y='80' text-anchor="start">December</text>
  </g>
  <g>
    <circle cx="{{date:DDD}}0" cy="14" r="15" stroke="black" fill="white" />
  </g>
</svg>

<%- tp.file.rename(tp.date.now("YY-MM-DD ddd DD MMM YY")) %>

## Agenda
- [ ] 08:00 Reading
- [ ] 10:00 Reading
- [ ] 17:00 Reading

## Today's notes:

## Carryovers

## To do

## From Google Calendar
<% tp.file.cursor() %>
<%* app.commands.executeCommandById("ics-plugin:import_events") %>

This template used to work fine until I began tinkering around with the Rollover Daily Todos plugin (which seems to be basically incompatible with Templater). I have since uninstalled that plugin, but alas I am still having issues.

@michaelm2391 michaelm2391 added the bug Something isn't working label Jun 17, 2023
@Zachatoo
Copy link
Collaborator

Ran your template and it appeared to work fine.

Usually when I see rogue errors like this it's due to user scripts throwing errors. For some reason an error in a user script will cause most/all of your other templates to throw that same error.

Do you have any user scripts? If so, try turning off user scripts.

Also if you haven't already, restart Obsidian. Some plugins don't unload properly when uninstalled, restarting Obsidian forces them to unload all the way.

@michaelm2391
Copy link
Author

Right, turns out this script was the culprit:

https://gist.github.com/lenalebt/8e58aa21392c388d8c7d65bad3206e35

I'm not sure why, but turning it off makes the problem go away.

@nhan000
Copy link

nhan000 commented Jun 21, 2023

@michaelm2391
Copy link
Author

michaelm2391 commented Jun 21, 2023 via email

@michaelm2391
Copy link
Author

michaelm2391 commented Jun 24, 2023 via email

@Zachatoo
Copy link
Collaborator

Zachatoo commented Oct 4, 2023

Marking as closed. Hopefully the resolution of #1212 will help with user script issues in the future.

@Zachatoo Zachatoo closed this as completed Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants