| | @@ -750,32 +750,46 @@ |
| 750 | 750 | } |
| 751 | 751 | } |
| 752 | 752 | } |
| 753 | 753 | return 1; |
| 754 | 754 | } |
| 755 | + |
| 756 | +static void html_span( |
| 757 | + struct Blob *ob, |
| 758 | + struct Blob *text, |
| 759 | + const char *tag |
| 760 | +){ |
| 761 | + blob_appendf(ob, "<%s>", tag); |
| 762 | + blob_appendb(ob, text); |
| 763 | + blob_appendf(ob, "</%s>", tag); |
| 764 | +} |
| 755 | 765 | |
| 756 | 766 | static int html_double_emphasis( |
| 757 | 767 | struct Blob *ob, |
| 758 | 768 | struct Blob *text, |
| 759 | 769 | char c, |
| 760 | 770 | void *opaque |
| 761 | 771 | ){ |
| 762 | | - blob_append_literal(ob, "<strong>"); |
| 763 | | - blob_appendb(ob, text); |
| 764 | | - blob_append_literal(ob, "</strong>"); |
| 772 | + if( c=='~' ) html_span(ob, text, "s"); |
| 773 | + else if( c=='-' ) html_span(ob, text, "del"); |
| 774 | + else if( c=='+' ) html_span(ob, text, "ins"); |
| 775 | + else if( c=='=' ) html_span(ob, text, "mark"); |
| 776 | + else if( c=='^' ) return 0; |
| 777 | + else html_span(ob, text, "strong"); |
| 765 | 778 | return 1; |
| 766 | 779 | } |
| 767 | 780 | |
| 768 | 781 | static int html_emphasis( |
| 769 | 782 | struct Blob *ob, |
| 770 | 783 | struct Blob *text, |
| 771 | 784 | char c, |
| 772 | 785 | void *opaque |
| 773 | 786 | ){ |
| 774 | | - blob_append_literal(ob, "<em>"); |
| 775 | | - blob_appendb(ob, text); |
| 776 | | - blob_append_literal(ob, "</em>"); |
| 787 | + if( c=='~' ) html_span(ob, text, "sub"); |
| 788 | + else if( c=='^' ) html_span(ob, text, "sup"); |
| 789 | + else if( c=='-' || c=='+' || c=='=' ) return 0; |
| 790 | + else html_span(ob, text, "em"); |
| 777 | 791 | return 1; |
| 778 | 792 | } |
| 779 | 793 | |
| 780 | 794 | static int html_image( |
| 781 | 795 | struct Blob *ob, |
| | @@ -834,10 +848,11 @@ |
| 834 | 848 | struct Blob *ob, |
| 835 | 849 | struct Blob *text, |
| 836 | 850 | char c, |
| 837 | 851 | void *opaque |
| 838 | 852 | ){ |
| 853 | + if( c!='*' && c!='_' ) return 0; |
| 839 | 854 | blob_append_literal(ob, "<strong><em>"); |
| 840 | 855 | blob_appendb(ob, text); |
| 841 | 856 | blob_append_literal(ob, "</em></strong>"); |
| 842 | 857 | return 1; |
| 843 | 858 | } |
| | @@ -893,11 +908,11 @@ |
| 893 | 908 | /* low level elements */ |
| 894 | 909 | 0, /* entity */ |
| 895 | 910 | html_normal_text, |
| 896 | 911 | |
| 897 | 912 | /* misc. parameters */ |
| 898 | | - "*_", /* emph_chars */ |
| 913 | + "*+-=^_~", /* emph_chars */ |
| 899 | 914 | 0 /* opaque */ |
| 900 | 915 | }; |
| 901 | 916 | static int invocation = -1; /* no marker for the first document */ |
| 902 | 917 | static const char* zRU = 0; /* REQUEST_URI with escaped quotes */ |
| 903 | 918 | MarkdownToHtml context; |
| 904 | 919 | |