aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'file.c')
-rw-r--r--file.c43
1 files changed, 40 insertions, 3 deletions
diff --git a/file.c b/file.c
index 2ad58ca..52ace23 100644
--- a/file.c
+++ b/file.c
@@ -1,4 +1,5 @@
/* $Id: file.c,v 1.266 2012/05/22 09:45:56 inu Exp $ */
+/* vi: set sw=4 ts=8 ai sm noet : */
#include "fm.h"
#include <sys/types.h>
#include "myctype.h"
@@ -4322,9 +4323,18 @@ process_idattr(struct readbuffer *obuf, int cmd, struct parsed_tag *tag)
obuf->flag &= ~RB_P;\
}
-#define CLOSE_A \
- CLOSE_P; \
- close_anchor(h_env, obuf);
+#define HTML5_CLOSE_A do { \
+ if (obuf->flag & RB_HTML5) { \
+ close_anchor(h_env, obuf); \
+ } \
+ } while (0)
+
+#define CLOSE_A do { \
+ CLOSE_P; \
+ if (!(obuf->flag & RB_HTML5)) { \
+ close_anchor(h_env, obuf); \
+ } \
+ } while (0)
#define CLOSE_DT \
if (obuf->flag & RB_IN_DT) { \
@@ -4487,9 +4497,27 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
HTMLlineproc1("</b>", h_env);
return 1;
case HTML_Q:
+#ifdef USE_M17N
+#ifdef USE_UNICODE
+ if (DisplayCharset != WC_CES_US_ASCII) {
+ HTMLlineproc1((obuf->q_level & 1 ? "&lsquo;": "&ldquo;"), h_env);
+ obuf->q_level += 1;
+ }
+ else
+#endif
+#endif
HTMLlineproc1("`", h_env);
return 1;
case HTML_N_Q:
+#ifdef USE_M17N
+#ifdef USE_UNICODE
+ if (DisplayCharset != WC_CES_US_ASCII) {
+ obuf->q_level -= 1;
+ HTMLlineproc1((obuf->q_level & 1 ? "&rsquo;": "&rdquo;"), h_env);
+ }
+ else
+#endif
+#endif
HTMLlineproc1("'", h_env);
return 1;
case HTML_FIGURE:
@@ -4931,6 +4959,8 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
close_anchor(h_env, obuf);
return 1;
case HTML_IMG:
+ if (parsedtag_exists(tag, ATTR_USEMAP))
+ HTML5_CLOSE_A;
tmp = process_img(tag, h_env->limit);
HTMLlineproc1(tmp->ptr, h_env);
return 1;
@@ -5126,6 +5156,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
HTMLlineproc1(tmp->ptr, h_env);
return 1;
case HTML_BUTTON:
+ HTML5_CLOSE_A;
tmp = process_button(tag);
if (tmp)
HTMLlineproc1(tmp->ptr, h_env);
@@ -5181,6 +5212,11 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
NULL);
HTMLlineproc1(tmp->ptr, h_env);
return 1;
+ case HTML_DOCTYPE:
+ if (!parsedtag_exists(tag, ATTR_PUBLIC)) {
+ obuf->flag |= RB_HTML5;
+ }
+ return 1;
case HTML_META:
p = q = r = NULL;
parsedtag_get_value(tag, ATTR_HTTP_EQUIV, &p);
@@ -5379,6 +5415,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
}
return 1;
case HTML_EMBED:
+ HTML5_CLOSE_A;
if (view_unseenobject) {
if (parsedtag_get_value(tag, ATTR_SRC, &p)) {
Str s;