Auto tags in bibtex parser

Dear All,

I have a question regarding the BibTeX parser. In my bib file, I also have a field called “keyword” with comma-separated names. I want to use them as tags while dragging and importing BibTeX files to TW.
I was wondering what changes are required and how to apply them.
I know only these two toddlers where changes should be made. Let me know if this is the correct direction
$:/plugins/tiddlywiki/bibtex/deserializer.js

I really appreciate any help you can provide.
Rahul

Hi @rkashyap the BibTeX plugin is pretty crude at the moment, but I know it’s important to people, and I’d be pleased to see it getting more attention.

Do the entries from your “keyword” field get transferred to a tiddler field called “bibtex-keyword”? If so, the easiest approach might be to use wikitext to massage the values in that field into the tags field.

Assuming the entries you import end up with bibtex-keyword field containing comma separated values such as Apple,Orange,Pear, then you should be able to use a button like this to fix up a particular tiddler:

<$button>
<$action-listops $tiddler=<<currentTiddler>> $field="tags" $subfilter={{{ [<currentTiddler>get[bibtex-keyword]split[,]trim[]] +[join[ ]] }}}/>
Copy tags from bibtex-keyword field
</$button>

You can put the button in a tiddler tagged “$:/tags/ViewTemplate” and it will appear on every tiddler so that you can handle each tiddler individually.

To make a button that performs the same operation for all tiddlers that have an bibtex-keyword field:

<$button>
<$list filter="[has[bibtex-keyword]]">
<$action-listops $tiddler=<<currentTiddler>> $field="tags" $subfilter={{{ [<currentTiddler>get[bibtex-keyword]split[,]trim[]] +[join[ ]] }}}/>
</$list>
Copy tags from bibtex-keyword field
</$button>
1 Like

Thanks a lot for your reply. It worked like a charm.

It’d have been better if it happened during import to keep consistent data over importing older tiddlers.
If you could give a brief outline of the plugin code, I can try sometime to implement and share it.