@@ -183,8 +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
187− , optParts :: Bool -- ^ Use parts for top-level sects in latex
186+ , optTopLevelDivision :: Division -- ^ Type of the top-level divisions
188187 , optHTMLMathMethod :: HTMLMathMethod -- ^ Method to print HTML math
189188 , optReferenceODT :: Maybe FilePath -- ^ Path of reference.odt
190189 , optReferenceDocx :: Maybe FilePath -- ^ Path of reference.docx
@@ -249,8 +248,7 @@ defaultOpts = Opt
249248 , optHtmlQTags = False
250249 , optHighlight = True
251250 , optHighlightStyle = pygments
252− , optChapters = False
253− , optParts = False
251+ , optTopLevelDivision = Section
254252 , optHTMLMathMethod = PlainMath
255253 , optReferenceODT = Nothing
256254 , optReferenceDocx = Nothing
@@ -608,13 +606,18 @@ options =
608606
609607 , Option "" ["chapters"]
610608 (NoArg
611− (\opt -> return opt { optChapters = True }))
609+ (\opt -> do warn $ "--chapters is deprecated. " ++
610+ "Use --top-level-divison=chapter instead."
611+ return opt { optTopLevelDivision = Chapter }))
612612 "" -- "Use chapter for top-level sections in LaTeX, DocBook"
613613
614− , Option "" ["parts"]
615− (NoArg
616− (\opt -> return opt { optParts = True }))
617− "" -- "Use part for top-level sections in LaTeX"
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"
618621
619622 , Option "N" ["number-sections"]
620623 (NoArg
@@ -1129,9 +1132,8 @@ convertWithOpts opts args = do
11291132 , optHtmlQTags = htmlQTags
11301133 , optHighlight = highlight
11311134 , optHighlightStyle = highlightStyle
1132− , optChapters = chapters
1135+ , optTopLevelDivision = topLevelDivision
11331136 , optHTMLMathMethod = mathMethod'
1134− , optParts = parts
11351137 , optReferenceODT = referenceODT
11361138 , optReferenceDocx = referenceDocx
11371139 , optEpubStylesheet = epubStylesheet
@@ -1394,8 +1396,7 @@ convertWithOpts opts args = do
13941396 writerUserDataDir = datadir,
13951397 writerHtml5 = html5,
13961398 writerHtmlQTags = htmlQTags,
1397− writerChapters = chapters,
1398− writerParts = parts,
1399+ writerTopLevelDivision = topLevelDivision,
13991400 writerListings = listings,
14001401 writerBeamer = False,
14011402 writerSlideLevel = slideLevel,