Re: [PATCH] Re: biblio.C: another parsing bug

2002-04-16 Thread Angus Leeming

Patch applied, Herbert.
Angus



Re: [PATCH] Re: biblio.C: another parsing bug

2002-04-15 Thread Jürgen Spitzmüller

Herbert Voss wrote:
> why do you write the accents and umlauts in texmode?

This is Pybliographer's work.

Juergen



[PATCH] Re: biblio.C: another parsing bug

2002-04-15 Thread Herbert Voss

Juergen Spitzmueller wrote:

> The following entry is parsed wrong in the citation dialog (as "Reichardt, 
> Rolf, {" and nothing more), This happens to all my entries where I use two 
> commas as opening quotation marks (I use this in pybliographer, because it's 
> the only way to insert german opening quotation marks without fiddling in 
> advanced editing mode). I guess biblio.C misinterprets the comma as an entry 
> separator.
> 
> @Article{Reichardt78,
>   Author = {Reichardt, Rolf},
>   Title  = {,,{H}istoire des {M}entalit\'es{}``. {E}ine neue
>{D}imension der {S}ozialgeschichte am {B}eispiel des
>{A}ncien {R}\'egime},
>   Journal= {Internationales Archiv f\"ur Sozialgeschichte der
>Literatur},
>   Volume = {3},
>   Pages  = {130-166},
>   Schlagwort = {Mentalit\"at; Geschichte},
>   year   = 1978,
> }


why do you write the accents and umlauts in texmode?

Herbert





-- 
http://www.lyx.org/help/


Index: src/frontends/controllers/ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ChangeLog,v
retrieving revision 1.160
diff -u -r1.160 ChangeLog
--- src/frontends/controllers/ChangeLog 15 Apr 2002 12:05:06 -  1.160
+++ src/frontends/controllers/ChangeLog 15 Apr 2002 16:31:02 -
@@ -1,3 +1,8 @@
+2002-04-15  Herbert Voss  <[EMAIL PROTECTED]>
+
+   * biblio.[Ch] (parseBibTeX): fix bug while scanning bibtexentries
+   with something like ,,...blah...`` (two commas)
+
 2002-04-14  Herbert Voss  <[EMAIL PROTECTED]>
 
* helper_funcs.[Ch]: move the getVectorFromString and the vice versa
Index: src/frontends/controllers/biblio.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/biblio.C,v
retrieving revision 1.22
diff -u -r1.22 biblio.C
--- src/frontends/controllers/biblio.C  15 Apr 2002 12:05:07 -  1.22
+++ src/frontends/controllers/biblio.C  15 Apr 2002 16:31:02 -
@@ -355,8 +355,8 @@
}
dummy = token(data, '\n', ++Entries);
}
-   data = data_;
-
+   // replace double commas with "" for easy scanning
+   data = subst(data_, ",,", "\"\"");
// unlikely!
if (data.empty())
return string();
@@ -367,10 +367,11 @@
  // because the last one is "blah ... }"
Entries = 0;
dummy = token(data, ',', Entries);
-   while (!contains(lowercase(dummy), findkey) && !dummy.empty())
+   while (!contains(lowercase(dummy), findkey) && !dummy.empty()) 
dummy = token(data, ',', ++Entries);
if (dummy.empty())
return string();// no such keyword
+
// we are not sure, if we get all, because "key= "blah, blah" is allowed.
// therefore we read all until the next "=" character, which follows a
// new keyword
@@ -380,10 +381,11 @@
keyvalue += (',' + dummy);
dummy = token(data, ',', ++Entries);
}
-   data = keyvalue;// now we have the important line
+   // replace double "" with originals ,, (two commas)
+   data = subst(keyvalue, "\"\"", ",,");   // now we have the important line
data = strip(data, ' ');// all spaces
-   if (!contains(data, '{'))   // no opening '{'
-   data = strip(data, '}');// maybe there is a main closing '}'
+   if (!contains(data, '{'))   // no opening '{'
+   data = strip(data, '}');// a main closing '}'
// happens, when last keyword
string::size_type const idx =
!data.empty() ? data.find('=') : string::npos;



biblio.C: another parsing bug

2002-04-15 Thread Juergen Spitzmueller

Herbert,

The following entry is parsed wrong in the citation dialog (as "Reichardt, 
Rolf, {" and nothing more), This happens to all my entries where I use two 
commas as opening quotation marks (I use this in pybliographer, because it's 
the only way to insert german opening quotation marks without fiddling in 
advanced editing mode). I guess biblio.C misinterprets the comma as an entry 
separator.

Juergen.

@Article{Reichardt78,
  Author = {Reichardt, Rolf},
  Title  = {,,{H}istoire des {M}entalit\'es{}``. {E}ine neue
   {D}imension der {S}ozialgeschichte am {B}eispiel des
   {A}ncien {R}\'egime},
  Journal= {Internationales Archiv f\"ur Sozialgeschichte der
   Literatur},
  Volume = {3},
  Pages  = {130-166},
  Schlagwort = {Mentalit\"at; Geschichte},
  year   = 1978,
}