git.iko.soy/typeable/pandoc
on master help sign in
Moved headerShift from pandoc.hs to Shared.
commitcfb27ece34405833592697147276f5bf6418224c authorJohn MacFarlane <jgm@berkeley.edu> dateSun 11 Jul 2010, 20:03 (16 years ago) parent5765ac2
2 files changed+10−7
src/Text/Pandoc/Shared.hs+8 src/pandoc.hs+2−7
src/Text/Pandoc/Shared.hs+8
@@ -62,6 +62,7 @@ module Text.Pandoc.Shared (
6262 hierarchicalize,
6363 uniqueIdent,
6464 isHeaderBlock,
65+ headerShift,
6566 -- * Writer options
6667 HTMLMathMethod (..),
6768 ObfuscationMethod (..),
@@ -439,6 +440,13 @@ isHeaderBlock :: Block -> Bool
439440isHeaderBlock (Header _ _) = True
440441isHeaderBlock _ = False
441442
443+-- | Shift header levels up or down.
444+headerShift :: Int -> Pandoc -> Pandoc
445+headerShift n = processWith shift
446+ where shift :: Block -> Block
447+ shift (Header level inner) = Header (level + n) inner
448+ shift x = x
449+
442450--
443451-- Writer options
444452--
src/pandoc.hs+2−7
@@ -31,7 +31,8 @@ writers.
3131module Main where
3232import Text.Pandoc
3333import Text.Pandoc.Writers.S5 (s5HeaderIncludes)
34−import Text.Pandoc.Shared ( tabFilter, ObfuscationMethod (..), readDataFile )
34+import Text.Pandoc.Shared ( tabFilter, ObfuscationMethod (..), readDataFile,
35+ headerShift )
3536#ifdef _HIGHLIGHTING
3637import Text.Pandoc.Highlighting ( languages )
3738#endif
@@ -127,12 +128,6 @@ writers = [("native" , writeNative)
127128isNonTextOutput :: String -> Bool
128129isNonTextOutput = (`elem` ["odt","epub"])
129130
130−headerShift :: Int -> Pandoc -> Pandoc
131−headerShift n = processWith shift
132− where shift :: Block -> Block
133− shift (Header level inner) = Header (level + n) inner
134− shift x = x
135−
136131-- | Data structure for command line options.
137132data Opt = Opt
138133 { optTabStop :: Int -- ^ Number of spaces per tab