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

Added Dynamic Folders + Compatibility with Temlater #42

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ggstrader
Copy link

If Templater is detected, you can associate a template file with a rule so that it is run automatically when the file is moved.

Due to some kind of caching problem, the template is executed before the file is renamed, otherwise templater complains that the file doesn't exist. I would think that awaiting the rename call would mean the rename is complete, but apparantly not.

How to use:

  • Install Templater from community plugins
  • go to the settings tab
  • there is now a fourth suggester, select a template file
  • create any file and trigger a move
  • you should see the template appended to the file

@ggstrader
Copy link
Author

Note: I also updated the package config since npm detected vulnerabilities

@ggstrader
Copy link
Author

closes #37

@ggstrader
Copy link
Author

ggstrader commented Jan 25, 2023

Example for "Dynamic Folders" (capture group):

Folder = Subjects$1, Tag = #subjects(/[^/]*/?)?

This regex places anything with the "subjects" tag in the "Subjects" folder, and any nested tags in the first nested folder.

Tag Folder
#subjects Subjects
#subjects/literature Subjects/literature
#subjects/literature/french Subjects/literature
#subjects/physics Subjects/physics

@ggstrader ggstrader changed the title Added compatibility with Temlater Added Dynamic Folders + Compatibility with Temlater Jan 25, 2023
@evanhammer
Copy link

❤️

Copy link

@timothyjlaurent timothyjlaurent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@leelhn2345
Copy link

hi, is there anyway i can use this PR's version for my vault??

@ggstrader
Copy link
Author

hi, is there anyway i can use this PR's version for my vault??

Option 1 - Use BRAT

Install BRAT from community plugins and add https://github.com/ggstrader/obsidian-auto-note-mover. This is probably the easiest option

Option 2 - Clone and Build

You'll need to install Git, and NodeJS

Then open a terminal in your vault's .obsidian/plugins directory and git clone https://github.com/farux/obsidian-auto-note-mover.git. This command just copies this repository, you can also download a zip of the repo on the main page to avoid using Git. When it's downloaded, open a terminal in that directory and run npm i followed by npm run dev. This produces the main.js.

@ManikandanUV
Copy link

@ggstrader Thanks for this PR. Is it possible to make more nested folders instead of placing everything in the first nested folder? My structure is work/active-projects/sentiment-analysis, work/active-projects/world-domination, work/inactiv-projects/altruism, etc. Only creating the first nested folder still keeps my notes messy.

@ggstrader
Copy link
Author

@ggstrader Thanks for this PR. Is it possible to make more nested folders instead of placing everything in the first nested folder? My structure is work/active-projects/sentiment-analysis, work/active-projects/world-domination, work/inactiv-projects/altruism, etc. Only creating the first nested folder still keeps my notes messy.

It can do anything regex can do, so yes. I recommend looking up some info on regex. regex101.com is a great resource for learning and constructing regex.

@ManikandanUV
Copy link

It can do anything regex can do, so yes. I recommend looking up some info on regex. regex101.com is a great resource for learning and constructing regex.

That worked, thanks! For anybody who would need this, here is what I set to create as many nested folders as needed

Tag = #subjects(/.*)

Folder = subjects$1

@ManikandanUV
Copy link

@ggstrader Could you kindly pull the PR from jeffbeaulieu:move-all-notes-command into your repo and publish a release? I tried forking both your repos and published a release, but looks like I need to build them with npm, and I'm getting some build errors.

utils/Utils.ts:39:13 - error TS2339: Property 'plugins' does not exist on type 'App'.

I'm a python developer, and know zilch about node, so it would be great if you could pull these changes into yours. I have tons of notes that I want processed.

brosell added a commit to brosell/obsidian-auto-note-organizer that referenced this pull request Oct 25, 2023
Condition expressions like tag[myTag]&has[project]&project[myProj] - uses https://www.npmjs.com/package/logical-expression-parser

debounce rule checks and optionally create destination folder if no exist. Borrowed from farux/obsidian-auto-note-mover#42
@ggstrader
Copy link
Author

@ManikandanUV it looks like @brossell (above) has forked this repo and is actively maintaining it, so maybe it's best to request there.

@connradolisboa
Copy link

@ManikandanUV it looks like @brossell (above) has forked this repo and is actively maintaining it, so maybe it's best to request there.

Do you know how I can use that fork repo? I don't understand how I can use title regex for moving or using the name of the children tag for specifying the path of the moved note.

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.

6 participants