Hi, so I might give you bad advice here cause I am newbie but, looking at a
.tid i have (nodejs install of tw) it looks like this:
created: 20150324100050929
> id: ab994720-5660-467a-bd78-1e2849694abb
> modified: 20150324101547319
> tags: [[programming concepts]]
> title: Hashmap
> type: text/vnd.tiddlywiki
>
>
> A hash table (hash map) is a data structure used to implement an
> associative array
>
>>
>>
And looking the 'hack' you linked to
> $tw.wiki.each(function(tiddler, title) {
> if (title.substr(-4) === ".txt") {
> $tw.wiki.addTiddler(new $tw.Tiddler(tiddler, {
> title: title.substr(0, title.length - 4),
> type: "text/vnd.tiddlywiki"
> }));
> $tw.wiki.deleteTiddler(title);
> }
> });
>
>
>
I think you could modify the hack to
$tw.wiki.each(function(tiddler, title) {
if (title.substr(-4) === ".htm") {
$tw.wiki.addTiddler(new $tw.Tiddler(tiddler, {
title: title.substr(0, title.length - 4),
type: "text/vnd.tiddlywiki",
tags: [[Your Tag]]
}));
$tw.wiki.deleteTiddler(title);
}
});
Note, I changed .txt to .htm since you said you're importing htm files.
And then all i did was add the extra property for the tag
Should be able to replace Your Tag with what you want
Back up your thing and give it a try & let me know :)
On Monday, March 30, 2015 at 12:22:18 PM UTC+1, Jon wrote:
>
> Hi,
>
> I'm importing a large number of .htm files and I'll convert the file type
> by adapting Jeremy's solution here:
> https://gist.github.com/Jermolene/1c1ff69c7afe91550057.
>
> Would it possible to adapt this code so that a tag is also added to all
> the files once imported?
>
> Or, perhaps after the .htm files have been imported, to then select with a
> filter and then apply a tag?
>
> Thanks
> Jon
>
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.