diff --git a/src/Swarm/Game/Achievement/Definitions.hs b/src/Swarm/Game/Achievement/Definitions.hs index 9ae689e7a..37a635843 100644 --- a/src/Swarm/Game/Achievement/Definitions.hs +++ b/src/Swarm/Game/Achievement/Definitions.hs @@ -19,6 +19,8 @@ module Swarm.Game.Achievement.Definitions ( import Data.Aeson import Data.Text (Text) import GHC.Generics (Generic) +import Swarm.Language.Syntax (Syntax) +import Swarm.Language.Text.Markdown (Document) import Swarm.Util -- | How hard do we expect the achievement to be? @@ -39,7 +41,7 @@ data Quotation = Quotation -- | Flavor text to spice up the description of an achievement, either -- freeform text or a quotation. data FlavorText - = Freeform Text + = Freeform (Document Syntax) | FTQuotation Quotation deriving (Eq, Show, Generic, FromJSON, ToJSON) @@ -58,7 +60,7 @@ data AchievementInfo = AchievementInfo -- ^ Explain the reference, e.g. in the form of a full quote -- from a movie, or something you might find -- in a fortune cookie - , attainmentProcess :: Text + , attainmentProcess :: Document Syntax -- ^ Precisely what must be done to obtain this achievement. , effort :: ExpectedEffort -- ^ How hard the achievement is expected to be. diff --git a/src/Swarm/Game/Achievement/Description.hs b/src/Swarm/Game/Achievement/Description.hs index 33c309af9..e3778b044 100644 --- a/src/Swarm/Game/Achievement/Description.hs +++ b/src/Swarm/Game/Achievement/Description.hs @@ -85,6 +85,6 @@ describe = \case "Lil Jon" "Fire up that loud / Another round of shots / Turn down for what?" ) - "'turn down' without a compass. Congratulations, you are 'disoriented'. How are you supposed to move now?" + "`turn down` without a compass. Congratulations, you are \"disoriented\". How are you supposed to move now?" Easy True diff --git a/src/Swarm/TUI/View/Achievement.hs b/src/Swarm/TUI/View/Achievement.hs index fdf8d7910..2c7743298 100644 --- a/src/Swarm/TUI/View/Achievement.hs +++ b/src/Swarm/TUI/View/Achievement.hs @@ -18,6 +18,7 @@ import Swarm.Game.Achievement.Description import Swarm.TUI.Model import Swarm.TUI.Model.UI import Swarm.TUI.View.Attribute.Attr +import Swarm.TUI.View.Util (drawMarkdown) import Text.Wrap padAllEvenly :: Int -> Widget Name -> Widget Name @@ -66,7 +67,7 @@ singleAchievementDetails attainedMap x = wasAttained = M.member x attainedMap renderFlavorTextWidget :: FlavorText -> Widget Name - renderFlavorTextWidget (Freeform t) = txtWrap t + renderFlavorTextWidget (Freeform t) = drawMarkdown t renderFlavorTextWidget (FTQuotation (Quotation author quoteContent)) = vBox [ txtWrap quoteContent @@ -79,10 +80,9 @@ singleAchievementDetails attainedMap x = innerContent = vBox [ maybe emptyWidget (padAllEvenly 2 . renderFlavorTextWidget) $ humorousElaboration details - , txtWrap $ - if wasAttained || not (isObfuscated details) - then attainmentProcess details - else "???" + , if wasAttained || not (isObfuscated details) + then drawMarkdown $ attainmentProcess details + else txt "???" , case M.lookup x attainedMap of Nothing -> emptyWidget Just attainment ->