1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Better <q> support

Patch by Jonas Koelker, Jonas Fonseca, and me.
This commit is contained in:
Miciah Dashiel Butler Masters 2006-05-28 00:37:12 +00:00 committed by Miciah Dashiel Butler Masters
parent 4398613413
commit 3272290189
5 changed files with 30 additions and 1 deletions

View File

@ -250,6 +250,9 @@ Jonas Fonseca <fonseca@diku.dk>
BFU and document management hacking
Random hacking
Jonas Kölker <jonaskoelker@gnu.org>
Handling of <q>quotes</q>.
Jon Shapcott <eden@xibalba.demon.co.uk>
Lua 5 retrofits

View File

@ -65,6 +65,8 @@ struct html_context {
* state-machine. */
int was_li;
int quote_level; /* Nesting level of <q> tags. */
unsigned int was_br:1;
unsigned int was_xmp:1;
unsigned int was_style:1;

View File

@ -97,6 +97,28 @@ html_superscript(struct html_context *html_context, unsigned char *a,
html_context->put_chars_f(html_context, "^", 1);
}
/* TODO: Add more languages. */
static unsigned char *quote_char[2] = { "\"", "'" };
void
html_quote(struct html_context *html_context, unsigned char *a,
unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5)
{
unsigned char *q = quote_char[html_context->quote_level++ % 2];
html_context->put_chars_f(html_context, q, 1);
}
void
html_quote_close(struct html_context *html_context, unsigned char *a,
unsigned char *xxx3, unsigned char *xxx4,
unsigned char **xxx5)
{
unsigned char *q = quote_char[--html_context->quote_level % 2];
html_context->put_chars_f(html_context, q, 1);
}
void
html_font(struct html_context *html_context, unsigned char *a,
unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5)

View File

@ -37,6 +37,8 @@ element_handler_T html_noscript;
element_handler_T html_ol;
element_handler_T html_p;
element_handler_T html_pre;
element_handler_T html_quote;
element_handler_T html_quote_close;
element_handler_T html_script;
element_handler_T html_span;
element_handler_T html_style;

View File

@ -472,7 +472,7 @@ static struct element_info elements[] = {
{"OPTION", html_option, NULL, 1, ET_NON_PAIRABLE},
{"P", html_p, NULL, 2, ET_NON_NESTABLE},
{"PRE", html_pre, NULL, 2, ET_NESTABLE },
{"Q", html_italic, NULL, 0, ET_NESTABLE },
{"Q", html_quote, html_quote_close, 0, ET_NESTABLE },
{"S", html_underline, NULL, 0, ET_NESTABLE },
{"SCRIPT", html_script, NULL, 0, ET_NESTABLE },
{"SELECT", html_select, NULL, 0, ET_NESTABLE },