AWPモードの改行を<br>タグに変換しない処理で、preタグ内に加えて、tableタグ内でかつ<th><td><caption>内でない場合も<br>タグの付与を行わない。
@@ -361,14 +361,20 @@ | ||
361 | 361 | if ( awpescape ) { |
362 | 362 | txt.clear(); |
363 | 363 | int precnt = 0; |
364 | + int tablecnt = 0; | |
365 | + int thtdcnt = 0; | |
364 | 366 | for ( string::iterator i = out.begin(); i < out.end(); i++ ) { |
365 | - if ( revcmp( txt, "<pre>", 5) ) { precnt++; } | |
366 | - if ( revcmp( txt, "<PRE>", 5) ) { precnt++; } | |
367 | - if ( revcmp( txt, "<Pre>", 5) ) { precnt++; } | |
368 | - if ( revcmp( txt, "</pre>", 6) ) { precnt--; } | |
369 | - if ( revcmp( txt, "</PRE>", 6) ) { precnt--; } | |
370 | - if ( revcmp( txt, "</Pre>", 6) ) { precnt--; } | |
371 | - if ( precnt == 0 ) { | |
367 | + if ( revcmp3( txt, "<pre>" , "<Pre>" , "<PRE>" , 5) ) { precnt++; } | |
368 | + if ( revcmp3( txt, "</pre>", "</Pre>", "</PRE>", 6) ) { precnt--; } | |
369 | + if ( revcmp3( txt, "<table>" , "<Table>" , "<TABLE>" , 7) ) { tablecnt++; } | |
370 | + if ( revcmp3( txt, "</table>", "</Table>", "</TABLE>", 8) ) { tablecnt--; } | |
371 | + if ( revcmp3( txt, "<th>" , "<Th>" , "<TH>" , 4) ) { thtdcnt++; } | |
372 | + if ( revcmp3( txt, "</th>", "</Th>", "</TH>", 5) ) { thtdcnt--; } | |
373 | + if ( revcmp3( txt, "<td>" , "<Td>" , "<TD>" , 4) ) { thtdcnt++; } | |
374 | + if ( revcmp3( txt, "</td>", "</Td>", "</TD>", 5) ) { thtdcnt--; } | |
375 | + if ( revcmp3( txt, "<caption>" , "<Caption>" , "<CAPTION>" , 9) ) { thtdcnt++; } | |
376 | + if ( revcmp3( txt, "</caption>", "</Caption>", "</CAPTION>", 10) ) { thtdcnt--; } | |
377 | + if ( precnt == 0 && tablecnt <= thtdcnt ) { | |
372 | 378 | if ( *i == '\r' ) { |
373 | 379 | txt += "<br>"; |
374 | 380 | if ( i + 1 < out.end() && *(i+1) == '\n' ) { |
@@ -99,6 +99,13 @@ | ||
99 | 99 | return strcmp( src.c_str() + src.size() - len, dst) == 0; |
100 | 100 | } |
101 | 101 | |
102 | +inline bool revcmp3( string &src, char *dst1, char *dst2, char *dst3, size_t len) | |
103 | +{ | |
104 | + if ( src.size() < len ) return false; | |
105 | + if ( strcmp( src.c_str() + src.size() - len, dst1) == 0 ) return true; | |
106 | + if ( strcmp( src.c_str() + src.size() - len, dst2) == 0 ) return true; | |
107 | + if ( strcmp( src.c_str() + src.size() - len, dst3) == 0 ) return true; | |
108 | + return false; | |
109 | +} | |
102 | 110 | |
103 | - | |
104 | 111 | #endif |
@@ -33,12 +33,12 @@ | ||
33 | 33 | #define ADP_CGI_PAGE_EXT ".cgi" |
34 | 34 | #define ADP_CGI_PAGE_EXT_SIZE 4 |
35 | 35 | #ifdef ___X64____ |
36 | -#define VERSION_TEXT "ADP Ver 0.72.0088 X64 (http://www.adp.la/)\nCopyright (C) 2011 Katsuhisa Ohfuji. This progman is distributed under GPL.\n" | |
36 | +#define VERSION_TEXT "ADP Ver 0.72.0089 X64 (http://www.adp.la/)\nCopyright (C) 2011 Katsuhisa Ohfuji. This progman is distributed under GPL.\n" | |
37 | 37 | #else |
38 | 38 | #if _WIN32 |
39 | -#define VERSION_TEXT "ADP Ver 0.72.0088 x86 (http://www.adp.la/)\nCopyright (C) 2011 Katsuhisa Ohfuji. This progman is distributed under GPL.\n" | |
39 | +#define VERSION_TEXT "ADP Ver 0.72.0089 x86 (http://www.adp.la/)\nCopyright (C) 2011 Katsuhisa Ohfuji. This progman is distributed under GPL.\n" | |
40 | 40 | #else |
41 | -#define VERSION_TEXT "ADP Ver 0.72.0088 (http://www.adp.la/)\nCopyright (C) 2011 Katsuhisa Ohfuji. This progman is distributed under GPL.\n" | |
41 | +#define VERSION_TEXT "ADP Ver 0.72.0089 (http://www.adp.la/)\nCopyright (C) 2011 Katsuhisa Ohfuji. This progman is distributed under GPL.\n" | |
42 | 42 | #endif |
43 | 43 | #endif |
44 | 44 |
@@ -1,5 +1,5 @@ | ||
1 | 1 | =========================================================================== |
2 | -ADP(Another Data Processor)Ver 0.71 | |
2 | +ADP(Another Data Processor)Ver 0.72 | |
3 | 3 | Copyright (C) 2011 Katsuhisa Ohfuji |
4 | 4 | This progman is distributed under GPL. |
5 | 5 |