~alcinnz/rhapsode

07a0488dd95595c27d0d6dcb8051bba0fbe613e5 — Adrian Cochrane 1 year, 4 months ago 2dc5e4d
Improve Rhapsode's build with newer tools, fix crashes in history infrastructure.
6 files changed, 11 insertions(+), 14 deletions(-)

M about/welcome
M rhapsode.cabal
M src/CExports.hs
M src/SSML.hs
M src/SpeechStyle.hs
M src/Types.hs
M about/welcome => about/welcome +1 -1
@@ 4,7 4,7 @@
  <title>Welcome</title>
</head>
<body>
  <h1>Welcome to <a href="https://rhapsode.adrian.geek.nz/"><strong>Rhapsode</strong></a>!</h1>
  <h1>Welcome to <a href="https://rhapsode-web.org/"><strong>Rhapsode</strong></a>!</h1>
  <p><a href="about:example" title="How do webpages sound?"><em>Hear</em></a> the vast breadth of <strong>
    <a href="https://searchmysite.net/search/browse/" title="SearchMySite.Net catalogue">knowledge</a> &
    <a href="https://adrian.geek.nz/movies" title="Adrian Cochrane's audio show, etc recommendations">entertainment</a>

M rhapsode.cabal => rhapsode.cabal +1 -1
@@ 67,7 67,7 @@ library
        -- Networking
        network-uri, async, hurl >= 2, filepath, temporary,
        -- CSS
        stylist >= 2.4 && <3, stylist-traits >= 0.1.1, css-syntax, scientific,
        stylist >= 2.7.0.1 && <3, stylist-traits >= 0.1.3.1, css-syntax, scientific,
        xml-conduit-stylist >= 3 && <3.1,
        -- Voice2Json input
        process, aeson >= 1.5 && <1.6, unordered-containers

M src/CExports.hs => src/CExports.hs +3 -3
@@ 16,7 16,7 @@ import qualified Data.ByteString.Lazy as B

import           Network.URI
import           Network.URI.Fetch
import           Network.URI.Fetch.XML (fetchDocument, loadVisited)
import           Network.URI.Fetch.XML (fetchDocument, loadVisited, readStrict)

import System.IO
import System.Directory


@@ 147,7 147,7 @@ c_lastVisited def = do
    path <- (</> "history.gmni") <$> getXdgDirectory XdgData "rhapsode"
    exists <- doesFileExist path
    if not exists then return def else do
        file <- readFile path
        case map words $ lines file of
        file <- readStrict path
        case map words $ reverse $ lines file of
            (_:url:_):_ -> newCString url
            _ -> return def

M src/SSML.hs => src/SSML.hs +1 -1
@@ 23,7 23,7 @@ styleToNodes = Prelude.map style . postorder styleToSSML'
styleToSSML' SpeechStyle { speak = False } _ = []
styleToSSML' self@SpeechStyle {content = ""} children = el "prosody" [
        ("xml:lang", lang self),
        ("rhapsode:pseudo", pseudoEl self),
        ("rhapsode:pseudo", pseudoEl' self),
        ("volume", volume self),
        ("rate", rate self),
        ("pitch", pitch2txt <$> pitch self),

M src/SpeechStyle.hs => src/SpeechStyle.hs +3 -3
@@ 38,7 38,7 @@ data SpeechStyle = SpeechStyle {

    content :: Text,
    lang :: Maybe Text,
    pseudoEl :: Maybe Text
    pseudoEl' :: Maybe Text
}

volumes = Txt.words "silent x-soft soft medium loud x-loud"


@@ 70,7 70,7 @@ instance PropertyParser SpeechStyle where

        content = "",
        lang = Nothing,
        pseudoEl = Nothing
        pseudoEl' = Nothing
    }
    inherit _ = temp -- Text synthesizers handle inheritance.



@@ 116,7 116,7 @@ instance PropertyParser SpeechStyle where

    longhand _ self "content" [Ident "initial"] = Just self {content = ""}
    longhand _ self "content" toks = (\v -> self {content = v}) <$> parseStrings toks
    longhand _ self "::" [Ident pseudo] = Just self {pseudoEl = Just pseudo} -- To make sure content doesn't override :before & :after
    longhand _ self "::" [Ident pseudo] = Just self {pseudoEl' = Just pseudo} -- To make sure content doesn't override :before & :after
    longhand _ self "-rhaps-lang" [String v] = Just self {lang = Just v}
    longhand _ _ _ _ = Nothing


M src/Types.hs => src/Types.hs +2 -5
@@ 1,17 1,14 @@
module Types(CArray, Page(..), Application(..), RhapsodeCSS, buildDirFile, readStrict) where
module Types(CArray, Page(..), Application(..), RhapsodeCSS, readStrict) where

import SpeechStyle (SpeechStyle)
import Data.CSS.Preprocessor.Conditions (ConditionalStyles, conditionalStyles)
import Data.CSS.Preprocessor.Text (TextStyle)

import Network.URI.Fetch (Application(..), url)
import Network.URI.Fetch.XML (Page(..), loadVisited, readStrict)
import Network.URI.Fetch.XML (Page(..), readStrict)

import System.FilePath ((</>))
import Foreign.Ptr

buildDir = "."
buildDirFile = (buildDir </>)

type CArray a = Ptr a
type RhapsodeCSS = ConditionalStyles (TextStyle SpeechStyle)