| | @@ -42,11 +42,10 @@ |
| 42 | 42 | MKDA_IMPLICIT_EMAIL /* e-mail link without mailto: */ |
| 43 | 43 | }; |
| 44 | 44 | |
| 45 | 45 | /* mkd_tagspan -- type of tagged <span> */ |
| 46 | 46 | enum mkd_tagspan { |
| 47 | | - MKDT_ATREF, /* @name references, as in /chat attention targeting */ |
| 48 | 47 | MKDT_HASHTAG, /* #hashtags */ |
| 49 | 48 | MKDT_NUMTAG /* #123[.456] /chat or /forum message IDs. */ |
| 50 | 49 | }; |
| 51 | 50 | |
| 52 | 51 | /* mkd_renderer -- functions for rendering parsed data */ |
| | @@ -960,48 +959,10 @@ |
| 960 | 959 | blob_append(ob, data, end); |
| 961 | 960 | } |
| 962 | 961 | return end; |
| 963 | 962 | } |
| 964 | 963 | |
| 965 | | -/* char_atref_tag -- '@' followed by "word" characters to tag |
| 966 | | - * at-references */ |
| 967 | | -static size_t char_atref_tag( |
| 968 | | - struct Blob *ob, |
| 969 | | - struct render *rndr, |
| 970 | | - char *data, |
| 971 | | - size_t offset, |
| 972 | | - size_t size |
| 973 | | -){ |
| 974 | | - size_t end; |
| 975 | | - struct Blob work = BLOB_INITIALIZER; |
| 976 | | - |
| 977 | | - if(offset>0 && !fossil_isspace(data[-1])){ |
| 978 | | - /* Only ever match if the *previous* character is |
| 979 | | - whitespace or we're at the start of the input. */ |
| 980 | | - return 0; |
| 981 | | - } |
| 982 | | - /*fprintf(stderr,"@-REF: %.*s\n", (int)size, data);*/ |
| 983 | | - if (size < 2 || !fossil_isalpha(data[1])) return 0; |
| 984 | | - for (end = 2; (end < size) |
| 985 | | - && (fossil_isalnum(data[end]) |
| 986 | | - /* TODO: email addresses are legal fossil user names, but |
| 987 | | - parsing those is beyond our current ambitions. |
| 988 | | - Similarly, non-ASCII names are legal, but not |
| 989 | | - currently handled here. */ |
| 990 | | - /*|| data[end] == '.' || data[end] == '_' |
| 991 | | - || data[end] == '-'*/); |
| 992 | | - ++end); |
| 993 | | - if(end<size){ |
| 994 | | - if(!fossil_isspace(data[end])){ |
| 995 | | - return 0; |
| 996 | | - } |
| 997 | | - } |
| 998 | | - blob_init(&work, data + 1, end - 1); |
| 999 | | - rndr->make.tagspan(ob, &work, MKDT_ATREF, rndr->make.opaque); |
| 1000 | | - return end; |
| 1001 | | -} |
| 1002 | | - |
| 1003 | 964 | /* char_hashref_tag -- '#' followed by "word" characters to tag |
| 1004 | 965 | ** post numbers, hashtags, etc. |
| 1005 | 966 | ** |
| 1006 | 967 | ** Basic syntax: |
| 1007 | 968 | ** |
| | @@ -1038,14 +999,14 @@ |
| 1038 | 999 | int nUscore = 0; /* Consecutive underscore counter */ |
| 1039 | 1000 | int numberMode = 0 /* 0 for normal, 1 for #NNN numeric, |
| 1040 | 1001 | and 2 for #NNN.NNN. */; |
| 1041 | 1002 | if(offset>0 && !fossil_isspace(data[-1])){ |
| 1042 | 1003 | /* Only ever match if the *previous* character is whitespace or |
| 1043 | | - we're at the start of the input. Note that we rely on fossil |
| 1044 | | - processing emphasis markup before reaching this function, so |
| 1045 | | - *#Hash* will Do The Right Thing. Not that this means that |
| 1046 | | - "#Hash." will match while ".#Hash" won't. That's okay. */ |
| 1004 | + ** we're at the start of the input. Note that we rely on fossil |
| 1005 | + ** processing emphasis markup before reaching this function, so |
| 1006 | + ** *#Hash* will Do The Right Thing. Not that this means that |
| 1007 | + ** "#Hash." will match while ".#Hash" won't. That's okay. */ |
| 1047 | 1008 | return 0; |
| 1048 | 1009 | } |
| 1049 | 1010 | assert( '#' == data[0] ); |
| 1050 | 1011 | if(size < 2) return 0; |
| 1051 | 1012 | end = 2; |
| | @@ -1052,12 +1013,12 @@ |
| 1052 | 1013 | if(fossil_isdigit(data[1])){ |
| 1053 | 1014 | numberMode = 1; |
| 1054 | 1015 | }else if(!fossil_isalpha(data[1])){ |
| 1055 | 1016 | switch(data[1] & 0xF0){ |
| 1056 | 1017 | /* Reminder: UTF8 char lengths can be determined by |
| 1057 | | - masking against 0xF0: 0xf0==4, 0xe0==3, 0xc0==2, |
| 1058 | | - else 1. */ |
| 1018 | + ** masking against 0xF0: 0xf0==4, 0xe0==3, 0xc0==2, |
| 1019 | + ** else 1. */ |
| 1059 | 1020 | case 0xF0: end+=3; break; |
| 1060 | 1021 | case 0xE0: end+=2; break; |
| 1061 | 1022 | case 0xC0: end+=1; break; |
| 1062 | 1023 | default: return 0; |
| 1063 | 1024 | } |
| | @@ -2886,11 +2847,10 @@ |
| 2886 | 2847 | } |
| 2887 | 2848 | } |
| 2888 | 2849 | if( rndr.make.codespan ) rndr.active_char['`'] = char_codespan; |
| 2889 | 2850 | if( rndr.make.linebreak ) rndr.active_char['\n'] = char_linebreak; |
| 2890 | 2851 | if( rndr.make.image || rndr.make.link ) rndr.active_char['['] = char_link; |
| 2891 | | - rndr.active_char['@'] = char_atref_tag; |
| 2892 | 2852 | rndr.active_char['#'] = char_hashref_tag; |
| 2893 | 2853 | if( rndr.make.footnote_ref ) rndr.active_char['('] = char_footnote; |
| 2894 | 2854 | rndr.active_char['<'] = char_langle_tag; |
| 2895 | 2855 | rndr.active_char['\\'] = char_escape; |
| 2896 | 2856 | rndr.active_char['&'] = char_entity; |
| 2897 | 2857 | |