Up to now it was assumed that the raw wiki text would not be written
as Gemtext, but increasingly that is not the case. This commit adds
handling of Gemtext links.
gemini_link now handles URLs and is used for all links in
serve_gemini_page.
Paragraph splits now happen at the beginning of list items and when
line breaks are requested. It's not great but what else are you going
to do?
Handle image links.
Handle HTML tags (by ignoring them).
Raw pages served as text/plain instead of text/markdown.
Makefile now also has a gemini target to start up a gemini wiki. It
also calls openssl to generate keys if necessary.
gemini-server.pl now also has log messages in the various functions
serving content, instead of having some of them in the main function.
The footer is printed in a separate function.
Fixed sorting. Added \r to some of the links. Allow loading
gemini-server.pl as a library. Don't force the display of ten links in
the main menu unless we actually have as many day pages. Change URL
for minor recent changes.
Fixed [URL text] and [[in-reply-to:URL|text]] patterns: don't pass an
URL to gemini_link!
Some log output when writing files. Don't double-decode UTF-8 when
writing text pages.
Render pages ending in '.txt' as raw text. No folding of robots.txt!
Fix two confusing calls to UrlEncode at the end: when serving Gemini
pages and raw text pages, don't URL-encode the page names, use
FreeToNormal to get valid page ids!
Fiddle with the block parsing... Perhaps the single /\n\* / match is
unnecessary? Let's wait for a case where this is wrong. Basically that
would be a paragraph followed immediately by a list item
* like this
I don't think people write it like this when writing for the wiki.
Support the special case <journal search tag:foo> for tag pages.
Fix handling of newlines for blocks that are just links and the like.
No longer wrap paragraphs. In fact, unwrap paragraphs and list items
because that's what the specification says: Each line is to be wrapped
separately.
Allow single line/paragraph comments. This requires the QuestionAsker
extension and supports the questions and answers.
Support in-reply-to links. Support Markdown links.
Sort pages and their comments correctly even if not day pages.
Fix URL-encoding of $id whenever a URL is printed (for redirection
using 30 and 31, for example), and fix normal form (underscores
instead of spaces for $id).
Do not URL-escape the slash.
Reorganize the main menu and add a 'New page' link.
Change the tag format from $id/tag to tag/$id.
Change the naming so that "text page" is now a "raw page" served via
raw/$id.
Only allow editing of raw pages.
Improve transformation of wiki raw text to Gemini format. Handle tags
with alternate text and images.
Add a footer to Gemini format pages.
When editing existing pages, always make it a minor edit. That matches
how I use the wiki as a blog. It might not be correct for a wiki used
as an encyclopedia.
Handle spaces in $id.
Sadly, I would have thought that the correct solution is the
following, at the end, once we have $server:
$server->cgi_init(
sub {
require CGI;
CGI::initialize_globals();
CGI->import(qw(-utf8));
});
This is based on the documentation of HTTP::Server::Simple::CGI, and
skimming its source code, and the documentation of the use pragma, and
the pseudo code in its documentation. The workaround of setting
$CGI::PARAM_UTF8 directly is based on reading the CGI.pm source code.
This is definitely a hack.
Make sure the gopher server reads the config file and skips surge
protection if $SurgeProtection is set to 0. The tests do this. If we
don't do this, tests start failing after a while.
Instead of calling DoSurgeProtection as part of process_request and
faking username and overwriting ReportError, I've moved the essential
code to allow_deny_hook which seems to be the place dedicated to this
sort of code. Sadly, push(@{$self->{server}->{deny}}, $peeraddr) seems
to have no effect. When the next request comes around, the deny list
is empty again. I guess we would have to persist this somehow. For
now, we're simply using allow_deny_hook and that seems to be just as
well.