176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
/* block_tags -- recognised block tags, sorted by cmp_html_tag.
**
** When these HTML tags are separated from other text by newlines
** then they are rendered verbatim. Their content is not interpreted
** in any way.
*/
static const struct html_tag block_tags[] = {
{ "pre", 3 },
{ "script", 6 },
};
/***************************
* STATIC HELPER FUNCTIONS *
|
>
|
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
/* block_tags -- recognised block tags, sorted by cmp_html_tag.
**
** When these HTML tags are separated from other text by newlines
** then they are rendered verbatim. Their content is not interpreted
** in any way.
*/
static const struct html_tag block_tags[] = {
{ "html", 4 },
{ "pre", 3 },
{ "script", 6 },
};
/***************************
* STATIC HELPER FUNCTIONS *
|
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
}
/* cmp_html_tag -- comparison function for bsearch() (stolen from discount) */
static int cmp_html_tag(const void *a, const void *b){
const struct html_tag *hta = a;
const struct html_tag *htb = b;
if( hta->size!=htb->size ) return hta->size-htb->size;
return fossil_strnicmp(hta->text, htb->text, hta->size);
}
/* find_block_tag -- returns the current block tag */
static const struct html_tag *find_block_tag(const char *data, size_t size){
size_t i = 0;
struct html_tag key;
|
|
>
>
|
>
>
|
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
|
}
/* cmp_html_tag -- comparison function for bsearch() (stolen from discount) */
static int cmp_html_tag(const void *a, const void *b){
const struct html_tag *hta = a;
const struct html_tag *htb = b;
int sz = hta->size;
int c;
if( htb->size<sz ) sz = htb->size;
c = fossil_strnicmp(hta->text, htb->text, sz);
if( c==0 ) c = hta->size - htb->size;
return c;
}
/* find_block_tag -- returns the current block tag */
static const struct html_tag *find_block_tag(const char *data, size_t size){
size_t i = 0;
struct html_tag key;
|
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
|
found = 1;
break;
}
}
if( !found ) return 0;
/* the end of the block has been found */
blob_init(&work, data, i);
if( rndr->make.blockhtml ){
rndr->make.blockhtml(ob, &work, rndr->make.opaque);
}
return i;
}
|
>
>
>
>
>
>
|
>
|
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
|
found = 1;
break;
}
}
if( !found ) return 0;
/* the end of the block has been found */
if( strcmp(curtag->text,"html")==0 ){
/* Omit <html> tags */
enum mkd_autolink dummy;
int k = tag_length(data, size, &dummy);
blob_init(&work, data+k, i-(j+k));
}else{
blob_init(&work, data, i);
}
if( rndr->make.blockhtml ){
rndr->make.blockhtml(ob, &work, rndr->make.opaque);
}
return i;
}
|