aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-11-12 12:36:06 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-11-12 12:37:20 -0800
commit83b1aa042d72cdb7790eec1de5d86bf2bded60db (patch)
tree29897420342dd25d5c7e4b04b973bfa1372dde39 /src
parent64b32e1e8194644df37a115200f929a9553c6d16 (diff)
downloadpandoc-83b1aa042d72cdb7790eec1de5d86bf2bded60db.tar.gz
LaTeX writer: set `colorlinks`...
if `linkcolor`, `urlcolor`, `citecolor`, or `toccolor` is set. Closes #2508.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index f23b06d02..e9a2e0a56 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -41,7 +41,7 @@ import Network.URI ( isURI, unEscapeString )
import Data.Aeson (object, (.=))
import Data.List ( (\\), isInfixOf, stripPrefix, intercalate, intersperse, nub, nubBy )
import Data.Char ( toLower, isPunctuation, isAscii, isLetter, isDigit, ord )
-import Data.Maybe ( fromMaybe )
+import Data.Maybe ( fromMaybe, isJust )
import qualified Data.Text as T
import Control.Applicative ((<|>))
import Control.Monad.State
@@ -146,6 +146,7 @@ pandocToLaTeX options (Pandoc meta blocks) = do
titleMeta <- stringToLaTeX TextString $ stringify $ docTitle meta
authorsMeta <- mapM (stringToLaTeX TextString . stringify) $ docAuthors meta
let docLangs = nub $ query (extract "lang") blocks
+ let hasStringValue x = isJust (getField x metadata :: Maybe String)
let context = defField "toc" (writerTableOfContents options) $
defField "toc-depth" (show (writerTOCDepth options -
if stBook st
@@ -183,6 +184,8 @@ pandocToLaTeX options (Pandoc meta blocks) = do
-- set lang to something so polyglossia/babel is included
defField "lang" (if null docLangs then ""::String else "en") $
defField "otherlangs" docLangs $
+ defField "colorlinks" (any hasStringValue
+ ["citecolor", "urlcolor", "linkcolor", "toccolor"]) $
defField "dir" (if (null $ query (extract "dir") blocks)
then ""::String
else "ltr") $