Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | An alternate impl for centering pikchrs which does not rely on margin:auto. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
2963f440e8fb01e21af8c4a4d672dd54 |
| User & Date: | stephan 2020-09-18 10:32:39.414 |
Context
|
2020-09-18
| ||
| 11:27 | Fix minor formatting error in the HTML for hierarchical forum. ... (check-in: 7221e497fc user: drh tags: trunk) | |
| 10:32 | An alternate impl for centering pikchrs which does not rely on margin:auto. ... (check-in: 2963f440e8 user: stephan tags: trunk) | |
| 09:21 | Fixed a preview quirk which caused the pikchr click handlers to not get processed on wikiedit/fileedit previews after the first one. ... (check-in: 052d374809 user: stephan tags: trunk) | |
Changes
Changes to src/default.css.
| ︙ | ︙ | |||
1384 1385 1386 1387 1388 1389 1390 |
}
noscript > .error {
/* Part of the style_emit_noscript_for_js_page() interface. */
padding: 1em;
font-size: 150%;
}
| > > > | | > > > > > > > > | 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 |
}
noscript > .error {
/* Part of the style_emit_noscript_for_js_page() interface. */
padding: 1em;
font-size: 150%;
}
div.pikchr-wrapper {/*outer wrapper elem for a pikchr construct*/}
div.pikchr {/*wrapper for SVG.pikchr element*/}
svg.pikchr {/*pikchr SVG*/}
pre.pikchr-src {/*source code view for a pikchr (see fossil.pikchr.js)*/
box-sizing: border-box;
overflow: auto;
text-align: left;
}
div.pikchr-wrapper.center {
text-align: center;
}
div.pikchr-wrapper.center > pre.pikchr-src,
div.pikchr-wrapper.center > div.pikchr-svg{
display:inline-block;
}
|
Changes to src/pikchrshow.c.
| ︙ | ︙ | |||
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
const char * zContent = blob_str(&bIn);
char *zOut;
zOut = pikchr(zContent, "pikchr", 0, &w, &h);
if( w>0 && h>0 ){
const char * zClassToggle = "";
const char * zClassSource = "";
const char *zNonce = (PIKCHR_PROCESS_NONCE & pikFlags)
? safe_html_nonce(1) : 0;
if(zNonce){
blob_appendf(pOut, "%s\n", zNonce);
}
if(PIKCHR_PROCESS_DIV & pikFlags){
Blob css = empty_blob;
blob_appendf(&css, "max-width:%dpx;", w);
if(PIKCHR_PROCESS_DIV_CENTER & pikFlags){
| > | > > | > | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
const char * zContent = blob_str(&bIn);
char *zOut;
zOut = pikchr(zContent, "pikchr", 0, &w, &h);
if( w>0 && h>0 ){
const char * zClassToggle = "";
const char * zClassSource = "";
const char * zWrapperClass = "";
const char *zNonce = (PIKCHR_PROCESS_NONCE & pikFlags)
? safe_html_nonce(1) : 0;
if(zNonce){
blob_appendf(pOut, "%s\n", zNonce);
}
if(PIKCHR_PROCESS_DIV & pikFlags){
Blob css = empty_blob;
blob_appendf(&css, "max-width:%dpx;", w);
if(PIKCHR_PROCESS_DIV_CENTER & pikFlags){
/*blob_append(&css, "display:block;margin:auto;", -1);*/
zWrapperClass = " center";
}else if(PIKCHR_PROCESS_DIV_INDENT & pikFlags){
blob_append(&css, "margin-left:4em", -1);
}else if(PIKCHR_PROCESS_DIV_FLOAT_LEFT & pikFlags){
blob_append(&css, "float:left;padding=4em;", -1);
}else if(PIKCHR_PROCESS_DIV_FLOAT_RIGHT & pikFlags){
blob_append(&css, "float:right;padding=4em;", -1);
}
if(PIKCHR_PROCESS_DIV_TOGGLE & pikFlags){
zClassToggle = " toggle";
}
if(PIKCHR_PROCESS_DIV_SOURCE & pikFlags){
zClassSource = " source";
}
blob_appendf(pOut,"<div class='pikchr-wrapper%s'>"
"<div class=\"pikchr-svg%s%s\" "
"style=\"%b\">\n",
zWrapperClass/*safe-for-%s*/,
zClassToggle/*safe-for-%s*/,
zClassSource/*safe-for-%s*/, &css);
blob_reset(&css);
}
blob_append(pOut, zOut, -1);
if(PIKCHR_PROCESS_DIV & pikFlags){
blob_append(pOut, "</div>\n", 7);
|
| ︙ | ︙ |