authoring 0.3.3.1 → 0.3.4
raw patch · 3 files changed
+22/−5 lines, 3 filesdep ~template-haskell
Dependency ranges changed: template-haskell
Files
- authoring.cabal +2/−2
- src/Text/Authoring/Bibliography.hs +13/−2
- src/Text/Authoring/TH.hs +7/−1
authoring.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: authoring-version: 0.3.3.1+version: 0.3.4 synopsis: A library for writing papers description: This package is a combinator library for writing papers. homepage: http://github.com/nushio3/authoring@@ -48,7 +48,7 @@ , mtl , parsers , safe- , template-haskell+ , template-haskell >= 2.9 , text , trifecta , transformers
src/Text/Authoring/Bibliography.hs view
@@ -1,4 +1,4 @@-module Text.Authoring.Bibliography (bibliographyContent, withDatabaseFile) where+module Text.Authoring.Bibliography (bibliographyContent, toBibliographyContent, withDatabaseFile) where import Control.Lens (use) import Control.Monad@@ -10,7 +10,9 @@ import Text.Authoring.State --- | generate the content for the bibliography file.+-- | generate the content of the LaTeX bibliography @.bib@ file.+-- We need 'MonadIO' capability in order to access online +-- literature information. bibliographyContent :: (MonadState s m, HasAuthorState s, HasDatabase s, MonadIO m) => m Text.Text bibliographyContent = do@@ -18,3 +20,12 @@ items <- mapM toBibTeXItem $ Set.toList urls return $ Text.unlines $ items + ++-- | generate the @.bib@ file outside the authoring monad.+toBibliographyContent :: (HasAuthorState s, HasDatabase s, MonadIO m) => + s -> m Text.Text+toBibliographyContent s0 = flip evalStateT s0 $ do+ urls <- use citedUrlSet+ items <- mapM toBibTeXItem $ Set.toList urls+ return $ Text.unlines $ items
src/Text/Authoring/TH.hs view
@@ -25,7 +25,7 @@ -} -module Text.Authoring.TH (rawQ, escQ, declareLabels) where+module Text.Authoring.TH (rawQ, escQ, inputQ, declareLabels) where import Control.Applicative@@ -52,6 +52,7 @@ -- | Quote with LaTeX special characters escaped. escQ = rawQ {quoteExp = parseE (QQConfig { escaper = appE (varE 'esc)})} + -- | Quote without escaping any special characters. rawQ :: QuasiQuoter rawQ = QuasiQuoter { @@ -61,6 +62,11 @@ quoteDec = error "Authoring QuasiQuotes are only for expression context" } +-- | Quote a filename, without escaping any special characters. +inputQ :: QuasiQuoter +inputQ = quoteFile rawQ + + data QQConfig = QQConfig { escaper :: ExpQ -> ExpQ }