Menu

#410 need to revisit how $$...$$ and similar constructs are evaluated

workingwiki
open
None
5
2013-09-19
2013-09-19
Lee Worden
No

Math expressions enclosed in $$ signs have some problems with the current flow of evaluation:

  • [#408] Another "unclear which project to add to" problem
  • [#364] math in .wikitext files fails when not in original page workingwiki

I think both of these problems stem from assumptions made in the code that don't hold up. The evaluation works like this:

  • replace each $$math expression$$ (and the similar constructs {$...$} and <latex>...</latex>) by a tag of the form <source-file filename="ww-internal-3984729817493218ab59038e.tex-math" standalone="true">math expression</source-file>.
  • The long hexadecimal number in the filename is a hash value, which uniquely identifies the file's contents. This is useful because, for example, when a page includes $$\lambda$$ a bunch of times, it considers them all to be a single source file and avoids redundant processing.
  • The special "standalone" attribute tells WW that this source file belongs to a special project belonging to only that source file.
  • The name of the standalone project is constructed in a special way that includes the name of the page. WW uses that to come back to the page and retrieve the source file's contents when it's time to sync the source file.

When a page is moved, or when a $$...$$ source file is contained within a .wikitext file and then the .wikitext file is displayed on a different page than the page where it's stored (including displaying it in a GetProjectFile page), this process fails and WW behaves badly, presumably because it gets confused about which page the source file is on.

In principle it just needs to sync the source file, it doesn't need to know what page it's on. It would be great to make this process smarter and make these problems go away.

Related

Bugs: #364
Bugs: #408

Discussion

Anonymous
Anonymous

Add attachments
Cancel