Changes In Branch pikchr-src-in-metadata Excluding Merge-Ins
This is equivalent to a diff from f1a7b5b9a8 to 4860729b9c
2020-09-15
| ||
13:24 | Include the source text in the generated output if the PIKCHR_INCLUDE_SOURCE flag is provided to the pikchr() routine. Make that flag discoverable by makeheaders. Futher interface improvements are pending. (check-in: 8fa7c91a51 user: drh tags: trunk) | |
2020-09-14
| ||
20:40 | Begin adding documentation on the various block object types. (check-in: 413cda247f user: drh tags: trunk) | |
20:38 | Merged in trunk. Changed pikchr svg metadata namespace URL to point to grammar.md. Lowercased namespace metadata XML nodes based on advice from around the net on the topic vis a vis compatibility with HTML5. (Closed-Leaf check-in: 4860729b9c user: stephan tags: pikchr-src-in-metadata) | |
19:21 | In the grammar documentation, make "object-class" a new non-terminal, rather than a token class. This provides the opportunity to add "Info" links on each class for more information. (check-in: f1a7b5b9a8 user: drh tags: trunk) | |
17:12 | Typo fix in documentation. (check-in: aadd7b158e user: drh tags: trunk) | |
06:56 | Added Pik::mFlags, set via pikchr()'s 3rd arg. Added original pikchr source code in a metadata tag, which survives loading and re-saving via inkscape. That needs to be fixed to only emit when a certain flag is set, but how to properly add such flags to the public API is not clear. (check-in: ac8d73bc6a user: stephan tags: pikchr-src-in-metadata) | |
Changes to pikchr.y.
︙ | |||
333 334 335 336 337 338 339 340 341 342 343 344 345 346 | 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | + | unsigned nErr; /* Number of errors seen */ const char *zIn; /* Input PIKCHR-language text. zero-terminated */ unsigned int nIn; /* Number of bytes in zIn */ char *zOut; /* Result accumulates here */ unsigned int nOut; /* Bytes written to zOut[] so far */ unsigned int nOutAlloc; /* Space allocated to zOut[] */ unsigned char eDir; /* Current direction */ unsigned int mFlags; /* Flags passed to pikchr() */ PElem *cur; /* Element under construction */ PEList *list; /* Element list under construction */ PVar *pVar; /* Application-defined variables */ PBox bbox; /* Bounding box around all elements */ /* Cache of layout values. <=0.0 for unknown... */ PNum rScale; /* Multiply to convert inches to pixels */ PNum fontScale; /* Scale fonts by this percent */ |
︙ | |||
1958 1959 1960 1961 1962 1963 1964 | 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 | - + | pik_append(p, buf, -1); } /* Append a style="..." text. But, leave the quote unterminated, in case ** the caller wants to add some more. */ static void pik_append_style(Pik *p, PElem *pElem){ |
︙ | |||
2245 2246 2247 2248 2249 2250 2251 | 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 | - + | return 0; } /* ** Process an "assert( place1 == place2 )" statement. Always return NULL. */ static PElem *pik_place_assert(Pik *p, PPoint *e1, PToken *pEq, PPoint *e2){ |
︙ | |||
3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 | 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 | + + + + + + + + + + + + + | } w = p->bbox.ne.x - p->bbox.sw.x; h = p->bbox.ne.y - p->bbox.sw.y; p->wSVG = (int)(p->rScale*w); p->hSVG = (int)(p->rScale*h); pik_append_dis(p, " viewBox=\"0 0 ",w,""); pik_append_dis(p, " ",h,"\">\n"); if(1){ /* emit original pikchr source code as metadata */ /* FIXME: emit this only if a certain p->mFlags is set. */ pik_append(p, "<metadata>\n", 11); pik_append(p, "<pikchr:pikchr xmlns:pikchr=" "\"https://pikchr.org/home/doc/trunk/doc/grammar.md\">\n", -1); pik_append(p, "<pikchr:src><![CDATA[", 21); pik_append(p, p->zIn, (int)p->nIn); pik_append(p, "]]></pikchr:src>\n", 17); pik_append(p, "</pikchr:pikchr>\n", 17); pik_append(p, "</metadata>\n", 12); } pik_elist_render(p, pEList); pik_append(p,"</svg>\n", -1); }else{ p->wSVG = -1; p->hSVG = -1; } pik_elist_free(p, pEList); |
︙ | |||
4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 | 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 | + | yyParser sParse; memset(&s, 0, sizeof(s)); s.zIn = zText; s.nIn = (unsigned int)strlen(zText); s.eDir = DIR_RIGHT; s.zClass = zClass; s.mFlags = mFlags; pik_parserInit(&sParse, &s); #if 0 pik_parserTrace(stdout, "parser: "); #endif for(i=0; zText[i] && s.nErr==0; i+=sz){ token.eCode = 0; token.eEdge = 0; |
︙ |