On Friday, December 11, 2020 at 4:45:33 PM UTC-8 springer wrote:

> drag and drop the contents of a field-parsable string (onto a special 
> bibtex or json drop area if need be) and have tiddlywiki parse directly, 
> populating fields if field patterns are present?
>

Try this:
\define dropbibtex()
<$wikify name="source" text=<<actionTiddler>>>
<$set name="source" 
filter="[<source>removeprefix[@book{]removesuffix[}]split[,]rest[]join[,]]" 
select=0>
   <$list filter="[<source>split[}]first[]trim[]removeprefix[title={]]" 
variable="title">
      <$list filter="[<source>split[}]]" variable="item">
         <$vars f={{{ [<item>split[={]first[]trim[,]trim[]] }}} v={{{ 
[<item>split[={]rest[]trim[,]trim[]] }}}>
         <$action-setfield $tiddler=<<title>> $field=<<f>> $value=<<v>> />
         </$vars>
      </$list>
   </$list>
</$set>
</$wikify>
\end
<$droppable actions=<<dropbibtex>>>
<$button style="width:10em;height:10em;">drop bibtex here</$button>
</$droppable>

Notes:
* $wikify converts the dropped content into plain text, removing any 
surrounding HTML syntax
* $set removes the leading "@book{", trailing "}" and first value (e.g., 
"crary2016inside")
* first $list extracts the target tiddler title value from title="..."
* second $list extracts each named item (e.g., author={Crary, Alice)
* $vars gets the fieldname (everything before the "={") and fieldvalue 
(everything after the "={") from the item
* $action-setfield creates each field and value in the target tiddler

enjoy,
-e

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/ca5d4002-3ff8-429e-91e1-998d5ffe07aen%40googlegroups.com.

Reply via email to