From b08c8627d30fdaf991fdff1fd7f3d674b356a976 Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Thu, 24 Jan 2019 16:21:57 -0800
Subject: [PATCH] Allow some command line options to take URL in addition to
 FILE.

`--include-in-header`, `--include-before-body`, `--include-after-body`
---
 MANUAL.txt                            | 6 +++---
 src/Text/Pandoc/App/OutputSettings.hs | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/MANUAL.txt b/MANUAL.txt
index 9d26c61fa..4f800a409 100644
--- a/MANUAL.txt
+++ b/MANUAL.txt
@@ -798,7 +798,7 @@ General writer options {.options}
     new languages or to use altered syntax definitions for
     existing languages.
 
-`-H` *FILE*, `--include-in-header=`*FILE*
+`-H` *FILE*, `--include-in-header=`*FILE*|*URL*
 
 :   Include contents of *FILE*, verbatim, at the end of the header.
     This can be used, for example, to include special
@@ -806,7 +806,7 @@ General writer options {.options}
     repeatedly to include multiple files in the header.  They will be
     included in the order specified.  Implies `--standalone`.
 
-`-B` *FILE*, `--include-before-body=`*FILE*
+`-B` *FILE*, `--include-before-body=`*FILE*|*URL*
 
 :   Include contents of *FILE*, verbatim, at the beginning of the
     document body (e.g. after the `<body>` tag in HTML, or the
@@ -815,7 +815,7 @@ General writer options {.options}
     used repeatedly to include multiple files. They will be included in
     the order specified.  Implies `--standalone`.
 
-`-A` *FILE*, `--include-after-body=`*FILE*
+`-A` *FILE*, `--include-after-body=`*FILE*|*URL*
 
 :   Include contents of *FILE*, verbatim, at the end of the document
     body (before the `</body>` tag in HTML, or the
diff --git a/src/Text/Pandoc/App/OutputSettings.hs b/src/Text/Pandoc/App/OutputSettings.hs
index b4bd9a4b2..0f4923ea4 100644
--- a/src/Text/Pandoc/App/OutputSettings.hs
+++ b/src/Text/Pandoc/App/OutputSettings.hs
@@ -128,8 +128,8 @@ optToOutputSettings opts = do
       withList f (x:xs) vars = f x vars >>= withList f xs
 
   let addContentsAsVariable varname fp vars = do
-             s <- UTF8.toString <$> readFileStrict fp
-             return $ (varname, s) : vars
+        s <- UTF8.toString . fst <$> fetchItem fp
+        return $ (varname, s) : vars
 
   variables <-
     withList (addStringAsVariable "sourcefile")