I just finished the directory listing feature and it seems terribly addictive. Let's say you started Novelang HTTP Daemon from
$NOVELANG_HOME
. The
sample
directory is full of samples. Given a URL like
http://localhost:8080/samples
, your browser displays a page listing all Novelang documents, including those in subdirectories.
..
samples/
samples/book.html
samples/broken.html
samples/scanned/
samples/scanned/book.html
samples/scanned/file1.html
samples/scanned/file2.html
samples/scanned/sub/
samples/scanned/sub/file3.html
samples/showcase/
samples/showcase/showcase.html
samples/simple-structure.html
samples/unicode-1.html
All lines are links to subdirectories and documents. There is also a link to the parent directory, while it's not a parent of the content root itself (for security reasons).
For a consistent URL scheme, a directory listing ends with "
/
". In the example above, the browser is forwarded to
http://localhost:8080/samples/
(note the trailing solidus).
There is another trick required by Safari. Safari doesn't take the MIME type of the document in account, just the resource extension. No matter how loud you say "it's HTML, stupid" it tries to download the file instead of displaying the page. So Safari is handled as a special case which is redirected to a URL like
http://localhost:8080/samples/-.html
. Yeah, it sucks. I chose the "
-
" name because it's not a valid filename so it won't conflict with document sources (it's perfectly legal to have a "
index.nlp
" file).
There are many possible improvements:
- Show directories containing no Novelang documents in a dimmed color (not showing them at all could be confusing).
- Add a link to every supported format (first, PDF).
- Add breadcrumbs like
/
> samples
> served
- Add some metadata like number of files and the date of the last modification.
- Display files in the same directory on several columns.
No comments:
Post a Comment