diff options
author | Eduardo Chappa <chappa@washington.edu> | 2017-01-01 12:49:28 -0700 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2017-01-01 12:49:28 -0700 |
commit | 6278103d269e6882bb26a770c1f25bcd3e20ff13 (patch) | |
tree | f238aab74ddc76fb225cd2c39891180c8567cd4d /pith | |
parent | eefde42da7da15b305a56b443c166bfd96ba7432 (diff) | |
download | alpine-6278103d269e6882bb26a770c1f25bcd3e20ff13.tar.xz |
* Further improvements to support for parameters of OL tag.
Diffstat (limited to 'pith')
-rw-r--r-- | pith/filter.c | 12 | ||||
-rw-r--r-- | pith/pine.hlp | 2 | ||||
-rw-r--r-- | pith/string.c | 37 |
3 files changed, 28 insertions, 23 deletions
diff --git a/pith/filter.c b/pith/filter.c index 697ede61..845ec525 100644 --- a/pith/filter.c +++ b/pith/filter.c @@ -5644,13 +5644,13 @@ html_ol(HANDLER_S *hd, int ch, int cmd) p = p->next) if(p->value){ if(!strucmp(p->attribute, "TYPE")){ - if(!strucmp(p->value, "a")) /* alpha, capital */ + if(!strucmp(p->value, "a")) /* alpha, lowercase */ hd->y = LIST_ALPHALO; - else if(!strucmp(p->value, "A")) /* alpha, lowercase */ + else if(!strucmp(p->value, "A")) /* alpha, uppercase */ hd->y = LIST_ALPHAUP; - else if(!strucmp(p->value, "i")) /* roman, capital */ + else if(!strucmp(p->value, "i")) /* roman, lowercase */ hd->y = LIST_ROMANLO; - else if(!strucmp(p->value, "I")) /* roman, lowercase */ + else if(!strucmp(p->value, "I")) /* roman, uppercase */ hd->y = LIST_ROMANUP; else if(strucmp(p->value, "1")) /* decimal, the default */ hd->y = LIST_UNKNOWN; @@ -5658,6 +5658,10 @@ html_ol(HANDLER_S *hd, int ch, int cmd) else if(!strucmp(p->attribute, "START")) hd->x = atol(p->value); // else ADD SUPPORT FOR OTHER ATTRIBUTES... LATER +// this is not so simple. The main missing support +// is for the STYLE attribute, but implementing that +// correctly will take time, so will be implemented +// after version 2.21 is released. } HD(hd->html_data)->li_pending = 1; html_blank(hd->html_data, 0); diff --git a/pith/pine.hlp b/pith/pine.hlp index da19da4d..9723a402 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any reasonable place to be called from. Dummy change to get revision in pine.hlp ============= h_revision ================= -Alpine Commit 201 2016-12-27 20:55:21 +Alpine Commit 202 2017-01-01 12:49:25 ============= h_news ================= <HTML> <HEAD> diff --git a/pith/string.c b/pith/string.c index 0b65fe3f..cadbc924 100644 --- a/pith/string.c +++ b/pith/string.c @@ -2917,19 +2917,22 @@ free_strlist(STRLIST_S **strp) void convert_decimal_to_roman (char *rn, size_t len, long n, char l) { - char *symbols; - int amo[6]; + char symbols[7]; + int amo[7]; int i, j, k; rn[0] = '\0'; if(n >= 4000L || n <= 0L) return; - if(l == 'i') - symbols = "mdclxvi"; - else - symbols = "MDCLXVI"; - + symbols[0] = l + 'm' - 'i'; + symbols[1] = l + 'd' - 'i'; + symbols[2] = l + 'c' - 'i'; + symbols[3] = l + 'l' - 'i'; + symbols[4] = l + 'x' - 'i'; + symbols[5] = l + 'v' - 'i'; + symbols[6] = l; + amo[0] = n/1000; n -= amo[0]*1000; amo[1] = n/500; n -= amo[1]*500; amo[2] = n/100; n -= amo[2]*100; @@ -2938,7 +2941,7 @@ convert_decimal_to_roman (char *rn, size_t len, long n, char l) amo[5] = n/5; n -= amo[5]*5; amo[6] = n; - for(i = 0, j = 0; j < strlen(symbols); j++){ + for(i = 0, j = 0; i < len && j < strlen(symbols); j++){ if(amo[j] < 4){ if(amo[j+1] != 4){ for(k = 0; k < amo[j]; k++) @@ -2954,31 +2957,29 @@ convert_decimal_to_roman (char *rn, size_t len, long n, char l) } } } - rn[i++] = '\0'; - rn[len] = '\0'; + if(i < len) rn[i] = '\0'; + rn[len-1] = '\0'; } void convert_decimal_to_alpha (char *rn, size_t len, long n, char l) { - char *symbols; int amo[16]; - int i, j, k; + int i; rn[0] = '\0'; if(n < 0) return; - for(i = 0; n > 0; i++){ + for(i = 0; i < sizeof(amo) && n > 0; i++){ amo[i] = n % 26; - n = (n - amo[i])/26; + n = (n - amo[i])/26; } amo[i] = -1; - for(i = 0; amo[i] >= 0; i++) + for(i = 0; i < len && amo[i] >= 0; i++) rn[i] = l + amo[i] - 1; - rn[i] = '\0'; - rn[len] = '\0'; + if(i < len) rn[i] = '\0'; + rn[len-1] = '\0'; } - |