<a name="L2"></a><tt class="py-lineno"> 2</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># This file is part of pybliographer</tt> </tt>
<a name="L7"></a><tt class="py-lineno"> 7</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># This program is free software; you can redistribute it and/or</tt> </tt>
<a name="L8"></a><tt class="py-lineno"> 8</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># modify it under the terms of the GNU General Public License</tt> </tt>
<a name="L9"></a><tt class="py-lineno"> 9</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># as published by the Free Software Foundation; either version 2 </tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># of the License, or (at your option) any later version.</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># This program is distributed in the hope that it will be useful,</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># but WITHOUT ANY WARRANTY; without even the implied warranty of</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># GNU General Public License for more details. </tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># You should have received a copy of the GNU General Public License</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># along with this program; if not, write to the Free Software</tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt> <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</tt> </tt>
</div><div id="Reader-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Reader-expanded"><a name="L71"></a><tt class="py-lineno"> 71</tt> <tt class="py-line"> <tt class="py-comment"># The official channel in which messages must be sent</tt> </tt>
</div><div id="Reader.person_add-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Reader.person_add-expanded"><a name="L106"></a><tt class="py-lineno">106</tt> <tt class="py-line"> <tt class="py-docstring">''' Parse a stream of tokens as a series of person names '''</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt> <tt class="py-line"> <tt class="py-comment"># The first level of the parsing is of interest, as non-person</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># names can be written for instance:</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># author = "{Name of a Company} and {Another One}"</tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt> <tt class="py-line"> <tt class="py-comment"># ...and expand the low-level text in fragment split on "," "." and space</tt> </tt>
<a name="L135"></a><tt class="py-lineno">135</tt> <tt class="py-line"> <tt class="py-comment"># These high-level groups are separated by 'and' keywords</tt> </tt>
<a name="L155"></a><tt class="py-lineno">155</tt> <tt class="py-line"> <tt class="py-comment"># Ensure the stream is a sequence of complete words (ie,</tt> </tt>
<a name="L156"></a><tt class="py-lineno">156</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># concatenate successive text parts and space parts). The</tt> </tt>
<a name="L157"></a><tt class="py-lineno">157</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># comma must remain on its own, as it serves as a separator.</tt> </tt>
<a name="L158"></a><tt class="py-lineno">158</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># The dot is always appended to the previous word.</tt> </tt>
<a name="L192"></a><tt class="py-lineno">192</tt> <tt class="py-line"> <tt class="py-docstring">""" For each element of the string, return a list that</tt> </tt>
<a name="L193"></a><tt class="py-lineno">193</tt> <tt class="py-line"><tt class="py-docstring"> indicates if the corresponding element is :</tt> </tt>
<a name="L194"></a><tt class="py-lineno">194</tt> <tt class="py-line"><tt class="py-docstring"> - I : an initial</tt> </tt>
<a name="L195"></a><tt class="py-lineno">195</tt> <tt class="py-line"><tt class="py-docstring"> - L : a lower case word</tt> </tt>
<a name="L196"></a><tt class="py-lineno">196</tt> <tt class="py-line"><tt class="py-docstring"> - N : a name</tt> </tt>
<a name="L257"></a><tt class="py-lineno">257</tt> <tt class="py-line"> <tt class="py-comment"># As a fallback, consider that the last name is the last component</tt> </tt>
<a name="L263"></a><tt class="py-lineno">263</tt> <tt class="py-line"> <tt class="py-comment"># Handle the case of a final . after the author's name</tt> </tt>
</div><div id="Reader.preamble_add-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Reader.preamble_add-expanded"><a name="L298"></a><tt class="py-lineno">298</tt> <tt class="py-line"> <tt class="py-comment"># by default, we drop the preamble</tt> </tt>
</div><div id="Reader.type_add-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Reader.type_add-expanded"><a name="L302"></a><tt class="py-lineno">302</tt> <tt class="py-line"> <tt class="py-comment"># by default, we drop the document type informatio</tt> </tt>
<a name="L350"></a><tt class="py-lineno">350</tt> <tt class="py-line"> <tt class="py-comment"># Add the document type at the end, as it might have been</tt> </tt>
<a name="L392"></a><tt class="py-lineno">392</tt> <tt class="py-line"> <tt class="py-comment"># The official channel in which messages must be sent</tt> </tt>
<a name="L420"></a><tt class="py-lineno">420</tt> <tt class="py-line"> <tt class="py-comment"># Use the 'C' name by default, as it is easier to parse</tt> </tt>
<a name="L436"></a><tt class="py-lineno">436</tt> <tt class="py-line"> <tt class="py-comment"># by default, new lines and multiple spaces are not significant in bibtex fields</tt> </tt>
<a name="L444"></a><tt class="py-lineno">444</tt> <tt class="py-line"> <tt class="py-comment"># by default, new lines and multiple spaces are not significant in bibtex fields</tt> </tt>
<a name="L447"></a><tt class="py-lineno">447</tt> <tt class="py-line"> <tt class="py-comment"># If the text contains capitals that are not at the beginning</tt> </tt>
<a name="L448"></a><tt class="py-lineno">448</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># of a sentence, protect these capitals. Similarly for</tt> </tt>
<a name="L449"></a><tt class="py-lineno">449</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># lowercase letters at the beginning.</tt> </tt>
<a name="L575"></a><tt class="py-lineno">575</tt> <tt class="py-line"> <tt class="py-docstring">""" Write a result set to a given file descriptor """</tt> </tt>
<a name="L604"></a><tt class="py-lineno">604</tt> <tt class="py-line"> <tt class="py-comment"># Fully support the (bad) case where there is no key in</tt> </tt>
<a name="L605"></a><tt class="py-lineno">605</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># the record, in order to support bad behaved applications</tt> </tt>
<a name="L606"></a><tt class="py-lineno">606</tt> <tt class="py-line"><tt class="py-comment"></tt> <tt class="py-comment"># that use it.</tt> </tt>