Update of /cvsroot/refdb/refdb/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4047
Modified Files:
Tag: Release_0_9_5_stable
strfncs.c
Log Message:
sgml_entitize(): improved entity detection
Index: strfncs.c
===================================================================
RCS file: /cvsroot/refdb/refdb/src/strfncs.c,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -u -U2 -r1.15 -r1.15.2.1
--- strfncs.c 29 Apr 2004 00:08:08 -0000 1.15
+++ strfncs.c 6 May 2004 21:59:15 -0000 1.15.2.1
@@ -752,6 +752,17 @@
while (token != NULL) {
+ char* next_amp;
+ char* next_sc;
+ char* next_sp;
+
+/* printf("token went to:%s<<\n", token); */
/* replace ampersand only if it does not start an entity */
- if (the_ents[i].character != '&' || strchr(token, (int)';') == NULL) {
+ /* get pointers to the next ampersand and semicolon, if any,
+ and see which one is closer */
+ next_amp = strchr(token+1, (int)'&');
+ next_sc = strchr(token+1, (int)';');
+ next_sp = strchr(token+1, (int)' ');
+
+ if (the_ents[i].character != '&' || compare_ptr(&next_sc, &next_amp) != -1 || compare_ptr(&next_sp, &next_sc) != 1) {
replace_char_string(token, the_ents[i].entity);
}
|