summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasperVanDerJeugt <>2018-10-26 21:37:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2018-10-26 21:37:00 (GMT)
commit03e6c48b68575298ace3dbafa66b21e5e1b905ba (patch)
tree7a3cd7170d486bd0956b87e03d79e9f423e3af3f
parent3cbe9ae3b90ae58516b32f24fd017dbeea769592 (diff)
version 0.8.1.10.8.1.1
-rw-r--r--CHANGELOG.md7
-rw-r--r--README.md19
-rw-r--r--patat.cabal2
-rw-r--r--src/Patat/Presentation/Display.hs11
-rw-r--r--src/Patat/Theme.hs5
5 files changed, 28 insertions, 16 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a56f551..6039473 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
# Changelog
+- 0.8.1.1 (2018-10-26)
+ * Tickle CircleCI cache
+
+- 0.8.1.0 (2018-10-26)
+ * Add support for italic ansi code in themes
+ * Fix centered titles not being centered (contribution by Hamza Haiken)
+
- 0.8.0.0 (2018-08-31)
* Themed border rendering improvements (contribution by Hamza Haiken)
* Add support for margins (contribution by Hamza Haiken)
diff --git a/README.md b/README.md
index df27b38..86d0208 100644
--- a/README.md
+++ b/README.md
@@ -431,7 +431,8 @@ title: 'This is a test'
patat:
wrap: true
theme:
- emph: [vividBlue, onVividBlack, bold]
+ emph: [vividBlue, onVividBlack, italic]
+ strong: [bold]
imageTarget: [onDullWhite, vividRed]
...
@@ -451,13 +452,13 @@ The properties that can be given a list of styles are:
The accepted styles are:
-`bold`, `dullBlack`, `dullBlue`, `dullCyan`, `dullGreen`, `dullMagenta`,
-`dullRed`, `dullWhite`, `dullYellow`, `onDullBlack`, `onDullBlue`, `onDullCyan`,
-`onDullGreen`, `onDullMagenta`, `onDullRed`, `onDullWhite`, `onDullYellow`,
-`onVividBlack`, `onVividBlue`, `onVividCyan`, `onVividGreen`, `onVividMagenta`,
-`onVividRed`, `onVividWhite`, `onVividYellow`, `underline`, `vividBlack`,
-`vividBlue`, `vividCyan`, `vividGreen`, `vividMagenta`, `vividRed`,
-`vividWhite`, `vividYellow`
+`bold`, `italic`, `dullBlack`, `dullBlue`, `dullCyan`, `dullGreen`,
+`dullMagenta`, `dullRed`, `dullWhite`, `dullYellow`, `onDullBlack`,
+`onDullBlue`, `onDullCyan`, `onDullGreen`, `onDullMagenta`, `onDullRed`,
+`onDullWhite`, `onDullYellow`, `onVividBlack`, `onVividBlue`, `onVividCyan`,
+`onVividGreen`, `onVividMagenta`, `onVividRed`, `onVividWhite`, `onVividYellow`,
+`underline`, `vividBlack`, `vividBlue`, `vividCyan`, `vividGreen`,
+`vividMagenta`, `vividRed`, `vividWhite`, `vividYellow`
Also accepted are styles of the form `rgb#RrGgBb` and `onRgb#RrGgBb`, where `Rr`
`Gg` and `Bb` are hexadecimal bytes (e.g. `rgb#f08000` for an orange foreground,
@@ -470,7 +471,7 @@ presentations, it might be better to stick with the named colours listed above.
As part of theming, syntax highlighting is also configurable. This can be
configured like this:
-```
+```markdown
---
patat:
theme:
diff --git a/patat.cabal b/patat.cabal
index aa93723..acd3459 100644
--- a/patat.cabal
+++ b/patat.cabal
@@ -1,5 +1,5 @@
Name: patat
-Version: 0.8.0.0
+Version: 0.8.1.1
Synopsis: Terminal-based presentations using Pandoc
Description: Terminal-based presentations using Pandoc
License: GPL-2
diff --git a/src/Patat/Presentation/Display.hs b/src/Patat/Presentation/Display.hs
index f73d6a9..4e42c70 100644
--- a/src/Patat/Presentation/Display.hs
+++ b/src/Patat/Presentation/Display.hs
@@ -110,11 +110,12 @@ displayPresentation mbImages pres@Presentation {..} =
prettyFragment theme fragment
Just (ActiveTitle block) ->
displayWithBorders pres $ \canvasSize theme ->
- let pblock = prettyBlock theme block
- (prows, pcols) = PP.dimensions pblock
- offsetRow = (csRows canvasSize `div` 2) - (prows `div` 2)
- offsetCol = (csCols canvasSize `div` 2) - (pcols `div` 2)
- spaces = PP.NotTrimmable $ PP.spaces offsetCol in
+ let pblock = prettyBlock theme block
+ (prows, pcols) = PP.dimensions pblock
+ (mLeft, mRight) = marginsOf pSettings
+ offsetRow = (csRows canvasSize `div` 2) - (prows `div` 2)
+ offsetCol = ((csCols canvasSize - mLeft - mRight) `div` 2) - (pcols `div` 2)
+ spaces = PP.NotTrimmable $ PP.spaces offsetCol in
mconcat (replicate (offsetRow - 3) PP.hardline) <$$>
PP.indent spaces spaces pblock
diff --git a/src/Patat/Theme.hs b/src/Patat/Theme.hs
index a49b5fb..952a521 100644
--- a/src/Patat/Theme.hs
+++ b/src/Patat/Theme.hs
@@ -200,6 +200,8 @@ sgrToString (Ansi.SetUnderlining Ansi.SingleUnderline) = Just "underline"
sgrToString (Ansi.SetConsoleIntensity Ansi.BoldIntensity) = Just "bold"
+sgrToString (Ansi.SetItalicized True) = Just "italic"
+
sgrToString (Ansi.SetRGBColor layer color) = Just $
(\str -> case layer of
Ansi.Foreground -> str
@@ -231,7 +233,8 @@ namedSgrs = M.fromList
, c <- [minBound .. maxBound]
] ++
[Ansi.SetUnderlining u | u <- [minBound .. maxBound]] ++
- [Ansi.SetConsoleIntensity c | c <- [minBound .. maxBound]]
+ [Ansi.SetConsoleIntensity c | c <- [minBound .. maxBound]] ++
+ [Ansi.SetItalicized i | i <- [minBound .. maxBound]]
--------------------------------------------------------------------------------