Skip to content

Commit

Permalink
use lofTitle, lotTitle from Translations instead of WriterState
Browse files Browse the repository at this point in the history
  • Loading branch information
acxz committed Jul 31, 2024
1 parent 709e336 commit 24eef74
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
10 changes: 0 additions & 10 deletions src/Text/Pandoc/Writers/Docx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -175,19 175,9 @@ writeDocx opts doc = do
[] -> stTocTitle defaultWriterState
ls -> ls

let lofTitle = case lookupMetaInlines "lof-title" meta of
[] -> stLofTitle defaultWriterState
ls -> ls

let lotTitle = case lookupMetaInlines "lot-title" meta of
[] -> stLotTitle defaultWriterState
ls -> ls

let initialSt = defaultWriterState {
stStyleMaps = styleMaps
, stTocTitle = tocTitle
, stLofTitle = lofTitle
, stLotTitle = lotTitle
, stCurId = 20
}

Expand Down
6 changes: 2 additions & 4 deletions src/Text/Pandoc/Writers/Docx/OpenXML.hs
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 174,7 @@ makeTOC opts = do
makeLOF :: (PandocMonad m) => WriterOptions -> WS m [Element]
makeLOF opts = do
let lofCmd = "TOC \\h \\z \\t \"Image Caption\" \\c" :: Text
lofTitle <- gets stLofTitle
-- Create a separate style for LOF Heading?
lofTitle <- translateTerm Term.ListOfFigures :: Text
title <- withParaPropM (pStyleM "TOC Heading") (blocksToOpenXML opts [Para lofTitle])
return
[mknode "w:sdt" [] [
Expand All @@ -200,8 199,7 @@ makeLOF opts = do
makeLOT :: (PandocMonad m) => WriterOptions -> WS m [Element]
makeLOT opts = do
let lotCmd = "TOC \\h \\z \\t \"Table Caption\" \\c" :: Text
lotTitle <- gets stLotTitle
-- Create a separate style for LOT Heading?
lotTitle <- translateTerm Term.ListOfTables :: Text
title <- withParaPropM (pStyleM "TOC Heading") (blocksToOpenXML opts [Para lotTitle])
return
[mknode "w:sdt" [] [
Expand Down
4 changes: 0 additions & 4 deletions src/Text/Pandoc/Writers/Docx/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 124,6 @@ data WriterState = WriterState{
, stInTable :: Bool
, stInList :: Bool
, stTocTitle :: [Inline]
, stLofTitle :: [Inline]
, stLotTitle :: [Inline]
, stDynamicParaProps :: Set.Set ParaStyleName
, stDynamicTextProps :: Set.Set CharStyleName
, stCurId :: Int
Expand All @@ -150,8 148,6 @@ defaultWriterState = WriterState{
, stInTable = False
, stInList = False
, stTocTitle = [Str "Table of Contents"]
, stLofTitle = [Str "List of Figures"]
, stLotTitle = [Str "List of Tables"]
, stDynamicParaProps = Set.empty
, stDynamicTextProps = Set.empty
, stCurId = 20
Expand Down

0 comments on commit 24eef74

Please sign in to comment.