love2d-community / love-api

The whole LÖVE wiki in a Lua table.
http://love2d-community.github.io/love-api/
300 stars 48 forks source link

Making the reference work well offline #72

Closed hahawoo closed 1 year ago

hahawoo commented 6 years ago

I think it would be good if the API reference worked well offline. There are two issues I can see:

1: The page uses an image. If the page is saved from a browser, the image will be saved with the HTML file in a folder. I think it would be better if there was just a single HTML page to download, and the image was embedded. My data-url-embedder could help with this.

2: If the page is saved from Chrome using "Save as..." the links on the page will link to the URLs on GitHub making them unusable, i.e. the link to "#callbacks" becomes "https://love2d-community.github.io/love-api/#callbacks". If the page is saved from right clicking on a link to it, or by finding the HTML file on GitHub, then the links are fine, but the menu is unusable because the image is missing. I can think of two solutions to this:

1: Have a download link on the page to itself, and embed the image.

2: Change the links using JavaScript by putting this code at end of the body:

<script>
var a = document.getElementsByTagName('a');
for (var i = 0; i < a.length; i++) {
    a[i].href = a[i].href.replace("https://love2d-community.github.io/love-api/", "");
}
</script>
hahawoo commented 5 years ago

The absolute URL issue can be resolved by saving the page as "Webpage, HTML Only" instead of "Webpage, Complete".

MikuAuahDark commented 1 year ago

Image is now embedded as data url.