[referencer] A question about document types and document.get_field()

Christopher Belanger chris.belanger at utoronto.ca
Wed Dec 21 15:15:17 EST 2011


On 11-12-21 02:49 PM, Mads Chr. Olesen wrote:
> ons, 21 12 2011 kl. 14:40 -0500, skrev Christopher Belanger:
>> I've made an (extremely simple!) modification to the source that
>> causes
>> doc.get_field to act as the documentation says it should, which in
>> turn
>> allows my plugin to run.  Is there a way for me to submit the patch
>> generated by mercurial for consideration?  The change is trivial, but
>> as
>> a non-programmer, submitting a patch to an open-source project would
>> be
>> exciting.
> If you mail me your modified file I will integrate it. We are moving
> Referencer development onto launchpad [1], and we should really do a new
> release soon...
>
Please find attached my suggested changes!  The first is quite small,
just causing doc.get_field("thefield") to return NULL if "thefield" is
not a defined field.  This is in accordance with the Referencer
documentation.

>> After looking more closely at PythonDocument.C, I see that there is no
>> command available to the plugin to determine the document type.  This
>> is too bad, because it would make citation formatting a snap. 
> I have an email somewhere, from someone else, who also had problems with
> the type of documents from a plugin (setting the type IIRC), so maybe it
> needs to be made easier to deal with.
>
The second change I've proposed is the addition of a doc.get_type()
function, which simply returns the document type from within a plugin. 
I can think of many reasons why this could be useful in a plugin, and no
reasons it could be harmful; setting document types from within a
plugin, on the other hand, seems like it could be iffy.

Everything compiles perfectly on my end, and the plugin-in-progess runs
without exceptions on my library of 349 documents (with metadata of
wildly varying quality).

This change will allow me to complete my plugin, which would help make
Referencer more appealing and useful for people who need to export
citation lists in plaintext--in other words, everyone who doesn't use LaTeX!

Thanks for your patience, and I will look at the launchpad page.  I've
never contributed to this kind of project before, so apologies if I'm
being presumptuous or doing things not quite right.

Best,
 - Chris
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch
URL: <http://icculus.org/pipermail/referencer/attachments/20111221/62625ab4/attachment.diff>


More information about the referencer mailing list