Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Understand files ending in ".pikchr" to be Pikchr source text and render them appropriately. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
e32214a40901de44c99e2eafb00cd2dc |
| User & Date: | drh 2020-10-11 01:19:47.835 |
References
|
2020-10-11
| ||
| 07:03 | Attempt to use the feature added in [e32214a409] to extract the duplicate Pikchr code for diagram #4 in the rebase doc as a separate file, so we can refer to it twice via a Markdown image link instead. Doesn't work, but my next steps require a checkin I can reference. EDIT: Per forum feedback (https://fossil-scm.org/forum/forumpost/5c177b55b6) I'm abandoning this. ... (Closed-Leaf check-in: a9dcda5dfd user: wyoung tags: extract-pikchr) | |
Context
|
2020-10-11
| ||
| 06:51 | Greatly expanded the simple definition of "blockchain" in the eponymous doc to include more details of common blockchain implementations to draw clearer parallels. This causes our conclusion to flip around from the prior version of this doc, but it's worth keeping the doc because it serves to compare and contrast Fossil to other systems. ... (check-in: 1ddb400886 user: wyoung tags: trunk) | |
| 01:19 | Understand files ending in ".pikchr" to be Pikchr source text and render them appropriately. ... (check-in: e32214a409 user: drh tags: trunk) | |
|
2020-10-10
| ||
| 20:33 | New pikchr.c that fixes the top and bottom margin that was lost in the previous check-in. ... (check-in: 0ec09ea894 user: drh tags: trunk) | |
Changes
Changes to src/doc.c.
| ︙ | ︙ | |||
188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
{ "ogm", 3, "application/ogg" },
{ "pbm", 3, "image/x-portable-bitmap" },
{ "pdb", 3, "chemical/x-pdb" },
{ "pdf", 3, "application/pdf" },
{ "pgm", 3, "image/x-portable-graymap" },
{ "pgn", 3, "application/x-chess-pgn" },
{ "pgp", 3, "application/pgp" },
{ "pl", 2, "application/x-perl" },
{ "pm", 2, "application/x-perl" },
{ "png", 3, "image/png" },
{ "pnm", 3, "image/x-portable-anymap" },
{ "pot", 3, "application/mspowerpoint" },
{ "potx", 4, "application/vnd.openxmlformats-"
"officedocument.presentationml.template"},
| > | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
{ "ogm", 3, "application/ogg" },
{ "pbm", 3, "image/x-portable-bitmap" },
{ "pdb", 3, "chemical/x-pdb" },
{ "pdf", 3, "application/pdf" },
{ "pgm", 3, "image/x-portable-graymap" },
{ "pgn", 3, "application/x-chess-pgn" },
{ "pgp", 3, "application/pgp" },
{ "pikchr", 6, "text/x-pikchr" },
{ "pl", 2, "application/x-perl" },
{ "pm", 2, "application/x-perl" },
{ "png", 3, "image/png" },
{ "pnm", 3, "image/x-portable-anymap" },
{ "pot", 3, "application/mspowerpoint" },
{ "potx", 4, "application/vnd.openxmlformats-"
"officedocument.presentationml.template"},
|
| ︙ | ︙ | |||
792 793 794 795 796 797 798 799 800 801 802 803 804 805 |
style_footer();
}else if( fossil_strcmp(zMime, "text/html")==0
&& doc_is_embedded_html(pBody, &title) ){
if( blob_size(&title)==0 ) blob_append(&title,zFilename,-1);
style_header("%s", blob_str(&title));
convert_href_and_output(pBody);
document_emit_js();
style_footer();
#ifdef FOSSIL_ENABLE_TH1_DOCS
}else if( Th_AreDocsEnabled() &&
fossil_strcmp(zMime, "application/x-th1")==0 ){
int raw = P("raw")!=0;
if( !raw ){
Blob tail;
| > > > > > | 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 |
style_footer();
}else if( fossil_strcmp(zMime, "text/html")==0
&& doc_is_embedded_html(pBody, &title) ){
if( blob_size(&title)==0 ) blob_append(&title,zFilename,-1);
style_header("%s", blob_str(&title));
convert_href_and_output(pBody);
document_emit_js();
style_footer();
}else if( fossil_strcmp(zMime, "text/x-pikchr")==0 ){
style_adunit_config(ADUNIT_RIGHT_OK);
style_header("%s", zDefaultTitle);
wiki_render_by_mimetype(pBody, zMime);
style_footer();
#ifdef FOSSIL_ENABLE_TH1_DOCS
}else if( Th_AreDocsEnabled() &&
fossil_strcmp(zMime, "application/x-th1")==0 ){
int raw = P("raw")!=0;
if( !raw ){
Blob tail;
|
| ︙ | ︙ |
Changes to src/info.c.
| ︙ | ︙ | |||
2410 2411 2412 2413 2414 2415 2416 |
if( asText ){
style_submenu_element("Html", "%s", url_render(&url, "txt", 0, 0, 0));
}else{
renderAsHtml = 1;
style_submenu_element("Text", "%s", url_render(&url, "txt", "1", 0, 0));
}
}else if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0
| | > > | | 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 |
if( asText ){
style_submenu_element("Html", "%s", url_render(&url, "txt", 0, 0, 0));
}else{
renderAsHtml = 1;
style_submenu_element("Text", "%s", url_render(&url, "txt", "1", 0, 0));
}
}else if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0
|| fossil_strcmp(zMime, "text/x-markdown")==0
|| fossil_strcmp(zMime, "text/x-pikchr")==0 ){
if( asText ){
style_submenu_element(zMime[7]=='p' ? "Pikchr" : "Wiki",
"%s", url_render(&url, "txt", 0, 0, 0));
}else{
renderAsWiki = 1;
style_submenu_element("Text", "%s", url_render(&url, "txt", "1", 0, 0));
}
}else if( fossil_strcmp(zMime, "image/svg+xml")==0 ){
if( asText ){
style_submenu_element("Svg", "%s", url_render(&url, "txt", 0, 0, 0));
|
| ︙ | ︙ |
Changes to src/wiki.c.
| ︙ | ︙ | |||
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
}
/*
** Render wiki text according to its mimetype.
**
** text/x-fossil-wiki Fossil wiki
** text/x-markdown Markdown
** anything else... Plain text
**
** If zMimetype is a null pointer, then use "text/x-fossil-wiki".
*/
void wiki_render_by_mimetype(Blob *pWiki, const char *zMimetype){
if( zMimetype==0 || fossil_strcmp(zMimetype, "text/x-fossil-wiki")==0 ){
wiki_convert(pWiki, 0, 0);
}else if( fossil_strcmp(zMimetype, "text/x-markdown")==0 ){
Blob tail = BLOB_INITIALIZER;
markdown_to_html(pWiki, 0, &tail);
safe_html(&tail);
@ %s(blob_str(&tail))
blob_reset(&tail);
}else{
@ <pre class='textPlain'>
@ %h(blob_str(pWiki))
@ </pre>
}
}
| > > > > > > > > > > > > > > > | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
}
/*
** Render wiki text according to its mimetype.
**
** text/x-fossil-wiki Fossil wiki
** text/x-markdown Markdown
** text/x-pikchr Pikchr
** anything else... Plain text
**
** If zMimetype is a null pointer, then use "text/x-fossil-wiki".
*/
void wiki_render_by_mimetype(Blob *pWiki, const char *zMimetype){
if( zMimetype==0 || fossil_strcmp(zMimetype, "text/x-fossil-wiki")==0 ){
wiki_convert(pWiki, 0, 0);
}else if( fossil_strcmp(zMimetype, "text/x-markdown")==0 ){
Blob tail = BLOB_INITIALIZER;
markdown_to_html(pWiki, 0, &tail);
safe_html(&tail);
@ %s(blob_str(&tail))
blob_reset(&tail);
}else if( fossil_strcmp(zMimetype, "text/x-pikchr")==0 ){
const char *zPikchr = blob_str(pWiki);
int w, h;
char *zOut = pikchr(zPikchr, "pikchr", 0, &w, &h);
if( w>0 ){
@ <div class="pikchr-svg" style="max-width:%d(w)px">
@ %s(zOut)
@ </div>
}else{
@ <pre class='error'>\n">
@ %s(zOut);
@ </pre>
}
free(zOut);
}else{
@ <pre class='textPlain'>
@ %h(blob_str(pWiki))
@ </pre>
}
}
|
| ︙ | ︙ |