326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
|
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, /* Write the generated SVG here */
const char *zSrc, int nSrc, /* The Pikchr source text */
const char *zArg, int nArg /* Addition arguments */
){
int w = 0, h = 0;
char *zIn = fossil_strndup(zSrc, nSrc);
char *zOut = pikchr(zIn, "pikchr", 0, &w, &h);
|
|
|
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
|
return 1;
}
/*
** The nSrc bytes at zSrc[] are Pikchr input text (allegedly). Process that
** text and insert the result in place of the original.
*/
void pikchr_to_html(
Blob *ob, /* Write the generated SVG here */
const char *zSrc, int nSrc, /* The Pikchr source text */
const char *zArg, int nArg /* Addition arguments */
){
int w = 0, h = 0;
char *zIn = fossil_strndup(zSrc, nSrc);
char *zOut = pikchr(zIn, "pikchr", 0, &w, &h);
|
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
|
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 ){
while( j<i && fossil_isspace(z[j]) ){ j++; }
fenced_code_pikchr_to_html(ob, z+i, n-i, z+j, i-j);
}else{
blob_appendf(ob, "<pre><code class='language-%#h'>%#h</code></pre>",
j-k, z+k, n-i, z+i);
}
}
}
}
|
|
|
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
|
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 ){
while( j<i && fossil_isspace(z[j]) ){ j++; }
pikchr_to_html(ob, z+i, n-i, z+j, i-j);
}else{
blob_appendf(ob, "<pre><code class='language-%#h'>%#h</code></pre>",
j-k, z+k, n-i, z+i);
}
}
}
}
|