AutoSite Devlog #2

The good fixes are the short fixes

So, it seems that around the time I released RC1 I did a bunch of reworking with the way Apricot walks through the input page folder. I had noticed that it had started processing files multiple times in the same run. Turns out that had been a borked fix, where I slipped in an extra few lines that ended up repeating what Apricot was to do.

As you can see in this commit of when I fixed it, the mistake was running the walking process for each subfolder.. after all of the files had already been found through a recursive search (.GetFiles(pattern, SearchOption.AllDirectories)). All I had to do was comment out those three lines. It was a rookie mistake.

Unknown file types

I added unknown file extension checking to Apricot, meaning that when you do something like slip an image into the Pages folder it will throw a dialog prompt to make sure that it is indeed a page.

AutoSite Core behavior is just continuing as normal with a warning, which is also displayed in the log in the AutoSite interface if you choose to continue:

The warning nor dialog will show if the file is a dotfile (starts with .) or doesn’t have an extension. The extensions list is this, which is shared with the editor in the AutoSite interface:

txt
md
css
ts
js
html
htm
php
xml
json
csv
lass
sass

Prompt layout improvements

(Ignore the RC1, this is a development build. Next version’s probably RC2.)

The prompt that shows up when a site isn’t open has been around for the longest time, and for the longest time I haven’t been able to get aligned quite right. Now, I’d say it’s pretty alright. Additionally, a new brief description of the Attribute Map has been added when it’s empty. I’ve found it a little difficult to explain what it is to people, so hopefully that’ll aid a bit. Rather pleased with how these came out.

Editor clarifications

For a little bit, I thought of disabling the Preview button for templates, as it only previewed a skeleton of the page without any includes or Apricot support.

In the end I decided to clarify the text a bit instead, and it’s now called “Debug” for templates and just “View” for include files.

A dilemma

I’ve known about this issue with Markdown pages for a good, good while, all throughout the time I had the microblog in fact.

image

What happens here is that the library I use for parsing CommonMark markdown really doesn’t like spaces in paths, so it won’t render it out to an a tag. Initially, I swapped the backslashes for forwardslashes to no avail, and then I swapped spaces for %20 encoded spaces. Which, at first, appeared to work.

If local Then
    newHtml = newHtml.Replace("[#root#]", (siteRoot & "\includes\").Replace(" ", "%20"))   
    content = content.Replace("[#root#]", (siteRoot & "\includes\").Replace(" ", "%20"))
Else
     Dim root = FillString("../", CountCharacter(filename, "\"))
     newHtml = newHtml.Replace("[#root#]", root)
     content = content.Replace("[#root#]", root)
End If
```
The link did render out, but that URL got so encoded that it didn’t go anywhere.

The problem? The encoded spaces messed up the paths used in actual HTML tags for embedding images, stylesheets and whatnot.

I’ve still yet to resolve this, but I’m feeling what could work out is that Apricot could run some RegEx like [.*]\((.*)\) to selectively encode the spaces in the paths that are in Markdown links and images.

Hi while writing this I realized that the problem was really just that I should’ve written a proper file:/// url, cool

…And that means that four issues were closed on this very day. (Or, these two days, since it’s already tomorrow.) Time to rest easy. See you in the next one.

o7

About dotcomboom

Software developer, photographer... blogger...?
This entry was posted in AutoSite, Software and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.