In OpenHtmlEnvironment we simplyfy the regular expression that is
supposed to detect whether this is a class assignment to a simple
check whether the attribute contains an equal sign.
Trying to get more HTML5 elements used.
PrintAllPages:
Use the article element instead of a div with class "page". The new
article element still has the "h-entry" class that the old div had.
The h1 element for these pages used to have the class "entry-title"
which is apparently deprecated. The new code now uses the "p-name"
attribute.
The page content is no longer surrounded in a div with the
"entry-content" class and the appropriate lang attribute. We rely on
PrintPageHtml to do the right thing, now.
PrintPageHtml:
Surround the page being printed with a div containing the "e-content"
class and an appropriate lang attribute.
PageHtml:
This also uses PrintPageHtml and therefore doesn't need to surround
the page content with a div containing the "page" class and the lang
attribute.
As PageHtml is used in RSS feed generation, that means that the feed
entries now don't have a div containing the "page" class but a div
containing the "e-content" class.
GetHeaderDiv:
Instead of using a div with the "header" class, use the header
element.
Instead of using a div with the "menu" class, use the nav element.
PrintPageContent:
No changes! We're not changing the div here because the content that
is being printed here does not belong into an article element. It is
not "a self-contained composition in a … page … intended to be
independently distributable or reusable" – it *is* the page
itself (without the h1 header).
PrintFooter:
Use an additional footer element.
DefaultFooter:
Remove the div with the "footer" class.
References:
* http://microformats.org/wiki/h-entry
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/header
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/nav
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/article
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/footer
When serving recent changes, we know the username and host of the
person making the edit. We use GetAuthorLink to show either the name
linked to the username, or "Anonymous", or a colour coded bogus hash
of their host (that's the four octal digits, hopefully colourized by
your CSS).
When serving raw changes, we used to serve just the username or
"Anonymous". In order to help use cases such as the Gemini wiki
running on gemini://alexschroeder.ch:1965 which consumes raw changes
to present a view that is compatible with Gemini Wiki, we'd like those
bogus hashes as well. This comit does that by splitting ColorCode into
Code and ColorCode such that we can use Code when serving raw changes.
The benefit is that this allows us to use the CSS rule that allows the
browser to hyphenate words:
body { hyphens: auto }
This required a number of changes.
wiki.pl
- new option, $CurrentLanguage
- GetHtmlHeader adds lang attribute to body
- PrintAllPages adds lang attribute to div
- PrintPageContent adds lang attribute to div
- PageHtml adds div with lang attribute
- GetLanguages sorts languages by occurences
- GetLanguage is new and returns the first language of GetLanguages
Modules that had to be changed because they refer to the divs that
have now been changed:
- crossbar.pl
Tests that had to be changed:
- atom.t
- crossbar.t
- hr.t
- languages.t
- portrait-support.t
- rss.t
Frank Betten noted about the old code "$Now - Modified($fname) < 0.5"
that the "left-hand side is in seconds, right-hand side in days".
This was fixed by replacing 0.5 with 12 * 60 * 60.
On Journal pages, add the classes h-feed for the entire feed, h-entry
for a single page, entry-title for the header, and entry-content for
the page content.
This works without changes to journal-rss.pl itself. All we do is make
sure that RcSelfAction, RcPreviousAction, and RcLastAction don't get
the action (rc vs. rss) from their arguments but determine it by
looking at the script parameters. Since journal-rss simply uses the
journal action, this will then get picked up correctly.
Move search up in the list of actions so that it takes precedence over
match if both parameters are provided and add matching to the Filtered
function so that it is taken into account when searching.
Two changes: First, when moving entries from rc.log to oldrc.log, make
sure we use the string "Anonymous" for the host instead of translating
it. Second, when printing the author link using GetAuthorLink, don't
call ColorCode for anonymous authors if the IP number has been replaced
by the string "Anonymous". In this case, just return "Anonymous".
Otherwise we're getting the color code of the string "Anonymous" which
is confusing.
Removing IP number ("host") from page files and keep files. The IP
numbers remain in the RC file. GetAuthor and GetAuthorLink now take
username as a first argument and host as an optional second argument.
Sorry for the incompatible change.
The search fields at the top were shortened such that they all fit on
one line when all of them are shown (set %Languages and $MatchingPages
to show them all), on a terminal 80 characters wide, using a text
browser like Lynx or w3m.
Trying a different solution. The existing solution only worked for
relative paths in $DataDir. Now we check whether $DataDir starts with /
or ./ and only prepend a ./ if it does not.
This is why all the tests requiring t/test.pl had to be changed.
Similarly, the main script loads config and modules using the same
mechanism and paths had to be similarly qualified: prepending './'.
There was a bug where showing the non-existing comment page for an
existing page: BrowseResolvedPage used to return BrowsePage($id,
GetParam('raw', 0), undef, '404 NOT FOUND') and we wanted to change
this to a 200 response and so we returned BrowsePage($resolved,
GetParam('raw', 0)); -- but that is wrong because in this situation
$id is defined and $resolved is not! This commit fixes the problem.
If $CommentsPattern is a regular expression that matches without
setting $1, we want to avoid the “Use of uninitialized value $1 in
hash element” warning.
This reverts commit 1ee235c949.
Sadly, I discovered that my websites no longer correctly displayed pages
containing characters such as the EN DASH. Reverting this commit seems
to solve the problem.
On a new server with Debian Jessie (8), Apache 2.4, Perl 5.25.1 and
CGI 4.28 I'm getting double-decoded page names. An Umlaut will thus
turn into an undisplayable character (a questionmark in a black
diamond). Decoding of path_info was necessary on my old server with
Debian Wheezy (7), Apache 2.2, Perl 5.14.2 and CGI 3.52.
If you're still in the unfortunate situation, you can copy the old
implementation of GetId into your config file:
sub GetId {
my $id = UnquoteHtml(GetParam('id', GetParam('title', ''))); # id=x or title=x -> x
if (not $id and $q->keywords) {
$id = decode_utf8(join('_', $q->keywords)); # script?p+q -> p_q
}
if ($UsePathInfo and $q->path_info) {
my @path = map { decode_utf8($_) } split(/\//, $q->path_info);
$id ||= pop(@path); # script/p/q -> q
foreach my $p (@path) {
SetParam($p, 1); # script/p/q -> p=1
}
}
return $id;
}