1.1 --- a/bookloupe/bookloupe.c Sun May 26 21:33:49 2013 +0100
1.2 +++ b/bookloupe/bookloupe.c Sun May 26 21:39:07 2013 +0100
1.3 @@ -2302,6 +2302,44 @@
1.4 }
1.5
1.6 /*
1.7 + * check_for_html_entity:
1.8 + *
1.9 + * Check for &symbol; HTML.
1.10 + *
1.11 + * If there is a & in the line, followed at
1.12 + * some point by a ; then we suspect HTML.
1.13 + */
1.14 +void check_for_html_entity(const char *aline)
1.15 +{
1.16 + int i;
1.17 + const char *s,*amp,*scolon;
1.18 + amp=strstr(aline,"&");
1.19 + if (amp)
1.20 + {
1.21 + scolon=strstr(aline,";");
1.22 + if (scolon)
1.23 + {
1.24 + i=(int)(scolon-amp+1);
1.25 + for (s=amp;s<scolon;s++)
1.26 + if (*s==CHAR_SPACE)
1.27 + i=0; /* Don't report "Jones & Son;" */
1.28 + if (i>0)
1.29 + {
1.30 + strncpy(wrk,amp,i);
1.31 + wrk[i]=0;
1.32 + if (pswit[ECHO_SWITCH])
1.33 + printf("\n%s\n",aline);
1.34 + if (!pswit[OVERVIEW_SWITCH])
1.35 + printf(" Line %ld column %d - HTML symbol? %s \n",
1.36 + linecnt,(int)(amp-aline)+1,wrk);
1.37 + else
1.38 + cnt_html++;
1.39 + }
1.40 + }
1.41 + }
1.42 +}
1.43 +
1.44 +/*
1.45 * procfile:
1.46 *
1.47 * Process one file.
1.48 @@ -2550,30 +2588,7 @@
1.49 if (warnings->endquote)
1.50 check_for_unpunctuated_endquote(aline);
1.51 check_for_html_tag(aline);
1.52 - /*
1.53 - * Check for &symbol; HTML.
1.54 - * If there is a & in the line, followed at
1.55 - * some point by a ; then we suspect HTML.
1.56 - */
1.57 - if (strstr(aline,"&") && strstr(aline,";"))
1.58 - {
1.59 - i=(int)(strstr(aline,";")-strstr(aline,"&")+1);
1.60 - for (s=strstr(aline,"&");s<strstr(aline,";");s++)
1.61 - if (*s==CHAR_SPACE)
1.62 - i=0; /* Don't report "Jones & Son;" */
1.63 - if (i>0)
1.64 - {
1.65 - strncpy(wrk,strstr(aline,"&"),i);
1.66 - wrk[i]=0;
1.67 - if (pswit[ECHO_SWITCH])
1.68 - printf("\n%s\n",aline);
1.69 - if (!pswit[OVERVIEW_SWITCH])
1.70 - printf(" Line %ld column %d - HTML symbol? %s \n",
1.71 - linecnt,(int)(strstr(aline,"&")-aline)+1,wrk);
1.72 - else
1.73 - cnt_html++;
1.74 - }
1.75 - }
1.76 + check_for_html_entity(aline);
1.77 /*
1.78 * At end of paragraph, check for mismatched quotes.
1.79 * We don't want to report an error immediately, since it is a