@@ -183,7 +183,7 @@ data Opt = Opt
183183 , optHtmlQTags :: Bool -- ^ Use <q> tags in HTML
184184 , optHighlight :: Bool -- ^ Highlight source code
185185 , 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
187187 , optHTMLMathMethod :: HTMLMathMethod -- ^ Method to print HTML math
188188 , optReferenceODT :: Maybe FilePath -- ^ Path of reference.odt
189189 , optReferenceDocx :: Maybe FilePath -- ^ Path of reference.docx
@@ -248,7 +248,7 @@ defaultOpts = Opt
248248 , optHtmlQTags = False
249249 , optHighlight = True
250250 , optHighlightStyle = pygments
251− , optChapters = False
251+ , optTopLevelDivision = Section
252252 , optHTMLMathMethod = PlainMath
253253 , optReferenceODT = Nothing
254254 , optReferenceDocx = Nothing
@@ -606,9 +606,19 @@ options =
606606
607607 , Option "" ["chapters"]
608608 (NoArg
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 }))
610612 "" -- "Use chapter for top-level sections in LaTeX, DocBook"
611613
614+ , Option "" ["top-level-division"]
615+ (ReqArg
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"
621+
612622 , Option "N" ["number-sections"]
613623 (NoArg
614624 (\opt -> return opt { optNumberSections = True }))
@@ -1122,7 +1132,7 @@ convertWithOpts opts args = do
11221132 , optHtmlQTags = htmlQTags
11231133 , optHighlight = highlight
11241134 , optHighlightStyle = highlightStyle
1125− , optChapters = chapters
1135+ , optTopLevelDivision = topLevelDivision
11261136 , optHTMLMathMethod = mathMethod'
11271137 , optReferenceODT = referenceODT
11281138 , optReferenceDocx = referenceDocx
@@ -1386,7 +1396,7 @@ convertWithOpts opts args = do
13861396 writerUserDataDir = datadir,
13871397 writerHtml5 = html5,
13881398 writerHtmlQTags = htmlQTags,
1389− writerChapters = chapters,
1399+ writerTopLevelDivision = topLevelDivision,
13901400 writerListings = listings,
13911401 writerBeamer = False,
13921402 writerSlideLevel = slideLevel,