ODT/OpenDocument writer: Minor changes for ODF 1.2 conformance.
See #939. We leave the nonconforming contextual-spacing attribute, which is provided by LibreOffice itself and seems to be supported.
This commit is contained in:
parent
7b975c2bcc
commit
eb0c0b86ed
5 changed files with 18 additions and 9 deletions
Binary file not shown.
|
@ -1 +1 @@
|
|||
Subproject commit c27f59c010b0468f01b710cdf3a3c04a450a03e7
|
||||
Subproject commit 0cb55f2289148b106ab78ce8f15efc8d0b8acda0
|
|
@ -65,26 +65,30 @@ writeODT opts doc@(Pandoc meta _) = do
|
|||
doc' <- walkM (transformPic opts picEntriesRef) doc
|
||||
let newContents = writeOpenDocument opts{writerWrapText = False} doc'
|
||||
epochtime <- floor `fmap` getPOSIXTime
|
||||
let contentEntry = toEntry "content.xml" epochtime $ fromStringLazy newContents
|
||||
let contentEntry = toEntry "content.xml" epochtime
|
||||
$ fromStringLazy newContents
|
||||
picEntries <- readIORef picEntriesRef
|
||||
let archive = foldr addEntryToArchive refArchive $ contentEntry : picEntries
|
||||
let archive = foldr addEntryToArchive refArchive
|
||||
$ contentEntry : picEntries
|
||||
-- construct META-INF/manifest.xml based on archive
|
||||
let toFileEntry fp = case getMimeType fp of
|
||||
Nothing -> empty
|
||||
Just m -> selfClosingTag "manifest:file-entry"
|
||||
[("manifest:media-type", m)
|
||||
,("manifest:full-path", fp)
|
||||
,("manifest:version", "1.2")
|
||||
]
|
||||
let files = [ ent | ent <- filesInArchive archive, not ("META-INF" `isPrefixOf` ent) ]
|
||||
let files = [ ent | ent <- filesInArchive archive,
|
||||
not ("META-INF" `isPrefixOf` ent) ]
|
||||
let manifestEntry = toEntry "META-INF/manifest.xml" epochtime
|
||||
$ fromStringLazy $ render Nothing
|
||||
$ text "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
|
||||
$$
|
||||
( inTags True "manifest:manifest"
|
||||
[("xmlns:manifest","urn:oasis:names:tc:opendocument:xmlns:manifest:1.0")]
|
||||
[("xmlns:manifest","urn:oasis:names:tc:opendocument:xmlns:manifest:1.0")
|
||||
,("manifest:version","1.2")]
|
||||
$ ( selfClosingTag "manifest:file-entry"
|
||||
[("manifest:media-type","application/vnd.oasis.opendocument.text")
|
||||
,("manifest:version","1.2")
|
||||
,("manifest:full-path","/")]
|
||||
$$ vcat ( map toFileEntry $ files )
|
||||
)
|
||||
|
@ -107,7 +111,11 @@ writeODT opts doc@(Pandoc meta _) = do
|
|||
)
|
||||
)
|
||||
)
|
||||
let archive'' = addEntryToArchive metaEntry archive'
|
||||
-- make sure mimetype is first
|
||||
let mimetypeEntry = toEntry "mimetype" epochtime
|
||||
$ fromStringLazy "application/vnd.oasis.opendocument.text"
|
||||
let archive'' = addEntryToArchive mimetypeEntry
|
||||
$ addEntryToArchive metaEntry archive'
|
||||
return $ fromArchive archive''
|
||||
|
||||
transformPic :: WriterOptions -> IORef [Entry] -> Inline -> IO Inline
|
||||
|
|
|
@ -461,7 +461,8 @@ tableStyle :: Int -> [(Char,Double)] -> Doc
|
|||
tableStyle num wcs =
|
||||
let tableId = "Table" ++ show (num + 1)
|
||||
table = inTags True "style:style"
|
||||
[("style:name", tableId)] $
|
||||
[("style:name", tableId)
|
||||
,("style:family", "table")] $
|
||||
selfClosingTag "style:table-properties"
|
||||
[("table:align" , "center")]
|
||||
colStyle (c,0) = selfClosingTag "style:style"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0">
|
||||
<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.2">
|
||||
<office:automatic-styles>
|
||||
<text:list-style style:name="L1">
|
||||
<text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="1" style:num-suffix=".">
|
||||
|
|
Loading…
Reference in a new issue