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

feat!(journal): periodic & multiple journals #1474

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

benlubas
Copy link
Contributor

@benlubas benlubas commented Jun 22, 2024

implements #1471

Features

  • Support for multiple journals, and periodic journals
    • Each journal gets a name, start date, time period, and file format string/stategy
    • you can specify period as either days or months + years.
  • Ships with a daily, weekly, and monthly journal by default
  • users can create their own journals
  • all the journal commands now optionally take a journal name. When the name is left out, uses the default journal (configurable, defaults to daily).
  • new commands, :Neorg journal previous|current|next <journal_name>
  • each journal gets it's own template

Of Note

  • looking for feedback on:
    • functionality--does this cover all the cases we want? Does this ship the defaults that we want?
    • user experience/configuration--anything else that should be configurable? Should each journal be able to have its own folder? or should they continue to be in the same overarching folder, with configurable subfolders/the option to not be in a subfolder?
  • TOC code is untouched and untested, I think forcing each journal into its own subfolder would make the TOC implementation easier, other suggestions on how to handle it would be welcome
  • The breaking change is pretty minimal right now. Templates are now configured differently, and templates files will have a new name. Instead of configuring with template_name = template.norg it's now base_template_name = "template" and templates files will be created on a per-journal basis like: template-daily.norg

@benlubas
Copy link
Contributor Author

@maxkuzn if you have feedback on the features here that would be great

@vhyrro
Copy link
Member

vhyrro commented Jul 8, 2024

With core.tempus now being the defacto (since 0.10 is required) I can start reviewing this sooner than later. I took a general glance at it and the execution looks solid.

@benlubas
Copy link
Contributor Author

benlubas commented Jul 8, 2024

Had a look at this again. I think the best solution for the journal toc commands will be to make them pattern match for file names so that you get a toc specific to each journal.

I'm fairly sure it's possible to transform the path_format_strategy into a lua pattern iff the path_format_strategy is a string. When that value is a function (which is allowed) we would have to also ask the user to provide some type of filter function that takes a path and tells us if it's a part of the journal.

I think this is a fairly reasonable approach. Let me know if you have thoughts @vhyrro

@benlubas benlubas force-pushed the feat/periodic_journals branch from 5a13046 to f5607be Compare July 23, 2024 20:26
@benlubas benlubas force-pushed the feat/periodic_journals branch from f5607be to fdafabe Compare July 23, 2024 20:56
@redongh
Copy link

redongh commented Feb 11, 2025

just stumbled upon this after posting #1648 but seems like the general idea/concept behind this was at least similar.

as this feature here goes well beyond my quick-fix/workaround, i definitely think this would add great value to the journal module and would therefore love to see this becoming fully available.

one thing that i'm wondering about is how a unified TOC may look like for this.
some may want/prefer completely separate TOC's for each journal but at least for my intended use-case, a fused general journal-TOC would also be desireable. the big question is how this should look like, especially when a smaller timespan won't completely fit into a larger one (think of a weekly and a monthly journal where the week overlaps into another month) rendering nesting somewhat unsuitable.
it would however IMHO still make sense to aim for a fused/unified TOC but the only option i see right now would be an adequately named link (e.g. week07.start, week07.end, q1.start / q1.end , ...) at the start and at the end of a period and drop those next to the respective day.

another idea/questionmark that was popping up reading through the description was how about a possibility to express link-templates within journal templates which effectively would generate links into another journal's entries (e.g. dynamically generating and embedding a link into a newly created daily journal's entry to the surrounding weekly and/or monthly and/or quarterly journal given that such exists)?
the downside of this could be that for such a thing to work, the outermost journal (e.q. quarterly) hierarchy of a new period may have to be created first followed by the inner ones in the right order.
while i could imagine to easily manually edit a quarter's template, doing the same for e.g. a weekly or bi-weekly journal seems a bit tedious.

@benlubas
Copy link
Contributor Author

Glad you like it!

Unified toc

Yeah that would be useful. We could add a new function for it. Formatting it would be a challenge, months throw things off for sure.

We could easily do years + months + days or years + weeks (mostly work) + days.

Including months, if we want to be strict about days being correct, we could include a week that spans two separate months in both of those months, and list only the days of that week which are in the current month.

Something else to think about:

  • someone could make their own journal that reoccurs every 48 days, how do you nest that? Do we start repeating months now?

  • If someone makes a journal that repeats every 30 days, which one nests inside the other? Months or 30 days?

I think the answer to this question is to make the toc generation modular enough that users can decide how their custom journals fit in, and then default only include daily, monthly, yearly in the unified view.

Dynamic templates

There's a third party module, pysan3/neorg-templates, that allows for dynamic templates using luasnip. Highly recommend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants