File: FindPandoc.cmake

package info (click to toggle)
spring 88.0%2Bdfsg1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 41,524 kB
  • sloc: cpp: 343,114; ansic: 38,414; python: 12,257; java: 12,203; awk: 5,748; sh: 1,204; xml: 997; perl: 405; objc: 192; makefile: 181; php: 134; sed: 2
file content (50 lines) | stat: -rwxr-xr-x 1,631 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# This file is part of the Spring engine (GPL v2 or later), see LICENSE.html

# - Find Pandoc
# Find the native Pandoc binary
# If you need to convert files from one markup format into another,
# pandoc is your swiss-army knife.
# It can read markdown and (subsets of) reStructuredText, HTML, and LaTeX,
# and it can write markdown, reStructuredText, HTML, LaTeX, ConTeXt,
# Docbook XML, OpenDocument XML, GNU Texinfo, RTF, ODT, MediaWiki markup,
# groff man pages, and S5 HTML slide shows.
# http://johnmacfarlane.net/pandoc/
#
# See Markdown (FindMarkdown.cmake), for a more lightweight utility.
#
#  PANDOC_BIN      - will be set to the Pandoc executable (eg. pandoc.exe)
#  PANDOC_FOUND    - TRUE if Pandoc was found
#  Pandoc_MdToHtml - creates a string that may be executed on the cmd-line
#                    for converting a markdown file to HTML

Include(FindPackageHandleStandardArgs)

If    (PANDOC_BIN)
	# Already in cache, be silent
	Set(Pandoc_FIND_QUIETLY TRUE)
EndIf (PANDOC_BIN)

find_program(PANDOC_BIN
		NAMES pandoc
		HINTS "${MINGWDIR}" "${CMAKE_SOURCE_DIR}/installer"
		PATH_SUFFIXES bin
		DOC "Pandoc executable"
	)

# handle the QUIETLY and REQUIRED arguments and set PANDOC_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Pandoc DEFAULT_MSG PANDOC_BIN)

MARK_AS_ADVANCED(PANDOC_BIN)

If    (PANDOC_FOUND)
	Macro    (Pandoc_MdToHtml var_command fileSrc fileDst title)
		Set("${var_command}"
				"${PANDOC_BIN}"
				--from=markdown
				--to=html
				-s --variable="pagetitle:${title}"
				-o "${fileDst}"
				"${fileSrc}")
	EndMacro (Pandoc_MdToHtml)
EndIf (PANDOC_FOUND)