From ca1e83f5048de3d9f7c7e22e5016c3b1017e1dd2 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Thu, 24 May 2018 22:42:01 +0000 Subject: [PATCH] Apply basic style to make commit diffs look a bit less very ugly --- src/Vervis/Widget/Repo.hs | 1 + templates/repo/patch.cassius | 17 +++++++++++++++ templates/repo/patch.hamlet | 8 ++++---- templates/repo/widget/inline-diff.cassius | 25 +++++++++++++++++++++++ templates/repo/widget/inline-diff.hamlet | 16 ++++++++------- 5 files changed, 56 insertions(+), 11 deletions(-) create mode 100644 templates/repo/patch.cassius create mode 100644 templates/repo/widget/inline-diff.cassius diff --git a/src/Vervis/Widget/Repo.hs b/src/Vervis/Widget/Repo.hs index 1b5b51b..f844bac 100644 --- a/src/Vervis/Widget/Repo.hs +++ b/src/Vervis/Widget/Repo.hs @@ -38,6 +38,7 @@ import Vervis.Foundation import Vervis.Model.Ident import Vervis.Patch (Hunk (..)) import Vervis.Settings (widgetFile, appDiffContextLines) +import Vervis.Style refSelectW :: ShrIdent -> RpIdent -> Set Text -> Set Text -> Widget refSelectW shar repo branches tags = $(widgetFile "repo/widget/ref-select") diff --git a/templates/repo/patch.cassius b/templates/repo/patch.cassius new file mode 100644 index 0000000..7fe1882 --- /dev/null +++ b/templates/repo/patch.cassius @@ -0,0 +1,17 @@ +/* This file is part of Vervis. + * + * Written in 2018 by fr33domlover . + * + * ♡ Copying is an act of love. Please copy, reuse and share. + * + * The author(s) have dedicated all copyright and related and neighboring + * rights to this software to the public domain worldwide. This software is + * distributed without any warranty. + * + * You should have received a copy of the CC0 Public Domain Dedication along + * with this software. If not, see + * . + */ + +.lines + font-family: monospace diff --git a/templates/repo/patch.hamlet b/templates/repo/patch.hamlet index 6fcb479..3a1c93e 100644 --- a/templates/repo/patch.hamlet +++ b/templates/repo/patch.hamlet @@ -38,7 +38,7 @@ $if null parents $case edit $of AddTextFile path mode lines

Add file #{path} #{mode} - +
$forall (n, t) <- number lines
+ @@ -48,7 +48,7 @@ $if null parents

Add binary file #{path} #{mode} #{size} $of RemoveTextFile path mode lines

Remove file #{path} #{mode} - +
$forall (n, t) <- number lines
- @@ -69,7 +69,7 @@ $if null parents #{newSize} #{newMode} $of TextToBinary path lines oldMode newSize newMode

Edit file #{path} #{oldMode} → #{newSize} #{newMode} - +
$forall (n, t) <- number lines
- @@ -77,7 +77,7 @@ $if null parents #{t} $of BinaryToText path oldSize oldMode lines newMode

Edit file #{path} #{oldMode} #{oldSize} → #{newMode} - +
$forall (n, t) <- number lines
+ diff --git a/templates/repo/widget/inline-diff.cassius b/templates/repo/widget/inline-diff.cassius new file mode 100644 index 0000000..03a0407 --- /dev/null +++ b/templates/repo/widget/inline-diff.cassius @@ -0,0 +1,25 @@ +/* This file is part of Vervis. + * + * Written in 2018 by fr33domlover . + * + * ♡ Copying is an act of love. Please copy, reuse and share. + * + * The author(s) have dedicated all copyright and related and neighboring + * rights to this software to the public domain worldwide. This software is + * distributed without any warranty. + * + * You should have received a copy of the CC0 Public Domain Dedication along + * with this software. If not, see + * . + */ + +.lines + font-family: monospace + +.remove + background: #{light red} + color: #{dark red} + +.add + background: #{light green} + color: #{dark green} diff --git a/templates/repo/widget/inline-diff.hamlet b/templates/repo/widget/inline-diff.hamlet index c946969..2b78b20 100644 --- a/templates/repo/widget/inline-diff.hamlet +++ b/templates/repo/widget/inline-diff.hamlet @@ -12,24 +12,26 @@ $# You should have received a copy of the CC0 Public Domain Dedication along $# with this software. If not, see $# . - +
$forall lines <- diffs $forall (ln, t) <- lines - - $case ln - $of Old n + $case ln + $of Old n +
- #{n} - $of New n + $of New n +
+ #{n} - $of Both o n + $of Both o n +
#{o} #{n} - #{t} + #{t}