summaryrefslogtreecommitdiffstats
path: root/routers/repo/middlewares.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/middlewares.go')
-rw-r--r--routers/repo/middlewares.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/routers/repo/middlewares.go b/routers/repo/middlewares.go
index 8afad5be64..4dee272edb 100644
--- a/routers/repo/middlewares.go
+++ b/routers/repo/middlewares.go
@@ -50,3 +50,14 @@ func SetDiffViewStyle(ctx *context.Context) {
ctx.ServerError("ErrUpdateDiffViewStyle", err)
}
}
+
+// SetWhitespaceBehavior set whitespace behavior as render variable
+func SetWhitespaceBehavior(ctx *context.Context) {
+ whitespaceBehavior := ctx.Query("whitespace")
+ switch whitespaceBehavior {
+ case "ignore-all", "ignore-eol", "ignore-change":
+ ctx.Data["WhitespaceBehavior"] = whitespaceBehavior
+ default:
+ ctx.Data["WhitespaceBehavior"] = ""
+ }
+}