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 Aug 11, 2024
1 parent 709e336 commit 73fc6cf
Show file tree
Hide file tree
Showing 3 changed files with 3 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
7 changes: 3 additions & 4 deletions src/Text/Pandoc/Writers/Docx/OpenXML.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import Text.Pandoc.Translations (Term(Abstract), translateTerm)
import Text.Pandoc.MediaBag (lookupMedia, MediaItem(..))
import qualified Text.Pandoc.Translations as Term
import qualified Text.Pandoc.Class.PandocMonad as P
import qualified Text.Pandoc.Builder as B
import Text.Pandoc.UTF8 (fromTextLazy)
import Text.Pandoc.Definition
import Text.Pandoc.Highlighting (highlight)
Expand Down Expand Up @@ -174,8 +175,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 <- B.text <$> translateTerm Term.ListOfFigures :: Inline
title <- withParaPropM (pStyleM "TOC Heading") (blocksToOpenXML opts [Para lofTitle])
return
[mknode "w:sdt" [] [
Expand All @@ -200,8 +200,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 <- B.text <$> translateTerm Term.ListOfTables
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 73fc6cf

Please sign in to comment.