https://forum.world.st/Citizen-example-for-manipulating-a-bibtex-file-tp4784240p4786028.html
Thanks again. I have a small script, using Citezen which does the trick.
detect: [:each | each basename endsWith: 'bib' ]).
bibliography := CZBibParser parse: bibFile contents.
bibStream := '' writeStream.
key: ((bibliography entries at: index) fields at: 2) value].
bibOutputer := CZBibtexOutputer new.
(bibliography entries at: index)); cr.].
bibliography.
stream nextPutAll: bibStream contents withUnixLineEndings ].
bibStream contents.
I will put some functionality inspired by this on my prototype this weekend.
> Check in the tools there is a bib writer.
>
> Stef
>
> On 21/10/14 03:33, Offray Vladimir Luna Cárdenas wrote:
>> Thanks Stef and Damien,
>>
>> I have this small script as a proof of concept:
>>
>> ===================================
>> | bibFile bibliography |
>> bibFile := ((FileLocator documents / 'U/Libertadores/Grafoscopio')
>> children
>> detect: [:each | each basename endsWith: 'bib' ]) contents.
>> bibliography := CZBibParser parse: bibFile.
>> 1 to: (bibliography size) do: [:index |
>> (((bibliography entries at: index) fields at: 2) key = 'shorttitle')
>> ifTrue: [
>> (bibliography entries at: index)
>> key: ((bibliography entries at: index) fields at: 2) value
>> ]].
>> bibliography.
>> ===================================
>>
>> Now I want to write back the corrected file to the .bib ... just
>> having problems finding which message does the job. I'll keep searching.
>>
>> Cheers,
>>
>> Offray
>>
>> On 10/16/2014 06:40 AM, Damien Cassou wrote:
>>> from Damien Pollet:
>>>
>>> You will need to load the .bib file from zotero (read the file however
>>> you like, then pass the stream to the CZ parser). You'll get a
>>> CZBibSet (I don't recall the name exactly) which represents the
>>> contents of the file. A Set is composed of entries, each of which has
>>> a key and a set of fields. Finally, fields accept a few different
>>> kinds of values.
>>>
>>> Your processing is just iterating a set then setting the key of each
>>> entry (or possibly removing and re-adding the entry, I don't recall if
>>> it's implemented like a dictionary or more like a list).
>>>
>>>
>>> On Mon, Oct 13, 2014 at 2:57 AM, Offray Vladimir Luna Cárdenas
>>> <
[hidden email] <mailto:
[hidden email]>> wrote:
>>>
>>> Hi,
>>>
>>> I'm using a Zotero collection for keeping track of several
>>> references I have
>>> found for my article about the experience of the
>>> outline/tree-like metaphor
>>> for writing inside Pharo (as soon as I have a presentable
>>> working draft I
>>> hope to share it with you).
>>>
>>> Now I want to make a post-processing of the bibtex file exported
>>> from
>>> Zotero. The idea is to use "shorttitle" field instead to replace
>>> the Zotero
>>> auto-generated one and have custom keys. So for example instead of:
>>>
>>> =======
>>> @misc{_holistic_????,
>>> title = {Holistic software assessment (Uni Zurich -
>>> 2011) on Vimeo},
>>> shorttitle = {Girba-holistic-2011},
>>> url = {
http://vimeo.com/42073344?__from=outro-local>>> <
http://vimeo.com/42073344?from=outro-local>},
>>> urldate = {2014-08-19},
>>> note = {00000}
>>> }
>>>
>>> =======
>>>
>>>
>>> I would like to have:
>>>
>>>
>>> =======
>>>
>>> @misc{Girba-holistic-2011,
>>> title = {Holistic software assessment (Uni Zurich -
>>> 2011) on Vimeo},
>>> shorttitle = {Girba-holistic-2011},
>>> url = {
http://vimeo.com/42073344?__from=outro-local>>> <
http://vimeo.com/42073344?from=outro-local>},
>>> urldate = {2014-08-19},
>>> note = {00000}
>>> }
>>>
>>> =======
>>>
>>>
>>> I have already installed Citizen and open it on the browser to
>>> see the code,
>>> but I can find any place to start with examples.
>>>
>>> Any advice on how to solve this issue will be appreciated.
>>>
>>> Cheers,
>>>
>>> Offray
>>>
>>>
>>>
>>>
>>> --
>>> Damien Cassou
>>>
http://damiencassou.seasidehosting.st>>>
>>> "Success is the ability to go from one failure to another without losing
>>> enthusiasm."
>>> Winston Churchill
>>>
>>
>>
>>
>
>
>