msp-strath / Mary

Mary is the successor of Marx, a content delivery and assessment engine based on markdown and git
17 stars 1 forks source link

Relative Links and Pubs #27

Closed pigworker closed 4 years ago

pigworker commented 4 years ago

Now that we can serve pages, we need some basic machinery that isn't especially Shonky-related. We need to build sites where there are multiple pages connected by relative links. Pandoc's Inline type has a constructor for Link, so we need to build a filter which detects which of those links are relative and transforms those which are into links with a different ?page.

Meanwhile, a thing Fred did for Marx which is well worth pinching is that any file in a site under a directory named pub is allowed to be served. The trouble is that Mary repos live in a private filespace, so you can't just give those files a direct url. The trick is to use a wee bit of php to check whether the file is in a pub and if so, fetch and serve it. Probably, we just extend index.php so that the usual Mary url is the contact point, but with a ?pub in $_GET, instead of a ?page. We could then forward the request to Mary with a suitable new command line option which checks the path for the presence of pub and responds accordingly.

Again, relative Link and Image data would need to be mangled appropriately by mary pandoc.

fredrikNordvallForsberg commented 4 years ago

Now that Mary test cases are working properly, we can say with certaintly that this was closed by 9bb5ba6d760372c5ec23a9b254bb6c1b59191f56 (and subsequent commits).