Hi Tierney,
when you drop a file onto the tiddlywiki it is handled here:
DropZoneWidget.prototype.handleDropEvent

In this function there is a call to
this.wiki.readFiles

That function looks at the file extension of the file that was drop and 
calls the deserialiser for that type of file. So in your deserialiser you 
would call the bibtex parser to do the conversion.

Once the deserialiser has run, the resultant tiddlers are imported. 

so you only need to write the deserialiser and register the file extension.


In my widget the text of the bibtex would need to be entered into the 
widget (I would add a text input to make it easer)


<$button> 
<$action-bibtex source="""@article{yesilada201526, title={112226 th ACM 
International Conference on Hypertext and Social Media}, author={Yesilada, 
Yeliz and Celik, Ilknur and Farzan, Rosta and Houben, Geert-Jan}, 
journal={ACM SIGWEB Newsletter}, number={Winter}, pages={1}, year={2015}, 
publisher={ACM} }"""/> 
convert me! 
</$button>


cheers

BJ




On Thursday, September 10, 2015 at 2:45:35 PM UTC+1, Tierney Coren wrote:
>
> Jeremy,
>
> So we've been able to drag and drop a bibfile into TW5, and it imports the 
> text contents into a tiddler via the import tool. Is there documentation or 
> a way I can hook into that and parse it to insert the contents into a new 
> tiddler? We're looking for the simplest possible way to do this.
>
> BJ,
>
> Is this what your interpreter does?
>
> Thanks,
> Tierney C.
>
> On Wednesday, September 9, 2015 at 4:00:52 AM UTC-4, Jeremy Ruston wrote:
>>
>> Hi BJ
>>
>> On Wed, Sep 9, 2015 at 8:23 AM, BJ <[email protected]> wrote:
>>
>>> I don't think that there is anyway to add a deserialiser as a plugin - 
>>> they are part of the boot, so you would need to convince Jeremy to accept a 
>>> pull request
>>>
>>
>> The current limitation is just that any deserialisers in plugins will not 
>> be available during the loading of the main wiki folder under Node.js. It's 
>> possible to have a deserialiser in a plugin that is available for 
>> interactive imports.
>>  
>>
>>> Also you would need to define the mime-type.
>>>
>>
>> That's correct, thanks for picking it up,
>>
>> Best wishes
>>
>> Jeremy.
>>
>>  
>>
>>>
>>>
>>> On Wednesday, September 9, 2015 at 12:13:15 AM UTC+1, Tierney Coren 
>>> wrote:
>>>>
>>>> How hard is it to create one? They don't look too complicated - is 
>>>> there any documentation on writing a deserialiser? 
>>>>
>>>> On Tue, Sep 8, 2015 at 12:58 PM, Jeremy Ruston <[email protected]> 
>>>> wrote:
>>>>
>>>>> On Tue, Sep 8, 2015 at 1:46 PM, BJ <[email protected]> wrote:
>>>>>
>>>>>> I think Felix's idea of importing is good, but i would suggest you to 
>>>>>> write an upgrader module - these are run when stuff is imported.
>>>>>>
>>>>>
>>>>> Better still would be to add a deserialiser. Deserialisers are invoked 
>>>>> to extract tiddlers from files identified by their extension and/or MIME 
>>>>> type. Here are the built-in deserialisers:
>>>>>
>>>>>
>>>>> https://github.com/Jermolene/TiddlyWiki5/blob/master/boot/boot.js#L1211-L1281
>>>>>
>>>>> https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/deserializers.js
>>>>>
>>>>> Best wishes
>>>>>
>>>>> Jeremy.
>>>>>
>>>>>  
>>>>>
>>>>>> all the best
>>>>>>
>>>>>> BJ
>>>>>>
>>>>>> On Tuesday, September 8, 2015 at 12:13:09 AM UTC+1, Tierney Coren 
>>>>>> wrote:
>>>>>>>
>>>>>>> This looks like it might be good, if converting to JSON is the right 
>>>>>>> way to handle it: https://www.npmjs.com/package/bib2json
>>>>>>>
>>>>>>> On Monday, September 7, 2015 at 7:11:16 PM UTC-4, Tierney Coren 
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Hello!
>>>>>>>>
>>>>>>>> I've taken on some work using tiddlywiki. One of the components of 
>>>>>>>> it is to convert BibTeX documents into tiddlers. 
>>>>>>>>
>>>>>>>> I'm thinking I can do this via a npm module, but I'd like to know 
>>>>>>>> if there's a more simple way to do the conversion in TW5, without 
>>>>>>>> relying 
>>>>>>>> on an external source (Node). I'm not afraid of using Node in any 
>>>>>>>> capacity, 
>>>>>>>> so if there are modules I could build upon, I'd love to hear about 
>>>>>>>> them.
>>>>>>>>
>>>>>>>> In regards to the actual conversion, would converting it to JSON be 
>>>>>>>> enough to import the BibTeX as tiddlers with tags, names, and content?
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Tierney C.
>>>>>>>>
>>>>>>> -- 
>>>>>> 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.
>>>>>> To view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/tiddlywiki/bdc71fc8-5eb9-4505-8107-3be70ca071dc%40googlegroups.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/tiddlywiki/bdc71fc8-5eb9-4505-8107-3be70ca071dc%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> Jeremy Ruston
>>>>> mailto:[email protected]
>>>>>
>>>>> -- 
>>>>> You received this message because you are subscribed to a topic in the 
>>>>> Google Groups "TiddlyWiki" group.
>>>>> To unsubscribe from this topic, visit 
>>>>> https://groups.google.com/d/topic/tiddlywiki/kIbDTiXZqJk/unsubscribe.
>>>>> To unsubscribe from this group and all its topics, 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.
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/tiddlywiki/CAPKKYJZ7VhXN_K7SVyfkxX-L%3DfKyVBGjcJ4Wtsagp%3DWHA6-1cg%40mail.gmail.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/tiddlywiki/CAPKKYJZ7VhXN_K7SVyfkxX-L%3DfKyVBGjcJ4Wtsagp%3DWHA6-1cg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>> -- 
>>> 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.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/tiddlywiki/cb76f480-5a12-4841-b40c-a8e5c50b54ec%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/tiddlywiki/cb76f480-5a12-4841-b40c-a8e5c50b54ec%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> Jeremy Ruston
>> mailto:[email protected]
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/156dd86a-efe8-43fa-aa8f-1fb943cad840%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to