diff --git a/bbcode.go b/bbcode.go index 4495787..07d4898 100644 --- a/bbcode.go +++ b/bbcode.go @@ -9,6 +9,10 @@ import ( "strings" ) +const ( + bbcodeIsDeleted string = `[delete]` +) + // An embarassing cascade of half-working hacks follows. type BBCodeRenderer struct { baseUrl string diff --git a/rErrors.go b/rErrors.go index e6252cf..2575cd0 100644 --- a/rErrors.go +++ b/rErrors.go @@ -17,6 +17,10 @@ func (this *WikiServer) serveInternalError(w http.ResponseWriter, r *http.Reques http.Error(w, "An internal error occurred. Please ask an administrator to check the log file.", 500) } +func (this *WikiServer) serveDeleted(w http.ResponseWriter, lookingFor string) { + this.serveRedirect(w, this.opts.ExternalBaseURL+"history/"+url.PathEscape(lookingFor)+"?error="+url.QueryEscape(`The page you are looking for has been deleted. However, the history is still available.`)) +} + func (this *WikiServer) serveErrorText(w http.ResponseWriter, msg string) { this.serveRedirect(w, this.opts.ExpectBaseURL+"view/"+url.PathEscape(this.opts.DefaultPage)+"?error="+url.QueryEscape(msg)) } diff --git a/rFormatting.go b/rFormatting.go index 2432c89..28d99e9 100644 --- a/rFormatting.go +++ b/rFormatting.go @@ -35,6 +35,7 @@ func (this *WikiServer) routeFormatting(w http.ResponseWriter, r *http.Request)
  • [section=header]content[/section]
  • [youtube]id[/youtube]
  • [html]raw html[/html]
  • +
  • ` + bbcodeIsDeleted + `
  • ` pto.Content = template.HTML(content) diff --git a/rView.go b/rView.go index fb265e9..c3f3074 100644 --- a/rView.go +++ b/rView.go @@ -26,6 +26,11 @@ func (this *WikiServer) routeView(w http.ResponseWriter, r *http.Request, articl return } + if string(a.Body) == bbcodeIsDeleted { + this.serveDeleted(w, articleTitle) + return + } + pto := DefaultPageTemplateOptions(this.opts) pto.CurrentPageName = articleTitle pto.CurrentPageIsArticle = true