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

Feature Request: Simple Journal Template Transformation? #1585

Open
1 task done
pankajgarkoti opened this issue Sep 23, 2024 · 1 comment
Open
1 task done

Feature Request: Simple Journal Template Transformation? #1585

pankajgarkoti opened this issue Sep 23, 2024 · 1 comment
Labels
feature Issues related to feature proposals. Please attach a module.

Comments

@pankajgarkoti
Copy link

Issues

  • I have checked existing issues and there are no existing ones with the same request.

Feature description

I have a journal template that I use daily, and I would like to streamline the process of creating new journal entries by automatically transferring tasks from the previous day.

Current Template


___

*DDDD DDDD-MM-YY*

___

* Tasks
    - ( ) Task 1
    - ( ) Task 2
* Logs
    > Logs of the day
    - HH:mm:ss describe what you're doing
* Notes
    > Any additional notes
* /Template Version: YYYY-MM-DD/

Entry for 2024-09-24

___
*Tuesday 2024-09-24*
___

* Tasks
    - ( ) world domination
    - (x) grocery shopping
* Logs
    > Logs of the day
    - HH:mm:ss describe what you're doing
* Notes
    > Any additional notes
* /Template Version: 2024-09-24/

Entry for 2024-09-25

___
*Wednesday 2024-09-25*
___

* Tasks
    - ( ) world domination # Automatically transferred from the previous day #
* Logs
    > Logs of the day
    - HH:mm:ss describe what you're doing
* Notes
    > Any additional notes
* /Template Version: 2024-09-24/

Want

As shown in the examples, I want to:

  • Automatically transfer the unfinished tasks from the previous day's entry to the current day's entry.
  • Additionally add any more arbitrary transformations I can define. Such as adding dates automatically and so on.

Implementation Suggestion

  • Provide an option to include a callback function that replaces placeholders in the template. The output from this callback function could populate the new buffer.
  • The callback function may receive the previous day's entry and the template as arguments - and return the entire text content of the new entry. This is the most general and non-invasive solution I think. The default behaviour would be a function that just returns the template and does nothing to it.

Is this already possible in Neorg? If not, would this be a feature the community is interested in? Otherwise, I plan to implement it as a macro in my configuration.

Help

Yes, but I don't know how to start. I would need guidance

Implementation help

  • Just a good discussion and some pointers to the right files.
@pankajgarkoti pankajgarkoti added the feature Issues related to feature proposals. Please attach a module. label Sep 23, 2024
@github-project-automation github-project-automation bot moved this to added-updated-reopened in sorting neorg issue tracker Sep 23, 2024
@benlubas
Copy link
Contributor

benlubas commented Oct 6, 2024

The general idea of dynamic templates for your journal is covered in a external module neorg-templates which I highly recommend. And implementing some sort of task carryover would be best done in that plugin I think.

I attempted a "task carryover" feature myself dots. Unfortunately, the way I wanted to do this with Treesitter is inconsistent b/c of a bug in the TS parser that prevented matching something that looked like this:

** heading with a specific name

  - ( ) tasks after a blank line

As far as implementation details, you could search for all todo items very easily with just a single TS query if you don't care about what heading they're under, then you could just return them from a function that you turn into a snippet node in neorg-templates.

You could then contribute that function to neorg-templates, or just keep it for yourself and share it in a discussion in the neorg-templates repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Issues related to feature proposals. Please attach a module.
Projects
None yet
Development

No branches or pull requests

2 participants