• R/O
  • SSH
  • HTTPS

adp: Commit


Commit MetaInfo

Revision89 (tree)
Time2011-06-23 15:04:25
Authorohfuji

Log Message

AWPモードの改行を<br>タグに変換しない処理で、preタグ内に加えて、tableタグ内でかつ<th><td><caption>内でない場合も<br>タグの付与を行わない。

Change Summary

Incremental Difference

--- trunk/adp_common.cpp (revision 88)
+++ trunk/adp_common.cpp (revision 89)
@@ -361,14 +361,20 @@
361361 if ( awpescape ) {
362362 txt.clear();
363363 int precnt = 0;
364+ int tablecnt = 0;
365+ int thtdcnt = 0;
364366 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 ) {
372378 if ( *i == '\r' ) {
373379 txt += "<br>";
374380 if ( i + 1 < out.end() && *(i+1) == '\n' ) {
--- trunk/kz_base.h (revision 88)
+++ trunk/kz_base.h (revision 89)
@@ -99,6 +99,13 @@
9999 return strcmp( src.c_str() + src.size() - len, dst) == 0;
100100 }
101101
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+}
102110
103-
104111 #endif
--- trunk/adp.cpp (revision 88)
+++ trunk/adp.cpp (revision 89)
@@ -33,12 +33,12 @@
3333 #define ADP_CGI_PAGE_EXT ".cgi"
3434 #define ADP_CGI_PAGE_EXT_SIZE 4
3535 #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"
3737 #else
3838 #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"
4040 #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"
4242 #endif
4343 #endif
4444
--- trunk/readme.txt (revision 88)
+++ trunk/readme.txt (revision 89)
@@ -1,5 +1,5 @@
11 ===========================================================================
2-ADP(Another Data Processor)Ver 0.71
2+ADP(Another Data Processor)Ver 0.72
33 Copyright (C) 2011 Katsuhisa Ohfuji
44 This progman is distributed under GPL.
55
Show on old repository browser