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
Add 'filepath' source attribute to tiddlywiki.files #7253
Conversation
Adds a new source attribute to facilitate importing subdirectories with the `searchSubdirectories` attribute. The `filepath` atttribute is like `filename` except it includes the full pathname relative to the directory path. Consequently it only works with `directories` sections (not `tiddlers`).
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Side note: for my use case, I also wanted to customize tags on imported files based on the pathname (eg, files in |
Thanks for your patience @michsa, and welcome to the project. This looks good to me – just one small thing, please could you prepare a separate PR to the 'tiddlywiki-com' branch with your signature for the Contributor License Agreement (see contributing.md). Many thanks |
How would the JSON config look like with these changes added? |
[deleted my previous comment for being incorrect]
Hi @pmario there's an example of using the new
|
Sorry for the delay! @Jermolene I've signed the CLA here: #7342
@pmario you would use the source attribute
this sets the field to an array of subdirectories between the root ( The implementation is really simple - it's just another case in the |
Thank you @michsa – and apologies for not recognising your name in your CLA signature. |
Sorry, but that's not enough context. Please insert the info from your reply, into your JSON below. .. The JSON is several levels deep. So the info on which level the config has to be is essential. .. Also for the user docs
|
@michsa we're now in the freeze for the release of v5.2.6 (see #7279 for details of the roadmap), and so we won't be able to merge this until afterwards. I've added this PR to the list at #7345. Don't worry about the reference to v5.2.6 in this PR, I'll correct that when we merge it. @pmario I think that the docs that @michsa has produced are inline with the existing docs. I don't disagree that more examples would be helpful, but that isn't really in the scope of this PR that is just adding one more property. |
Adds another new source attribute to facilitate importing subdirectories with the `searchSubdirectories` attribute. The `subdirectories` source attribute is only usable with `directories` sections (not `tiddlers`). It resolves to an array containing all the directories in the file's path relative to the directory path. Eg, if the directory path is `files`, `{ source: 'subdirectories' }` for a file in `files/images/photos` would resolve to `['images', 'photos']. This commit also adds an example to the "tiddlywiki.files Files" documentation tiddler that demonstrates using the `filepath` and `subdirectories` source attributes to import and auto-tag image files as external-image tiddlers.
@pmario is right, it'd be silly not to have an example in the docs. I added one along with the |
Great thanks @michsa much appreciated. |
Thanks for your patience @michsa |
Oooooh, great addition. Thanks @michsa !!! |
Adds a new source attribute to facilitate importing subdirectories with the
searchSubdirectories
attribute.The
filepath
atttribute is likefilename
except it includes the full pathname relative to the directory path. Consequently it only works withdirectories
sections (nottiddlers
) intiddlywiki.files
.Here's an example
tiddlywiki.files
that uses this attribute to import all image files within thefiles
directory and its subfolders as _canonical_uri tiddlers: