M2 icon indicating copy to clipboard operation
M2 copied to clipboard

relative links between documentation files

Open DanGrayson opened this issue 9 years ago • 1 comments

In M2/Macaulay2/packages/Macaulay2Doc/overview3.m2 we insert an image into the documentation using the expression

replace("PKG","Style",currentLayout#"package") | "eisenbud.jpg"

. This won't work when installing into the user application directory and running an M2 residing in the build tree, because the layout of the user's application directory may not match the layout of the running M2-binary. Recall that startup.m2.in chooses the layout this way:

     currentLayout = (
      if issuffix(Layout#2#"bin","/"|bindir) then Layout#2 else
      if issuffix(Layout#1#"bin","/"|bindir) then Layout#1
      );

The problem is that the directories listed in prefixPath may have various layouts. Perhaps one should detect the layout dynamically by checking for the presence of a subdirectory called "common" and cache the result (this has now been done on a branch of mine, see https://github.com/DanGrayson/M2/tree/about-and-layout). Notice that the layout is determined by the value of the SeparateExec option of installPackage. If no packages have been installed into the common section, then that directory may not exist.

We should also check the logic of searchPrefixPath in html.m2.

DanGrayson avatar May 10 '16 18:05 DanGrayson

Here's a sample package to try:

newPackage ("T", Headline => "T", AuxiliaryFiles=>true)

beginDocumentation()

document {
     Key => "T",
     IMG { "src" => replace("PKG","T",Layout#1#"package") | "a.jpg", "alt" => "a test" },
     IMG { "src" => replace("PKG","T",currentLayout#"package") | "b.jpg", "alt" => "a test" }
}

DanGrayson avatar May 10 '16 19:05 DanGrayson