aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL6
-rw-r--r--Makefile24
-rw-r--r--README8
-rw-r--r--data/pandoc_markdown.5.template11
-rw-r--r--man/capitalizeHeaders.hs18
-rw-r--r--man/pandoc.1.template (renamed from data/pandoc.1.template)6
-rw-r--r--man/removeLinks.hs9
-rw-r--r--man/removeNotes.hs9
-rw-r--r--pandoc.cabal8
-rw-r--r--pandoc.hs15
-rw-r--r--src/Text/Pandoc/ManPages.hs101
-rw-r--r--src/Text/Pandoc/Writers/ConTeXt.hs4
12 files changed, 55 insertions, 164 deletions
diff --git a/INSTALL b/INSTALL
index 53217beb0..c3c18b154 100644
--- a/INSTALL
+++ b/INSTALL
@@ -75,11 +75,9 @@ Quick install
--extra-include-dirs=/usr/local/Cellar/icu4c/51.1/include \
-funicode_collation text-icu pandoc-citeproc
-To build the `pandoc.1` and `pandoc_markdown.5` man pages, you
-can ues pandoc itself:
+To build the `pandoc.1` man page:
- pandoc --man1 > pandoc.1
- pandoc --man5 > pandoc_markdown.5
+ make man/man1/pandoc.1
To build the `pandoc-citeproc` man pages, go to the pandoc-citeproc
build directory, and
diff --git a/Makefile b/Makefile
index 99675c4e9..a6e4c09f2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,18 +1,17 @@
version=$(shell grep '^Version:' pandoc.cabal | awk '{print $$2;}')
-setup=dist/setup/setup
-PREFIX ?= /usr/local
+pandoc=$(shell find dist -name pandoc -type f -exec ls -t {} \; | head -1)
quick:
cabal configure --enable-tests --disable-optimization
cabal build
full:
- cabal configure --enable-tests --enable-optimization -ftrypandoc -fmake-pandoc-man-pages -fembed_data_files --enable-benchmarks
+ cabal configure --enable-tests --enable-optimization -ftrypandoc -fembed_data_files --enable-benchmarks
cabal build
cabal haddock
deps:
- cabal install --only-dependencies --enable-tests -ftrypandoc -fmake-pandoc-man-pages -fembed_data_files --enable-benchmarks
+ cabal install --only-dependencies --enable-tests -ftrypandoc -fembed_data_files --enable-benchmarks
prof:
cabal configure --enable-library-profiling --enable-executable-profiling --enable-optimization --enable-tests
@@ -28,7 +27,7 @@ install: full
cabal copy
cabal register
-dist: man
+dist:
cabal sdist
rm -rf "pandoc-${version}"
tar xvzf dist/pandoc-${version}.tar.gz
@@ -41,11 +40,14 @@ debpkg:
osxpkg:
./make_osx_package.sh
-%.1: %.1.template README
- ${makemanpages}
-
-%.5: %.5.template README
- ${makemanpages}
+man/man1/pandoc.1: README man/pandoc.1.template
+ @[ -n "$(pandoc)" ] || \
+ (echo "Could not find pandoc in dist/" && exit 1)
+ $(pandoc) $< -t man -s --template man/pandoc.1.template \
+ --filter man/capitalizeHeaders.hs \
+ --filter man/removeNotes.hs \
+ --filter man/removeLinks.hs \
+ -o $@
download_stats:
curl https://api.github.com/repos/jgm/pandoc/releases | \
@@ -53,6 +55,6 @@ download_stats:
clean:
cabal clean
- -rm -rf $(BINDIST) $(BINDIST).tar.gz
+ -rm man/man1/pandoc.1
.PHONY: deps quick full install man clean test bench haddock osxpkg dist bindist prof download_stats
diff --git a/README b/README
index 6e57ee35a..dbeb23df6 100644
--- a/README
+++ b/README
@@ -240,14 +240,6 @@ General options
`epub.css`, `templates`, `slidy`, `slideous`, or `s5` directory
placed in this directory will override pandoc's normal defaults.
-`--man1`
-
-: Write `pandoc.1` man page to *stdout*.
-
-`--man5`
-
-: Write `pandoc_markdown.5` man page to *stdout*.
-
`--verbose`
: Give verbose debugging output. Currently this only has an effect
diff --git a/data/pandoc_markdown.5.template b/data/pandoc_markdown.5.template
deleted file mode 100644
index 6006e90c4..000000000
--- a/data/pandoc_markdown.5.template
+++ /dev/null
@@ -1,11 +0,0 @@
-$if(has-tables)$
-.\"t
-$endif$
-.TH PANDOC_MARKDOWN 5 "$date$" "$version$"
-.SH NAME
-pandoc_markdown - markdown syntax for pandoc(1)
-.SH DESCRIPTION
-$body$
-.SH SEE ALSO
-.PP
-\f[C]pandoc\f[] (1).
diff --git a/man/capitalizeHeaders.hs b/man/capitalizeHeaders.hs
new file mode 100644
index 000000000..d3909df76
--- /dev/null
+++ b/man/capitalizeHeaders.hs
@@ -0,0 +1,18 @@
+import Text.Pandoc.JSON
+import Text.Pandoc.Walk
+import Data.Char (toUpper)
+
+main :: IO ()
+main = toJSONFilter capitalizeHeaders
+
+capitalizeHeaders :: Block -> Block
+capitalizeHeaders (Header 1 attr xs) = Header 1 attr $ walk capitalize xs
+capitalizeHeaders x = walk capitalizeHeaderLinks x
+
+capitalize :: Inline -> Inline
+capitalize (Str xs) = Str $ map toUpper xs
+capitalize x = x
+
+capitalizeHeaderLinks :: Inline -> Inline
+capitalizeHeaderLinks (Link xs t@('#':_,_)) = Link (walk capitalize xs) t
+capitalizeHeaderLinks x = x
diff --git a/data/pandoc.1.template b/man/pandoc.1.template
index adef38bcc..6a1c26a52 100644
--- a/data/pandoc.1.template
+++ b/man/pandoc.1.template
@@ -5,12 +5,6 @@ $endif$
.SH NAME
pandoc - general markup converter
$body$
-.SH PANDOC'S MARKDOWN
-For a complete description of pandoc's extensions to standard markdown,
-see \f[C]pandoc_markdown\f[] (5).
-.SH SEE ALSO
-.PP
-\f[C]pandoc_markdown\f[] (5).
.PP
The Pandoc source code and all documentation may be downloaded
from <http://pandoc.org>.
diff --git a/man/removeLinks.hs b/man/removeLinks.hs
new file mode 100644
index 000000000..d4508e7a3
--- /dev/null
+++ b/man/removeLinks.hs
@@ -0,0 +1,9 @@
+import Text.Pandoc.JSON
+
+main :: IO ()
+main = toJSONFilter removeLinks
+
+removeLinks :: Inline -> [Inline]
+removeLinks (Link l _) = l
+removeLinks x = [x]
+
diff --git a/man/removeNotes.hs b/man/removeNotes.hs
new file mode 100644
index 000000000..e61cb932a
--- /dev/null
+++ b/man/removeNotes.hs
@@ -0,0 +1,9 @@
+import Text.Pandoc.JSON
+
+main :: IO ()
+main = toJSONFilter removeNotes
+
+removeNotes :: Inline -> Inline
+removeNotes (Note _) = Str ""
+removeNotes x = x
+
diff --git a/pandoc.cabal b/pandoc.cabal
index 2a542c4e9..f7f743072 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -1,5 +1,5 @@
Name: pandoc
-Version: 1.14.1
+Version: 1.15
Cabal-Version: >= 1.10
Build-Type: Custom
License: GPL
@@ -106,9 +106,6 @@ Data-Files:
data/sample.lua
-- documentation
README, COPYRIGHT
- -- man page templates
- data/pandoc.1.template
- data/pandoc_markdown.5.template
Extra-Source-Files:
-- documentation
INSTALL, BUGS, CONTRIBUTING.md, changelog
@@ -355,8 +352,7 @@ Library
Text.Pandoc.Templates,
Text.Pandoc.XML,
Text.Pandoc.SelfContained,
- Text.Pandoc.Process,
- Text.Pandoc.ManPages
+ Text.Pandoc.Process
Other-Modules: Text.Pandoc.Readers.Docx.Lists,
Text.Pandoc.Readers.Docx.Reducible,
Text.Pandoc.Readers.Docx.Parse,
diff --git a/pandoc.hs b/pandoc.hs
index 6bc2a024a..df50d01d0 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -39,7 +39,6 @@ import Text.Pandoc.Shared ( tabFilter, readDataFileUTF8, readDataFile,
safeRead, headerShift, normalize, err, warn,
openURL )
import Text.Pandoc.MediaBag ( mediaDirectory, extractMediaBag, MediaBag )
-import Text.Pandoc.ManPages ( manPandoc1, manPandocMarkdown5 )
import Text.Pandoc.XML ( toEntities )
import Text.Pandoc.SelfContained ( makeSelfContained )
import Text.Pandoc.Process (pipeProcess)
@@ -870,20 +869,6 @@ options =
(\opt -> return opt { optIgnoreArgs = True }))
"" -- "Ignore command-line arguments."
- , Option "" ["man1"]
- (NoArg
- (\_ -> do
- manPandoc1 >>= UTF8.hPutStr stdout
- exitWith ExitSuccess ))
- "" -- "Print pandoc.1 man page"
-
- , Option "" ["man5"]
- (NoArg
- (\_ -> do
- manPandocMarkdown5 >>= UTF8.hPutStr stdout
- exitWith ExitSuccess ))
- "" -- "Print pandoc_markdown.5 man page"
-
, Option "" ["verbose"]
(NoArg
(\opt -> return opt { optVerbose = True }))
diff --git a/src/Text/Pandoc/ManPages.hs b/src/Text/Pandoc/ManPages.hs
deleted file mode 100644
index cc5f162f8..000000000
--- a/src/Text/Pandoc/ManPages.hs
+++ /dev/null
@@ -1,101 +0,0 @@
-{-# LANGUAGE CPP #-}
-{-
-Copyright (C) 2013-2015 John MacFarlane <jgm@berkeley.edu>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--}
-
-{- |
- Module : Text.Pandoc.ManPages
- Copyright : Copyright (C) 2013-2015 John MacFarlane
- License : GNU GPL, version 2 or above
-
- Maintainer : John MacFarlane <jgm@berkeley.edu>
- Stability : alpha
- Portability : portable
-
-Functions to build pandoc's man pages (pandoc.1 and pandoc_markdown.5)
-from pandoc's README.
--}
-module Text.Pandoc.ManPages (
- manPandoc1,
- manPandocMarkdown5
- ) where
-import Text.Pandoc
-import Text.Pandoc.Error (handleError)
-import Data.Char (toUpper)
-import System.FilePath
-import Text.Pandoc.Shared (normalize, readDataFileUTF8)
-
-manPandoc1 :: IO String
-manPandoc1 = do
- readme <- readDataFileUTF8 Nothing "README"
- let (Pandoc meta blocks) = normalize $ handleError
- $ readMarkdown def readme
- let manBlocks = removeSect [Str "Wrappers"]
- $ removeSect [Str "Pandoc's",Space,Str "markdown"] blocks
- makeManPage "pandoc.1" meta manBlocks
-
-manPandocMarkdown5 :: IO String
-manPandocMarkdown5 = do
- readme <- readDataFileUTF8 Nothing "README"
- let (Pandoc meta blocks) = normalize $ handleError
- $ readMarkdown def readme
- let syntaxBlocks = extractSect [Str "Pandoc's",Space,Str "markdown"] blocks
- makeManPage "pandoc_markdown.5" meta syntaxBlocks
-
-makeManPage :: String -> Meta -> [Block] -> IO String
-makeManPage page meta blocks = do
- let templ = page <.> "template"
- manTemplate <- readDataFileUTF8 Nothing templ
- return $ writeManPage manTemplate (Pandoc meta blocks)
-
-writeManPage :: String -> Pandoc -> String
-writeManPage templ doc =
- writeMan def{ writerStandalone = True
- , writerTemplate = templ
- , writerVariables = [("version", pandocVersion)] } $
- bottomUp (concatMap removeLinks) $
- bottomUp capitalizeHeaders doc
-
-removeLinks :: Inline -> [Inline]
-removeLinks (Link l _) = l
-removeLinks x = [x]
-
-capitalizeHeaders :: Block -> Block
-capitalizeHeaders (Header 1 attr xs) = Header 1 attr $ bottomUp capitalize xs
-capitalizeHeaders x = x
-
-capitalize :: Inline -> Inline
-capitalize (Str xs) = Str $ map toUpper xs
-capitalize x = x
-
-removeSect :: [Inline] -> [Block] -> [Block]
-removeSect ils (Header 1 _ x:xs) | x == ils =
- dropWhile (not . isHeader1) xs
-removeSect ils (x:xs) = x : removeSect ils xs
-removeSect _ [] = []
-
-extractSect :: [Inline] -> [Block] -> [Block]
-extractSect ils (Header 1 _ z:xs) | z == ils =
- bottomUp promoteHeader $ takeWhile (not . isHeader1) xs
- where promoteHeader (Header n attr x) = Header (n-1) attr x
- promoteHeader x = x
-extractSect ils (_:xs) = extractSect ils xs
-extractSect _ [] = []
-
-isHeader1 :: Block -> Bool
-isHeader1 (Header 1 _ _ ) = True
-isHeader1 _ = False
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs
index 6f45617bb..275fd26e2 100644
--- a/src/Text/Pandoc/Writers/ConTeXt.hs
+++ b/src/Text/Pandoc/Writers/ConTeXt.hs
@@ -156,8 +156,8 @@ blockToConTeXt (Div (ident,_,_) bs) = do
if null ident
then return contents
else return $
- ("\\reference" <> brackets (text $ toLabel ident) <> braces empty)
- $$ contents
+ ("\\reference" <> brackets (text $ toLabel ident) <> braces empty <>
+ "%") $$ contents
blockToConTeXt (BulletList lst) = do
contents <- mapM listItemToConTeXt lst
return $ ("\\startitemize" <> if isTightList lst