321
322
323
324
325
326
327
328
329
330
331
332
333
334
|
html_escape(ob, blob_buffer(link)+7, blob_size(link)-7);
}else{
html_escape(ob, blob_buffer(link), blob_size(link));
}
BLOB_APPEND_LITERAL(ob, "</a>");
return 1;
}
/* Invoked for `...` blocks where there are nSep grave accents in a
** row that serve as the delimiter. According to CommonMark:
**
** * https://spec.commonmark.org/0.29/#fenced-code-blocks
** * https://spec.commonmark.org/0.29/#code-spans
**
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
|
html_escape(ob, blob_buffer(link)+7, blob_size(link)-7);
}else{
html_escape(ob, blob_buffer(link), blob_size(link));
}
BLOB_APPEND_LITERAL(ob, "</a>");
return 1;
}
/*
** The nSrc bytes at zSrc[] are Pikchr input text (allegedly). Process that
** text and insert the result in place of the original.
*/
static void fenced_code_pikchr_to_html(Blob *ob, const char *zSrc, int nSrc){
int w = 0, h = 0;
char *zIn = fossil_strndup(zSrc, nSrc);
char *zOut = pikchr(zIn, "pikchr", 0, &w, &h);
fossil_free(zIn);
if( w>0 && h>0 ){
const char *zNonce = safe_html_nonce(1);
blob_appendf(ob, "%s\n%s%s", zNonce, zOut, zNonce);
}else{
blob_appendf(ob, "<pre>\n%s\n</pre>\n", zOut);
}
free(zOut);
}
/* Invoked for `...` blocks where there are nSep grave accents in a
** row that serve as the delimiter. According to CommonMark:
**
** * https://spec.commonmark.org/0.29/#fenced-code-blocks
** * https://spec.commonmark.org/0.29/#code-spans
**
|
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
|
int k, j;
i++;
for(k=0; k<i && fossil_isspace(z[k]); k++){}
if( k==i ){
blob_appendf(ob, "<pre><code>%#h</code></pre>", n-i, z+i);
}else{
for(j=k+1; j<i && !fossil_isspace(z[j]); j++){}
blob_appendf(ob, "<pre><code class='language-%#h'>%#h</code></pre>",
j-k, z+k, n-i, z+i);
}
}
}
return 1;
}
static int html_double_emphasis(
|
>
>
>
|
|
>
|
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
|
int k, j;
i++;
for(k=0; k<i && fossil_isspace(z[k]); k++){}
if( k==i ){
blob_appendf(ob, "<pre><code>%#h</code></pre>", n-i, z+i);
}else{
for(j=k+1; j<i && !fossil_isspace(z[j]); j++){}
if( j-k==6 && strncmp(z+k,"pikchr",6)==0 ){
fenced_code_pikchr_to_html(ob, z+i, n-i);
}else{
blob_appendf(ob, "<pre><code class='language-%#h'>%#h</code></pre>",
j-k, z+k, n-i, z+i);
}
}
}
}
return 1;
}
static int html_double_emphasis(
|