@@ -183,7 +183,7 @@ data Opt = Opt
183 , optHtmlQTags :: Bool -- ^ Use <q> tags in HTML
183 , optHtmlQTags :: Bool -- ^ Use <q> tags in HTML
184 , optHighlight :: Bool -- ^ Highlight source code
184 , optHighlight :: Bool -- ^ Highlight source code
185 , optHighlightStyle :: Style -- ^ Style to use for highlighted code
185 , optHighlightStyle :: Style -- ^ Style to use for highlighted code
186− , optChapters :: Bool -- ^ Use chapter for top-level sects
186+ , optTopLevelDivision :: Division -- ^ Type of the top-level divisions
187 , optHTMLMathMethod :: HTMLMathMethod -- ^ Method to print HTML math
187 , optHTMLMathMethod :: HTMLMathMethod -- ^ Method to print HTML math
188 , optReferenceODT :: Maybe FilePath -- ^ Path of reference.odt
188 , optReferenceODT :: Maybe FilePath -- ^ Path of reference.odt
189 , optReferenceDocx :: Maybe FilePath -- ^ Path of reference.docx
189 , optReferenceDocx :: Maybe FilePath -- ^ Path of reference.docx
@@ -248,7 +248,7 @@ defaultOpts = Opt
248 , optHtmlQTags = False
248 , optHtmlQTags = False
249 , optHighlight = True
249 , optHighlight = True
250 , optHighlightStyle = pygments
250 , optHighlightStyle = pygments
251− , optChapters = False
251+ , optTopLevelDivision = Section
252 , optHTMLMathMethod = PlainMath
252 , optHTMLMathMethod = PlainMath
253 , optReferenceODT = Nothing
253 , optReferenceODT = Nothing
254 , optReferenceDocx = Nothing
254 , optReferenceDocx = Nothing
@@ -606,9 +606,19 @@ options =
607 , Option "" ["chapters"]
607 , Option "" ["chapters"]
609− (\opt -> return opt { optChapters = True }))
609+ (\opt -> do warn $ "--chapters is deprecated. " ++
610+ "Use --top-level-divison=chapter instead."
611+ return opt { optTopLevelDivision = Chapter }))
610 "" -- "Use chapter for top-level sections in LaTeX, DocBook"
612 "" -- "Use chapter for top-level sections in LaTeX, DocBook"
614+ , Option "" ["top-level-division"]
616+ (\arg opt -> case safeRead (uppercaseFirstLetter arg) of
617+ Just dvsn -> return opt { optTopLevelDivision = dvsn }
618+ _ -> err 76 "could not parse top-level division")
619+ "[section|chapter|part]")
620+ "" -- "Use top-level division type in LaTeX, ConTeXt, DocBook"
612 , Option "N" ["number-sections"]
622 , Option "N" ["number-sections"]
614 (\opt -> return opt { optNumberSections = True }))
624 (\opt -> return opt { optNumberSections = True }))
@@ -1122,7 +1132,7 @@ convertWithOpts opts args = do
1122 , optHtmlQTags = htmlQTags
1132 , optHtmlQTags = htmlQTags
1123 , optHighlight = highlight
1133 , optHighlight = highlight
1124 , optHighlightStyle = highlightStyle
1134 , optHighlightStyle = highlightStyle
1125− , optChapters = chapters
1135+ , optTopLevelDivision = topLevelDivision
1126 , optHTMLMathMethod = mathMethod'
1136 , optHTMLMathMethod = mathMethod'
1127 , optReferenceODT = referenceODT
1137 , optReferenceODT = referenceODT
1128 , optReferenceDocx = referenceDocx
1138 , optReferenceDocx = referenceDocx
@@ -1386,7 +1396,7 @@ convertWithOpts opts args = do
1386 writerUserDataDir = datadir,
1396 writerUserDataDir = datadir,
1387 writerHtml5 = html5,
1397 writerHtml5 = html5,
1388 writerHtmlQTags = htmlQTags,
1398 writerHtmlQTags = htmlQTags,
1389− writerChapters = chapters,
1399+ writerTopLevelDivision = topLevelDivision,
1390 writerListings = listings,
1400 writerListings = listings,
1391 writerBeamer = False,
1401 writerBeamer = False,
1392 writerSlideLevel = slideLevel,
1402 writerSlideLevel = slideLevel,