There are a couple of interesting places you could look if you're trying to control the ~/ expansion.
One thing you can do is reconfigure the location of those resources. The idea is for production release you can control where individual assets or entire directories of assets are located. It's described a bit here:
http://sparkviewengine.com/documentation/configuring#SparksettingsinconfigfileIf you want deeper control of the url mapping, you can replace the SiteResource method that's on the base view's class. You can do that by changing the base page type to a class from your project, and inheriting the original one. The default implementation is this:
public string SiteResource(string path)
{
return ResourcePathManager.GetResourcePath(SiteRoot, path);
}
So another thing you could do is replace the IResourcePathManager service with one of your own.
The urls which can be treated as possible urls are hardcoded in the UrlAttributeVisitor. They're more or less anything from the html spec that was a uri.
http://dev.dejardin.org/trac/spark/browser/trunk/src/Spark/Compiler/NodeVisitors/UrlAttributeVisitor.cs
Anyway that UrlAttributeVisitor is a pretty good example of how the contents of the spark files are manipulated in stages as it goes from a bunch of file streams and ends up as a compiled view type.
If you **really** want to dive in and alter what's going on you can replace the syntax provider. The default is here, which you would probably copy as a starting point:
http://dev.dejardin.org/trac/spark/browser/trunk/src/Spark/Parser/Syntax/DefaultSyntaxProvider.cs
The method
GetChunks walks through the meat of the work being done. The line "var result = _grammar.Nodes(position);" is the recursive descent parser that's turning the file-stream into an array of nodes, and the "
foreach (var visitor in BuildNodeVisitors(context)) ...
visitor.Accept(nodes);" is what's giving all of the individual features and special elements and attributes a chance to take effect.
Now that you mention it - if the BuildNodeVisitors was virtual replacing the syntax provider with a subclass that simply adds a few more node visitors would probably be much easier and more future-proof.