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:
parent
4398613413
commit
3272290189
3
AUTHORS
3
AUTHORS
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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 },
|
||||
|
Loading…
Reference in New Issue
Block a user