Angus Leeming wrote:
> Georg Baum wrote:
>> from the external inset. sanitizeLatexOption() was called with the input
>> "[,,,]". The last regex was then called with "]", and this lead to the
>> warning message. A possible fix is attached. It does also fix the first
>> warning message in sanitizeLatexOption(). Is it ok, or am I fixing
>> symptoms here?
>
> The real problem being that the regex is insufficient for the use case?
Yes. Misunderstanding on my side: what[0] is the whole match, and not the
first submatch. I altered the last regex (see attached patch, which goes in
right now).
Georg
Index: src/insets/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v
retrieving revision 1.1058
diff -u -p -r1.1058 ChangeLog
--- src/insets/ChangeLog 26 Oct 2004 18:39:12 -0000 1.1058
+++ src/insets/ChangeLog 27 Oct 2004 08:40:29 -0000
@@ -1,3 +1,8 @@
+2004-10-27 Georg Baum <[EMAIL PROTECTED]>
+
+ * ExternalTransforms.C (sanitizeLatexOption): fix regex to handle
+ "[,,,]" without warning message
+
2004-10-26 Angus Leeming <[EMAIL PROTECTED]>
* ExternalSupport.C (updateExternal):
@@ -76,7 +81,7 @@
2004-09-24 Andreas Vox <[EMAIL PROTECTED]>
* insetref.C (docbook): fixing problem where Docbook XML output
- had unclosed <xref ... >
+ had unclosed <xref ... >
2004-08-16 José Matos <[EMAIL PROTECTED]>
Index: src/insets/ExternalTransforms.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ExternalTransforms.C,v
retrieving revision 1.7
diff -u -p -r1.7 ExternalTransforms.C
--- src/insets/ExternalTransforms.C 5 Oct 2004 10:11:41 -0000 1.7
+++ src/insets/ExternalTransforms.C 27 Oct 2004 08:40:29 -0000
@@ -273,7 +273,7 @@ string const sanitizeLatexOption(string
string::const_iterator it = begin;
// Strip any leading commas
- // "[,,,,foo..." -> "foo..."
+ // "[,,,,foo..." -> "foo..." ("foo..." may be empty)
string output;
boost::smatch what;
static boost::regex const front("^( *[[],*)(.*)$");
@@ -281,7 +281,7 @@ string const sanitizeLatexOption(string
regex_match(it, end, what, front, boost::match_partial);
if (!what[0].matched) {
lyxerr << "Unable to sanitize LaTeX \"Option\": "
- << output << '\n';
+ << input << '\n';
return string();
}
it = what[1].second;
@@ -301,8 +301,8 @@ string const sanitizeLatexOption(string
}
// Strip any trailing commas
- // "...foo,,,]" -> "...foo"
- static boost::regex const back("^(.*[^,])(,*[]] *)$");
+ // "...foo,,,]" -> "...foo" ("...foo,,," may be empty)
+ static boost::regex const back("^(.*[^,])?(,*)([]] *)$");
regex_match(output, what, back);
if (!what[0].matched) {
lyxerr << "Unable to sanitize LaTeX \"Option\": "