pandoc 3.1.11 → 3.1.11.1
raw patch · 71 files changed
+769/−513 lines, 71 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
Files
- AUTHORS.md +1/−0
- MANUAL.txt +1/−1
- changelog.md +70/−0
- data/docx/word/document.xml +1/−3
- data/docx/word/settings.xml +4/−4
- data/docx/word/styles.xml +6/−6
- data/templates/default.html5 +0/−3
- data/templates/default.opendocument +0/−3
- pandoc.cabal +1/−1
- src/Text/Pandoc/Chunks.hs +12/−7
- src/Text/Pandoc/PDF.hs +99/−18
- src/Text/Pandoc/Readers/Docx/Fields.hs +1/−1
- src/Text/Pandoc/Readers/Docx/Parse.hs +5/−0
- src/Text/Pandoc/Readers/MediaWiki.hs +2/−1
- src/Text/Pandoc/Readers/Org/Blocks.hs +29/−20
- src/Text/Pandoc/Writers/Docx.hs +172/−45
- src/Text/Pandoc/Writers/Docx/Table.hs +25/−22
- src/Text/Pandoc/Writers/LaTeX.hs +9/−8
- src/Text/Pandoc/Writers/LaTeX/Citation.hs +29/−7
- src/Text/Pandoc/Writers/LaTeX/Types.hs +3/−0
- src/Text/Pandoc/Writers/Markdown.hs +8/−5
- src/Text/Pandoc/Writers/ODT.hs +79/−17
- src/Text/Pandoc/Writers/OPML.hs +8/−3
- src/Text/Pandoc/Writers/OpenDocument.hs +2/−26
- test/Tests/Writers/OOXML.hs +6/−0
- test/command/6792.md +0/−95
- test/command/8256.md +0/−95
- test/command/9275.md +18/−0
- test/command/9279.md +131/−0
- test/command/9293.md +29/−0
- test/docx/golden/block_quotes.docx binary
- test/docx/golden/codeblock.docx binary
- test/docx/golden/comments.docx binary
- test/docx/golden/custom_style_no_reference.docx binary
- test/docx/golden/custom_style_preserve.docx binary
- test/docx/golden/custom_style_reference.docx binary
- test/docx/golden/definition_list.docx binary
- test/docx/golden/document-properties-short-desc.docx binary
- test/docx/golden/document-properties.docx binary
- test/docx/golden/headers.docx binary
- test/docx/golden/image.docx binary
- test/docx/golden/inline_code.docx binary
- test/docx/golden/inline_formatting.docx binary
- test/docx/golden/inline_images.docx binary
- test/docx/golden/link_in_notes.docx binary
- test/docx/golden/links.docx binary
- test/docx/golden/lists.docx binary
- test/docx/golden/lists_continuing.docx binary
- test/docx/golden/lists_div_bullets.docx binary
- test/docx/golden/lists_multiple_initial.docx binary
- test/docx/golden/lists_restarting.docx binary
- test/docx/golden/nested_anchors_in_header.docx binary
- test/docx/golden/notes.docx binary
- test/docx/golden/raw-blocks.docx binary
- test/docx/golden/raw-bookmarks.docx binary
- test/docx/golden/table_one_row.docx binary
- test/docx/golden/table_with_list_cell.docx binary
- test/docx/golden/tables-default-widths.docx binary
- test/docx/golden/tables.docx binary
- test/docx/golden/tables_separated_with_rawblock.docx binary
- test/docx/golden/track_changes_deletion.docx binary
- test/docx/golden/track_changes_insertion.docx binary
- test/docx/golden/track_changes_move.docx binary
- test/docx/golden/track_changes_scrubbed_metadata.docx binary
- test/docx/golden/unicode.docx binary
- test/docx/golden/verbatim_subsuper.docx binary
- test/lhs-test.html +0/−3
- test/lhs-test.html+lhs +0/−3
- test/writer.html5 +0/−3
- test/writer.opendocument +0/−95
- test/writer.opml +18/−18
@@ -99,6 +99,7 @@ - Dmitry Pogodin - Dmitry Volodin - Douglas Calvert+- Edwin Török - Eigil Rischel - Elliot Bobrow - Emanuel Evans
@@ -1,7 +1,7 @@ --- title: Pandoc User's Guide author: John MacFarlane-date: December 15, 2023+date: January 5, 2024 --- # Synopsis
@@ -1,5 +1,75 @@ # Revision history for pandoc +## pandoc 3.1.11.1 (2023-01-05)++ * Docx reader:++ + Fix HYPERLINK with only switch and no argument (#9246).++ * Org reader:++ + Parse caption and label for grid tables (#9279).++ * MediaWiki reader:++ + Handle multiline math in list items (#9293).++ * OPML writer:++ + Respect `--wrap` options & `--columns` in contents of notes (#9297).++ * ODT/OpenDocument writers:++ + Properly handle highlighting styles (#9287). These styles were+ going into an `office:styles` element in `content.xml`, but this+ is invalid. Instead they must go in `styles.xml`. The variable+ `highlighting-styles` no longer has any effect on the default+ opendocument template, and highlighting styles are not included+ in `opendocument` output.++ * Markdown writer:++ + Add table identifier at end of caption if present (#9279).++ * Text.Pandoc.PDF:++ + Expand list of environment variables to display in verbose output+ (#9303).+ + Ensure that we find all the LaTeX warnings requiring a rerun (#9284).+ This should fix a regression from 3.1.9 that led to incorrect+ alignments in tables (and possibly other issues).++ * Docx writer:++ + Ensure that pandoc's output validates (Edwin Török, #9273, #9269,+ John MacFarlane, #9265, #9266, #9264).+ + Don't emit empty table rows, which seem to cause problems for+ Word (#9224).++ * LaTeX writer:++ + Omit superfluous page locator label when used with `--natbib` or+ `--biblatex` (#9275). These will treat a bare number as a+ page locator, and they will be able to localize it. Note that the+ recognition of the locator label is locale-sensitive; if `lang` is+ `de`, then `S. 33` is a page reference, and `p. 33` is not!++ * Text.Pandoc.Chunks: Fine tune `makeChunks` (#9281).++ + Ensure that chunks not based on sections (those with the+ "preamble" class) get unique identifiers, by appending chunk number.+ + This will also ensure that they get unique path names when+ the path is generated from the identifier.++ * Default HTML5 template: remove html5shiv (and support for IE < 9).++ * Makefile:++ + Fix `make quick-stack`: `j` was expecting a number (Edwin Török).+ + Run built pandoc (instead of pandoc in path).+ + Add `validate-epub` target, using `epubcheck` to test the golden files.+ + Add `validate-docx-golden-tests` target.+ ## pandoc 3.1.11 (2023-12-15) * Typst writer:
@@ -52,7 +52,6 @@ </w:p> <w:p> <w:pPr>- <w:pStyle w:val="Compact" /> <w:pStyle w:val="Abstract" /> </w:pPr> <w:r>@@ -266,14 +265,13 @@ <w:tbl> <w:tblPr> <w:tblStyle w:val="Table" />- <w:tblW w:type="pct" w:w="0.0" /> <w:tblLook w:firstRow="1" /> <w:tblCaption w:val="Table caption." /> </w:tblPr> <w:tblGrid /> <w:tr> <w:trPr>- <w:cnfStyle w:firstRow="1" />+ <w:cnfStyle w:firstRow="1" w:val="100000000000" /> </w:trPr> <w:tc> <w:tcPr>
@@ -4,10 +4,6 @@ <w:embedSystemFonts /> <w:proofState w:spelling="clean" w:grammar="clean" /> <w:stylePaneFormatFilter w:val="0004" />- <w:footnotePr>- <w:footnote w:id="-1" />- <w:footnote w:id="0" />- </w:footnotePr> <w:doNotTrackMoves /> <w:defaultTabStop w:val="720" /> <w:drawingGridHorizontalSpacing w:val="360" />@@ -16,6 +12,10 @@ <w:displayVerticalDrawingGridEvery w:val="0" /> <w:characterSpacingControl w:val="doNotCompress" /> <w:savePreviewPicture />+ <w:footnotePr>+ <w:footnote w:id="-1" />+ <w:footnote w:id="0" />+ </w:footnotePr> <w:rsids> </w:rsids> <m:mathPr>
@@ -24,10 +24,10 @@ <w:name w:val="Body Text" /> <w:basedOn w:val="Normal" /> <w:link w:val="BodyTextChar" />+ <w:qFormat /> <w:pPr> <w:spacing w:before="180" w:after="180" /> </w:pPr>- <w:qFormat /> </w:style> <w:style w:type="paragraph" w:customStyle="1" w:styleId="FirstParagraph"> <w:name w:val="First Paragraph" />@@ -107,14 +107,14 @@ <w:pPr> <w:keepNext /> <w:keepLines />- <w:jc w:val="center" /> <w:spacing w:before="300" w:after="0" />+ <w:jc w:val="center" /> </w:pPr> <w:rPr>+ <w:b />+ <w:color w:val="345A8A" /> <w:sz w:val="20" /> <w:szCs w:val="20" />- <w:b />- <w:color w:val="345A8A" />> </w:rPr> </w:style> <w:style w:type="paragraph" w:customStyle="1" w:styleId="Abstract">@@ -220,8 +220,8 @@ </w:pPr> <w:rPr> <w:rFonts w:asciiTheme="majorHAnsi" w:eastAsiaTheme="majorEastAsia" w:hAnsiTheme="majorHAnsi" w:cstheme="majorBidi" />- <w:i /> <w:bCs />+ <w:i /> <w:color w:val="4F81BD" w:themeColor="accent1" /> <w:sz w:val="24" /> <w:szCs w:val="24" />@@ -389,10 +389,10 @@ <w:jc w:val="left"/> </w:trPr> <w:tcPr>- <w:vAlign w:val="bottom"/> <w:tcBorders> <w:bottom w:val="single"/> </w:tcBorders>+ <w:vAlign w:val="bottom"/> </w:tcPr> </w:tblStylePr> </w:style>
@@ -32,9 +32,6 @@ $endif$ $math$ $endif$- <!--[if lt IE 9]>- <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>- <![endif]--> </head> <body> $for(include-before)$
@@ -3,9 +3,6 @@ <office:font-face-decls> <style:font-face style:name="Courier New" style:font-family-generic="modern" style:font-pitch="fixed" svg:font-family="'Courier New'" /> </office:font-face-decls>- <office:styles>- $highlighting-styles$- </office:styles> <office:automatic-styles> $automatic-styles$ </office:automatic-styles>
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: pandoc-version: 3.1.11+version: 3.1.11.1 build-type: Simple license: GPL-2.0-or-later license-file: COPYING.md
@@ -28,7 +28,8 @@ ) where import Text.Pandoc.Definition-import Text.Pandoc.Shared (makeSections, stringify, inlineListToIdentifier)+import Text.Pandoc.Shared (makeSections, stringify, inlineListToIdentifier,+ tshow) import Text.Pandoc.Walk (Walkable(..)) import Data.Aeson (FromJSON, ToJSON) import Data.Text (Text)@@ -204,22 +205,26 @@ divid (fromMaybe "" secnum) toChunk chunknum (Div ("",["preamble"],[]) bs) =- Chunk+ Chunk { chunkHeading = docTitle meta- , chunkId = inlineListToIdentifier mempty $ docTitle meta+ , chunkId = chunkid , chunkLevel = 0 , chunkNumber = chunknum , chunkSectionNumber = Nothing- , chunkPath = resolvePathTemplate pathTemplate chunknum- (stringify (docTitle meta))- (inlineListToIdentifier mempty (docTitle meta))- "0"+ , chunkPath = chunkpath , chunkUp = Nothing , chunkPrev = Nothing , chunkNext = Nothing , chunkUnlisted = False , chunkContents = bs }+ where+ chunkpath = resolvePathTemplate pathTemplate chunknum+ (stringify (docTitle meta))+ chunkid+ "0"+ chunkid = inlineListToIdentifier mempty (docTitle meta) <>+ "-" <> tshow chunknum toChunk _ b = error $ "toChunk called on inappropriate block " <> show b -- should not happen
@@ -425,18 +425,23 @@ logContents <- if logExists then readFileLazy logFile else return mempty- needsRerun <- checkForRerun logContents- if needsRerun && runNumber < 3- then go file env'' programArgs (runNumber + 1)+ let rerunWarnings = checkForRerun logContents+ if not (null rerunWarnings) && runNumber < 3+ then do+ report $ MakePDFInfo "Rerun needed"+ (T.intercalate "\n"+ (map (UTF8.toText . BC.toStrict) rerunWarnings))+ go file env'' programArgs (runNumber + 1) else do let pdfFile = replaceExtension file ".pdf" (log', pdf) <- getResultingPDF (Just logFile) pdfFile return (exit, fromMaybe out log', pdf) - checkForRerun log' = pure $ any isRerunWarning $ BC.lines log'+ checkForRerun log' = filter isRerunWarning $ BC.lines log' - isRerunWarning ln = BC.isPrefixOf "LaTeX Warning:" ln &&- BS.isInfixOf "Rerun to" (BL.toStrict ln)+ isRerunWarning ln =+ let ln' = BL.toStrict ln+ in BS.isInfixOf "Warning:" ln' && BS.isInfixOf "Rerun" ln' generic2pdf :: (PandocMonad m, MonadIO m) => String@@ -542,19 +547,95 @@ report $ MakePDFInfo "Command line:" (T.pack program <> " " <> T.pack (unwords (map show programArgs))) -- we filter out irrelevant stuff to avoid leaking passwords and keys!- let isRelevant ("PATH",_) = True- isRelevant ("TMPDIR",_) = True- isRelevant ("PWD",_) = True- isRelevant ("LANG",_) = True- isRelevant ("HOME",_) = True- isRelevant ("LUA_PATH",_) = True- isRelevant ("LUA_CPATH",_) = True- isRelevant ("SHELL",_) = True- isRelevant ("TEXINPUTS",_) = True- isRelevant ("TEXMFOUTPUT",_) = True- isRelevant _ = False+ let isRelevant e = (e `elem` [ "PKFONTS"+ , "AFMFONTS"+ , "BIBINPUTS"+ , "BLTXMLINPUTS"+ , "BSTINPUTS"+ , "CLUAINPUTS"+ , "CMAPFONTS"+ , "CWEBINPUTS"+ , "DVIPSHEADERS"+ , "ENCFONTS"+ , "FONTCIDMAPS"+ , "FONTFEATURES"+ , "GFFONTS"+ , "GLYPHFONTS"+ , "HOME"+ , "INDEXSTYLE"+ , "KPATHSEA_DEBUG"+ , "KPATHSEA_WARNING"+ , "LANG"+ , "LIGFONTS"+ , "LUAINPUTS"+ , "LUA_CPATH"+ , "LUA_PATH"+ , "MFBASES"+ , "MFINPUTS"+ , "MFPOOL"+ , "MFTINPUTS"+ , "MISCFONTS"+ , "MISSFONT_LOG"+ , "MLBIBINPUTS"+ , "MLBSTINPUTS"+ , "MPINPUTS"+ , "MPMEMS"+ , "MPPOOL"+ , "MPSUPPORT"+ , "OCPINPUTS"+ , "OFMFONTS"+ , "OPENTYPEFONTS"+ , "OPLFONTS"+ , "OTPINPUTS"+ , "OVFFONTS"+ , "OVPFONTS"+ , "PATH"+ , "PDFTEXCONFIG"+ , "PROGRAMFONTS"+ , "PSHEADERS"+ , "PWD"+ , "RISINPUTS"+ , "SELFAUTODIR"+ , "SELFAUTOLOC"+ , "SELFAUTOPARENT"+ , "SFDFONTS"+ , "SHELL"+ , "T1FONTS"+ , "T1INPUTS"+ , "T42FONTS"+ , "TEXBIB"+ , "TEXCONFIG"+ , "TEXDOCS"+ , "TEXFONTMAPS"+ , "TEXFONTS"+ , "TEXFORMATS"+ , "TEXINDEXSTYLE"+ , "TEXINPUTS"+ , "TEXMFCNF"+ , "TEXMFDBS"+ , "TEXMFINI"+ , "TEXMFSCRIPTS"+ , "TEXMFVAR"+ , "TEXPICTS"+ , "TEXPKS"+ , "TEXPOOL"+ , "TEXPSHEADERS"+ , "TEXSOURCES"+ , "TEX_HUSH"+ , "TFMFONTS"+ , "TMPDIR"+ , "TRFONTS"+ , "TTFONTS"+ , "USERPROFILE"+ , "USE_TEXMFVAR"+ , "USE_VARTEXFONTS"+ , "VARTEXFONTS"+ , "VFFONTS"+ , "WEB2C"+ , "WEBINPUTS"+ ]) || "TEXMF" `isPrefixOf` e report $ MakePDFInfo "Relevant environment variables:"- (T.intercalate "\n" $ map tshow $ filter isRelevant env)+ (T.intercalate "\n" $ map tshow $ filter (isRelevant . fst) env) report $ MakePDFInfo "Source:" source handlePDFProgramNotFound :: String -> IE.IOError -> IO a
@@ -110,7 +110,7 @@ many space string "HYPERLINK" spaces- farg <- fieldArgument+ farg <- option "" $ notFollowedBy (char '\\') *> fieldArgument switches <- spaces *> many hyperlinkSwitch let url = case switches of ("\\l", s) : _ -> farg <> "#" <> s
@@ -56,6 +56,7 @@ , constructBogusParStyleData , leftBiasedMergeRunStyle , rowsToRowspans+ , extractTarget ) where import Text.Pandoc.Readers.Docx.Parse.Styles import Codec.Archive.Zip@@ -537,6 +538,10 @@ T.stripPrefix frontOfFp $ T.dropWhile (== '/') target return $ Relationship relType relId target' relElemToRelationship _ _ _ = Nothing++extractTarget :: Element -> Maybe Target+extractTarget element = do (Relationship _ _ target) <- relElemToRelationship "word/" InDocument element+ return target filePathToRelationships :: Archive -> FilePath -> FilePath -> [Relationship] filePathToRelationships ar docXmlPath fp
@@ -502,8 +502,9 @@ -- }} -- * next list item -- which seems to be valid mediawiki.+-- Also multiline math: see #9293. listChunk :: PandocMonad m => MWParser m Text-listChunk = template <|> countChar 1 anyChar+listChunk = template <|> (snd <$> withRaw math) <|> countChar 1 anyChar listItem' :: PandocMonad m => Char -> MWParser m Blocks listItem' c = try $ do
@@ -26,7 +26,7 @@ import Text.Pandoc.Readers.Org.Shared (cleanLinkText, isImageFilename, originalLang, translateLang, exportsCode) -import Text.Pandoc.Builder (Blocks, Inlines)+import Text.Pandoc.Builder (Blocks, Inlines, Many(..)) import Text.Pandoc.Class.PandocMonad (PandocMonad) import Text.Pandoc.Definition import Text.Pandoc.Options@@ -41,6 +41,7 @@ import Data.Text (Text) import Data.List.NonEmpty (nonEmpty) import System.FilePath+import qualified Data.Foldable as F import qualified Data.Text as T import qualified Text.Pandoc.Builder as B import qualified Text.Pandoc.Walk as Walk@@ -631,38 +632,46 @@ } table :: PandocMonad m => OrgParser m (F Blocks)-table = do- withTables <- getExportSetting exportWithTables- tbl <- gridTableWith blocks <|> orgTable- return $ if withTables then tbl else mempty---- | A normal org table-orgTable :: PandocMonad m => OrgParser m (F Blocks)-orgTable = try $ do+table = try $ do -- don't allow a table on the first line of a list item; org requires that -- tables start at first non-space character on the line let isFirstInListItem st = orgStateParserContext st == ListItemState && isNothing (orgStateLastPreCharPos st) guard . not . isFirstInListItem =<< getState blockAttrs <- blockAttributes+ let identMb = blockAttrName blockAttrs+ tbl <- gridTableWith blocks <|> orgTable+ withTables <- getExportSetting exportWithTables+ return $ if withTables+ then do+ xs <- unMany <$> tbl+ case F.toList xs of+ [Table _ _ cs th tb tf] -> do+ capt <- case blockAttrCaption blockAttrs of+ Nothing -> pure $ Caption Nothing []+ Just ils -> do+ ils' <- ils+ pure $ B.simpleCaption . B.plain $ ils'+ let attr = (fromMaybe mempty identMb, [],+ blockAttrKeyValues blockAttrs)+ pure $ B.tableWith attr capt cs th tb tf+ _ -> tbl -- should not happen+ else mempty++-- | A normal org table+orgTable :: PandocMonad m => OrgParser m (F Blocks)+orgTable = do lookAhead tableStart rows <- tableRows-- let caption = fromMaybe mempty (blockAttrCaption blockAttrs) let orgTbl = normalizeTable <$> rowsToTable rows- let identMb = blockAttrName blockAttrs- let attr = (fromMaybe mempty identMb, [], blockAttrKeyValues blockAttrs)- return $ orgToPandocTable attr <$> orgTbl <*> caption+ return $ orgToPandocTable <$> orgTbl -orgToPandocTable :: Attr- -> OrgTable- -> Inlines- -> Blocks-orgToPandocTable attr (OrgTable colProps heads lns) caption =+orgToPandocTable :: OrgTable -> Blocks+orgToPandocTable (OrgTable colProps heads lns) = let totalWidth = if any (isJust . columnRelWidth) colProps then Just . sum $ map (fromMaybe 1 . columnRelWidth) colProps else Nothing- in B.tableWith attr (B.simpleCaption $ B.plain caption)+ in B.tableWith nullAttr (Caption Nothing mempty) (map (convertColProp totalWidth) colProps) (TableHead nullAttr $ toHeaderRow heads) [TableBody nullAttr 0 [] $ map toRow lns]
@@ -28,7 +28,7 @@ toEntry, Entry(eRelativePath) ) import Control.Applicative ((<|>))-import Control.Monad (MonadPlus(mplus), unless, when)+import Control.Monad (MonadPlus(mplus), unless, when, foldM) import Control.Monad.Except (catchError, throwError) import Control.Monad.Reader ( asks, MonadReader(local), MonadTrans(lift), ReaderT(runReaderT) )@@ -36,7 +36,8 @@ import qualified Data.ByteString.Lazy as BL import Data.Containers.ListUtils (nubOrd) import Data.Char (isSpace, isLetter)-import Data.List (intercalate, isPrefixOf, isSuffixOf)+import Data.List (intercalate, isPrefixOf, isSuffixOf, sortBy)+import Data.Ord (comparing) import Data.String (fromString) import qualified Data.Map as M import Data.Maybe (fromMaybe, isNothing, mapMaybe, maybeToList, isJust)@@ -63,6 +64,7 @@ import Text.Pandoc.Logging import Text.Pandoc.MIME (extensionFromMimeType, getMimeType, getMimeTypeDef) import Text.Pandoc.Options+import Text.Pandoc.Readers.Docx.Parse (extractTarget) import Text.Pandoc.Writers.Docx.StyleMap import Text.Pandoc.Writers.Docx.Table as Table import Text.Pandoc.Writers.Docx.Types@@ -77,9 +79,63 @@ import Data.Generics (mkT, everywhere) import Text.Collate.Lang (renderLang, Lang(..)) +-- from wml.xsd EG_RPrBase+rPrTagOrder :: M.Map Text Int+rPrTagOrder =+ M.fromList+ (zip [ "rStyle"+ , "rFonts"+ , "b"+ , "bCs"+ , "i"+ , "iCs"+ , "caps"+ , "smallCaps"+ , "strike"+ , "dstrike"+ , "outline"+ , "shadow"+ , "emboss"+ , "imprint"+ , "noProof"+ , "snapToGrid"+ , "vanish"+ , "webHidden"+ , "color"+ , "spacing"+ , "w"+ , "kern"+ , "position"+ , "sz"+ , "szCs"+ , "highlight"+ , "u"+ , "effect"+ , "bdr"+ , "shd"+ , "fitText"+ , "vertAlign"+ , "rtl"+ , "cs"+ , "em"+ , "lang"+ , "eastAsianLayout"+ , "specVanish"+ , "oMath"+ ] [0..])++sortSquashed :: [Element] -> [Element]+sortSquashed l =+ sortBy (comparing tagIndex) l+ where+ tagIndex :: Element -> Int+ tagIndex el =+ fromMaybe 0 (M.lookup tag rPrTagOrder)+ where tag = (qName . elName) el+ squashProps :: EnvProps -> [Element]-squashProps (EnvProps Nothing es) = es-squashProps (EnvProps (Just e) es) = e : es+squashProps (EnvProps Nothing es) = sortSquashed es+squashProps (EnvProps (Just e) es) = sortSquashed (e : es) renumIdMap :: Int -> [Element] -> M.Map Text Text renumIdMap _ [] = M.empty@@ -255,8 +311,6 @@ let headers = filterElements isHeaderNode parsedRels let footers = filterElements isFooterNode parsedRels - let extractTarget = findAttr (QName "Target" Nothing Nothing)- -- we create [Content_Types].xml and word/_rels/document.xml.rels -- from scratch rather than reading from reference.docx, -- because Word sometimes changes these files when a reference.docx is modified,@@ -508,30 +562,104 @@ -- adds references to footnotes or endnotes we don't have... -- we do, however, copy some settings over from reference let settingsPath = "word/settings.xml"- settingsList = [ "zoom"- , "mirrorMargins"++ settingsEntry <- copyChildren refArchive distArchive settingsPath epochtime+ -- note: these must go in the following order:+ [ "writeProtection"+ , "view"+ , "zoom"+ , "removePersonalInformation"+ , "removeDateAndTime"+ , "doNotDisplayPageBoundaries"+ , "displayBackgroundShape"+ , "printPostScriptOverText"+ , "printFractionalCharacterWidth"+ , "printFormsData"+ , "embedTrueTypeFonts" , "embedSystemFonts"+ , "saveSubsetFonts"+ , "saveFormsData"+ , "mirrorMargins"+ , "alignBordersAndEdges"+ , "bordersDoNotSurroundHeader"+ , "bordersDoNotSurroundFooter"+ , "gutterAtTop"+ , "hideSpellingErrors"+ , "hideGrammaticalErrors"+ , "activeWritingStyle"+ , "proofState"+ , "formsDesign"+ , "attachedTemplate"+ , "linkStyles"+ , "stylePaneFormatFilter"+ , "stylePaneSortMethod"+ , "documentType"+ , "mailMerge"+ , "revisionView"+ , "trackRevisions" , "doNotTrackMoves"+ , "doNotTrackFormatting"+ , "documentProtection"+ , "autoFormatOverride"+ , "styleLockTheme"+ , "styleLockQFSet" , "defaultTabStop"+ , "autoHyphenation"+ , "consecutiveHyphenLimit"+ , "hyphenationZone"+ , "doNotHyphenateCaps"+ , "showEnvelope"+ , "summaryLength"+ , "clickAndTypeStyle"+ , "defaultTableStyle"+ , "evenAndOddHeaders"+ , "bookFoldRevPrinting"+ , "bookFoldPrinting"+ , "bookFoldPrintingSheets" , "drawingGridHorizontalSpacing" , "drawingGridVerticalSpacing" , "displayHorizontalDrawingGridEvery" , "displayVerticalDrawingGridEvery"+ , "doNotUseMarginsForDrawingGridOrigin"+ , "drawingGridHorizontalOrigin"+ , "drawingGridVerticalOrigin"+ , "doNotShadeFormData"+ , "noPunctuationKerning" , "characterSpacingControl"+ , "printTwoOnOne"+ , "strictFirstAndLastChars"+ , "noLineBreaksAfter"+ , "noLineBreaksBefore" , "savePreviewPicture"- , "mathPr"+ , "doNotValidateAgainstSchema"+ , "saveInvalidXml"+ , "ignoreMixedContent"+ , "alwaysShowPlaceholderText"+ , "doNotDemarcateInvalidXml"+ , "saveXmlDataOnly"+ , "useXSLTWhenSaving"+ , "saveThroughXslt"+ , "showXMLTags"+ , "alwaysMergeEmptyNamespace"+ , "updateFields"+ , "hdrShapeDefaults"+ , "footnotePr"+ , "compat"+ , "docVars"+ , "rsids"+ , "attachedSchema" , "themeFontLang"+ , "clrSchemeMapping"+ , "doNotIncludeSubdocsInStats"+ , "doNotAutoCompressPictures"+ , "forceUpgrade"+ , "captions"+ , "readModeInkLockDown"+ , "smartTagType"+ , "shapeDefaults"+ , "doNotEmbedSmartTags" , "decimalSymbol"- , "listSeparator"- , "autoHyphenation"- , "consecutiveHyphenLimit"- , "hyphenationZone"- , "doNotHyphenateCap"- , "evenAndOddHeaders"- , "proofState"- , "compat"- ]- settingsEntry <- copyChildren refArchive distArchive settingsPath epochtime settingsList+ , "listSeparator" ] let entryFromArchive arch path = maybe (throwError $ PandocSomeError@@ -604,14 +732,14 @@ [ mknode "w:name" [("w:val", tshow toktype)] () , mknode "w:basedOn" [("w:val","VerbatimChar")] () , mknode "w:rPr" [] $+ [ mknode "w:b" [] () | tokFeature tokenBold toktype ] +++ [ mknode "w:i" [] () | tokFeature tokenItalic toktype ] ++ [ mknode "w:color" [("w:val", tokCol toktype)] () | tokCol toktype /= "auto" ] +++ [ mknode "w:u" [] () | tokFeature tokenUnderline toktype ] ++ [ mknode "w:shd" [("w:val","clear") ,("w:fill",tokBg toktype)] ()- | tokBg toktype /= "auto" ] ++- [ mknode "w:b" [] () | tokFeature tokenBold toktype ] ++- [ mknode "w:i" [] () | tokFeature tokenItalic toktype ] ++- [ mknode "w:u" [] () | tokFeature tokenUnderline toktype ]+ | tokBg toktype /= "auto" ] ] tokStyles = tokenStyles style tokFeature f toktype = maybe False f $ M.lookup toktype tokStyles@@ -639,17 +767,17 @@ copyChildren refArchive distArchive path timestamp elNames = do ref <- parseXml refArchive distArchive path dist <- parseXml distArchive distArchive path- let elsToCopy =- map cleanElem $ filterChildrenName (\e -> qName e `elem` elNames) ref- let elsToKeep =- [e | Elem e <- elContent dist, not (any (hasSameNameAs e) elsToCopy)]- return $ toEntry path timestamp $ renderXml dist{- elContent = map Elem elsToKeep ++ map Elem elsToCopy- }+ els <- foldM (addEl ref dist) [] (reverse elNames)+ return $ toEntry path timestamp+ $ renderXml dist{ elContent = map cleanElem els } where- hasSameNameAs (Element {elName = n1}) (Element {elName = n2}) =- qName n1 == qName n2- cleanElem el@Element{elName=name} = el{elName=name{qURI=Nothing}}+ addEl ref dist els name =+ case filterChildName (hasName name) ref `mplus`+ filterChildName (hasName name) dist of+ Just el -> pure (el : els)+ Nothing -> pure els+ hasName name = (== name) . qName+ cleanElem el@Element{elName=name} = Elem el{elName=name{qURI=Nothing}} -- this is the lowest number used for a list numId baseListId :: Int@@ -678,7 +806,7 @@ mkAbstractNum :: ListMarker -> Element mkAbstractNum marker = mknode "w:abstractNum" [("w:abstractNumId",listMarkerToId marker)]- $ mknode "w:nsid" [("w:val", "A" <> listMarkerToId marker)] ()+ $ mknode "w:nsid" [("w:val", T.justifyRight 8 '0' ("A" <> listMarkerToId marker))] () : mknode "w:multiLevelType" [("w:val","multilevel")] () : map (mkLvl marker) [0..maxListLevel]@@ -810,8 +938,8 @@ , mknode "w:r" [] [ mknode "w:rPr" [] [ mknode "w:rStyle" [("w:val", "CommentReference")] ()- , mknode "w:annotationRef" [] () ]+ , mknode "w:annotationRef" [] () ] ] ++ annotation ]@@ -1063,18 +1191,17 @@ map blockToCell blks let tbl = mknode "w:tbl" [] ( mknode "w:tblPr" []- ( mknode "w:tblStyle" [("w:val","FigureTable")] () :- mknode "w:tblW" [ ("w:type", "auto"), ("w:w", "0") ] () :+ [ mknode "w:tblStyle" [("w:val","FigureTable")] (),+ mknode "w:tblW" [ ("w:type", "auto"), ("w:w", "0") ] (),+ mknode "w:jc" [("w:val","center")] (), mknode "w:tblLook" [ ("w:firstRow", "0") , ("w:lastRow", "0") , ("w:firstColumn", "0") , ("w:lastColumn", "0")- ] () :- mknode "w:jc" [("w:val","center")] () :- []- )+ ] ()+ ] : mknode "w:tblGrid" [] gridCols- : [tblBody]+ : maybeToList tblBody ) modify $ \s -> s { stInTable = False } return $ Elem tbl@@ -1171,7 +1298,7 @@ let listPr = [mknode "w:numPr" [] [ mknode "w:ilvl" [("w:val",tshow listLevel)] () , mknode "w:numId" [("w:val",tshow numid')] () ] | listLevel >= 0 && not displayMathPara]- return $ case listPr ++ squashProps props of+ return $ case squashProps (EnvProps Nothing listPr <> props) of [] -> [] ps -> [mknode "w:pPr" [] ps] @@ -1290,12 +1417,12 @@ langmod $ inlinesToOpenXML opts ils wrapBookmark ident contents inlineToOpenXML' opts (Strong lst) =- withTextProp (mknode "w:b" [] ()) $ withTextProp (mknode "w:bCs" [] ()) $ -- needed for LTR, #6911+ withTextProp (mknode "w:b" [] ()) $ inlinesToOpenXML opts lst inlineToOpenXML' opts (Emph lst) =- withTextProp (mknode "w:i" [] ()) $ withTextProp (mknode "w:iCs" [] ()) $ -- needed for LTR, #6911+ withTextProp (mknode "w:i" [] ()) $ inlinesToOpenXML opts lst inlineToOpenXML' opts (Underline lst) = withTextProp (mknode "w:u" [("w:val","single")] ()) $
@@ -22,6 +22,7 @@ import Control.Monad.Except ( throwError ) import Data.Array ( elems, (!), assocs, indices ) import Data.Text (Text)+import Data.Maybe (catMaybes) import Text.Pandoc.Definition ( ColSpec, Caption(Caption),@@ -112,20 +113,20 @@ let hasWidths = not $ all ((== ColWidthDefault) . snd) colspecs let tbl = mknode "w:tbl" [] ( mknode "w:tblPr" []- ( mknode "w:tblStyle" [("w:val","Table")] () :- mknode "w:tblW" tblWattr () :- mknode "w:tblLook" [("w:firstRow",if hasHeader then "1" else "0")- ,("w:lastRow",if hasFooter then "1" else "0")- ,("w:firstColumn","0")- ,("w:lastColumn","0")- ,("w:noHBand","0")- ,("w:noVBand","0")- ,("w:val", T.pack $ printf "%04x" tblLookVal)- ] () :- mknode "w:jc" [("w:val","start")] ()- : [ mknode "w:tblInd" [("w:w", tshow indent),("w:type","dxa")] ()+ ( [ mknode "w:tblStyle" [("w:val","Table")] (),+ mknode "w:tblW" tblWattr (),+ mknode "w:jc" [("w:val","left")] () ] +++ [ mknode "w:tblInd" [("w:w", tshow indent),("w:type","dxa")] () | indent > 0 ] ++ [ mknode "w:tblLayout" [("w:type", "fixed")] () | hasWidths ] +++ [ mknode "w:tblLook" [("w:firstRow",if hasHeader then "1" else "0")+ ,("w:lastRow",if hasFooter then "1" else "0")+ ,("w:firstColumn","0")+ ,("w:lastColumn","0")+ ,("w:noHBand","0")+ ,("w:noVBand","0")+ ,("w:val", T.pack $ printf "%04x" tblLookVal)+ ] () ] ++ [ mknode "w:tblCaption" [("w:val", captionStr)] () | not (T.null captionStr) ] )@@ -189,7 +190,7 @@ if null (elems cellArray) then return mempty else partToRows rowType aligns part >>=- mapM (rowToOpenXML blocksToOpenXML)+ fmap catMaybes . mapM (rowToOpenXML blocksToOpenXML) data OOXMLCell = OOXMLCell Attr Alignment RowSpan ColSpan [Block]@@ -228,15 +229,17 @@ rowToOpenXML :: PandocMonad m => ([Block] -> WS m [Content]) -> OOXMLRow- -> WS m Element-rowToOpenXML blocksToOpenXML (OOXMLRow rowType _attr cells) = do- xmlcells <- mapM (ooxmlCellToOpenXML blocksToOpenXML) cells- let addTrPr = case rowType of- HeadRow -> (mknode "w:trPr" []- [mknode "w:tblHeader" [("w:val", "true")] ()] :)- BodyRow -> id- FootRow -> id- return $ mknode "w:tr" [] (addTrPr xmlcells)+ -> WS m (Maybe Element)+rowToOpenXML blocksToOpenXML (OOXMLRow rowType _attr cells)+ | null cells = return Nothing+ | otherwise = do+ xmlcells <- mapM (ooxmlCellToOpenXML blocksToOpenXML) cells+ let addTrPr = case rowType of+ HeadRow -> (mknode "w:trPr" []+ [mknode "w:tblHeader" [("w:val", "on")] ()] :)+ BodyRow -> id+ FootRow -> id+ return $ Just $ mknode "w:tr" [] (addTrPr xmlcells) ooxmlCellToOpenXML :: PandocMonad m => ([Block] -> WS m [Content])
@@ -127,6 +127,13 @@ let colwidth = if writerWrapText options == WrapAuto then Just $ writerColumns options else Nothing+ docLangs <- catMaybes <$>+ mapM (toLang . Just) (nubOrd (query (extract "lang") blocks))+ mblang <- toLang $ case getLang options meta of+ Just l -> Just l+ Nothing | null docLangs -> Nothing+ | otherwise -> Just "en"+ modify $ \s -> s{ stLang = mblang } metadata <- metaToContext options blockListToLaTeX (fmap chomp . inlineListToLaTeX)@@ -167,8 +174,8 @@ st <- get titleMeta <- stringToLaTeX TextString $ stringify $ docTitle meta authorsMeta <- mapM (stringToLaTeX TextString . stringify) $ docAuthors meta- docLangs <- catMaybes <$>- mapM (toLang . Just) (nubOrd (query (extract "lang") blocks))+ -- we need a default here since lang is used in template conditionals+ let otherLangs = [l | l <- docLangs, mblang /= Just l] let hasStringValue x = isJust (getField x metadata :: Maybe (Doc Text)) let geometryFromMargins = mconcat $ intersperse ("," :: Doc Text) $ mapMaybe (\(x,y) ->@@ -178,12 +185,6 @@ ,("tmargin","margin-top") ,("bmargin","margin-bottom") ]- mblang <- toLang $ case getLang options meta of- Just l -> Just l- Nothing | null docLangs -> Nothing- | otherwise -> Just "en"- -- we need a default here since lang is used in template conditionals- let otherLangs = [l | l <- docLangs, mblang /= Just l] let dirs = query (extract "dir") blocks
@@ -15,6 +15,8 @@ import Data.Text (Text) import Data.Char (isPunctuation)+import Control.Monad.State (gets)+import Data.Maybe (fromMaybe) import qualified Data.Text as T import Text.Pandoc.Class.PandocMonad (PandocMonad) import Text.Pandoc.Definition@@ -22,7 +24,11 @@ import Text.DocLayout (Doc, brackets, empty, (<+>), text, isEmpty, literal, braces) import Text.Pandoc.Walk-import Text.Pandoc.Writers.LaTeX.Types ( LW )+import Text.Pandoc.Writers.LaTeX.Types ( LW, WriterState(stLang) )+import Text.Pandoc.Citeproc.Locator (parseLocator, LocatorInfo(..),+ toLocatorMap)+import Citeproc.Types (Lang(..))+import Citeproc.Locale (getLocale) citationsToNatbib :: PandocMonad m => ([Inline] -> LW m (Doc Text))@@ -101,11 +107,9 @@ -> LW m (Doc Text) citeArgumentsList _inlineListToLaTeX (CiteGroup _ _ []) = return empty citeArgumentsList inlineListToLaTeX (CiteGroup pfxs sfxs ids) = do- pdoc <- inlineListToLaTeX pfxs- sdoc <- inlineListToLaTeX sfxs'- return $ optargs pdoc sdoc <>- braces (literal (T.intercalate "," (reverse ids)))- where sfxs' = stripLocatorBraces $ case sfxs of+ mblang <- gets stLang+ let sfxs' = removePageLabel mblang $+ stripLocatorBraces $ case sfxs of (Str t : r) -> case T.uncons t of Just (x, xs) | T.null xs@@ -113,10 +117,14 @@ | isPunctuation x -> Str xs : r _ -> sfxs _ -> sfxs- optargs pdoc sdoc = case (isEmpty pdoc, isEmpty sdoc) of+ optargs pdoc sdoc = case (isEmpty pdoc, isEmpty sdoc) of (True, True ) -> empty (True, False) -> brackets sdoc (_ , _ ) -> brackets pdoc <> brackets sdoc+ pdoc <- inlineListToLaTeX pfxs+ sdoc <- inlineListToLaTeX sfxs'+ return $ optargs pdoc sdoc <>+ braces (literal (T.intercalate "," (reverse ids))) citeArguments :: PandocMonad m => ([Inline] -> LW m (Doc Text))@@ -180,3 +188,17 @@ cid = citationId cit citationsToBiblatex _ _ = return empty++-- | In natbib and biblatex, the label p. or pp. can be+-- omitted; ranges will be treated as page ranges by default.+-- See #9275.+removePageLabel :: Maybe Lang -> [Inline] -> [Inline]+removePageLabel mblang ils =+ case mbLocinfo of+ Just locinfo | locatorLabel locinfo == "page"+ -> Str (locatorLoc locinfo) : ils'+ _ -> ils+ where+ (mbLocinfo, ils') = parseLocator (toLocatorMap locale) ils+ lang = fromMaybe (Lang "en" Nothing (Just "US") [] [] []) mblang+ locale = either mempty id $ getLocale lang
@@ -11,6 +11,7 @@ ( WriterOptions (writerIncremental, writerTopLevelDivision) , TopLevelDivision (..) )+import Citeproc.Types (Lang) -- | LaTeX writer type. The type constructor @m@ will typically be an -- instance of PandocMonad.@@ -50,6 +51,7 @@ , stEmptyLine :: Bool -- ^ true if no content on line , stHasCslRefs :: Bool -- ^ has a Div with class refs , stIsFirstInDefinition :: Bool -- ^ first block in a defn list+ , stLang :: Maybe Lang -- ^ lang specified in metadata } startingState :: WriterOptions -> WriterState@@ -88,4 +90,5 @@ , stEmptyLine = True , stHasCslRefs = False , stIsFirstInDefinition = False+ , stLang = Nothing }
@@ -590,16 +590,19 @@ | otherwise = "> " contents <- blockListToMarkdown opts blocks return $ prefixed leader contents <> blankline-blockToMarkdown' opts t@(Table _ blkCapt specs thead tbody tfoot) = do+blockToMarkdown' opts t@(Table (ident,_,_) blkCapt specs thead tbody tfoot) = do let (caption, aligns, widths, headers, rows) = toLegacyTable blkCapt specs thead tbody tfoot let numcols = maximum (length aligns :| length widths : map length (headers:rows)) caption' <- inlineListToMarkdown opts caption- let caption''+ let caption'' = if T.null ident+ then caption'+ else caption' <+> attrsToMarkdown opts (ident,[],[])+ let caption''' | null caption = blankline | isEnabled Ext_table_captions opts- = blankline $$ (": " <> caption') $$ blankline- | otherwise = blankline $$ caption' $$ blankline+ = blankline $$ (": " <> caption'') $$ blankline+ | otherwise = blankline $$ caption'' $$ blankline let hasSimpleCells = onlySimpleTableCells $ headers : rows let isSimple = hasSimpleCells && all (==0) widths let isPlainBlock (Plain _) = True@@ -652,7 +655,7 @@ literal . removeBlankLinesInHTML <$> writeHtml5String opts{ writerTemplate = Nothing } (Pandoc nullMeta [t]) | otherwise -> return (id, literal "[TABLE]")- return $ nst (tbl $$ caption'') $$ blankline+ return $ nst (tbl $$ caption''') $$ blankline blockToMarkdown' opts (BulletList items) = do contents <- inList $ mapM (bulletListItemToMarkdown opts) items return $ (if isTightList items then vcat else vsep)
@@ -14,7 +14,8 @@ module Text.Pandoc.Writers.ODT ( writeODT ) where import Codec.Archive.Zip import Control.Monad.Except (catchError, throwError)-import Control.Monad.State.Strict+import Control.Monad.State.Strict (StateT, evalStateT, gets, modify, lift)+import Control.Monad (MonadPlus(mplus)) import qualified Data.ByteString.Lazy as B import Data.Maybe (fromMaybe) import Data.Generics (everywhere', mkT)@@ -48,6 +49,7 @@ import Text.TeXMath import qualified Text.XML.Light as XL import Network.URI (parseRelativeReference, URI(uriPath))+import Skylighting newtype ODTState = ODTState { stEntries :: [Entry] }@@ -187,29 +189,56 @@ -- make sure mimetype is first let mimetypeEntry = toEntry "mimetype" epochtime $ fromStringLazy "application/vnd.oasis.opendocument.text"- archive'' <- updateStyleWithLang lang+ archive'' <- updateStyle opts lang $ addEntryToArchive mimetypeEntry $ addEntryToArchive metaEntry archive' return $ fromArchive archive'' -updateStyleWithLang :: PandocMonad m => Maybe Lang -> Archive -> O m Archive-updateStyleWithLang Nothing arch = return arch-updateStyleWithLang (Just lang) arch = do+updateStyle :: forall m . PandocMonad m+ => WriterOptions -> Maybe Lang -> Archive -> O m Archive+updateStyle opts mbLang arch = do epochtime <- floor `fmap` lift P.getPOSIXTime- entries <- mapM (\e -> if eRelativePath e == "styles.xml"- then case parseXMLElement- (toTextLazy (fromEntry e)) of- Left msg -> throwError $- PandocXMLError "styles.xml" msg- Right d -> return $- toEntry "styles.xml" epochtime- ( fromTextLazy- . TL.fromStrict- . ppTopElement- . addLang lang $ d )- else return e) (zEntries arch)+ let goEntry :: Entry -> O m Entry+ goEntry e+ | eRelativePath e == "styles.xml"+ = case parseXMLElement (toTextLazy (fromEntry e)) of+ Left msg -> throwError $ PandocXMLError "styles.xml" msg+ Right d -> return $+ toEntry "styles.xml" epochtime+ ( fromTextLazy+ . TL.fromStrict+ . showTopElement+ . maybe id addLang mbLang+ . transformElement (\qn -> qName qn == "styles" &&+ qPrefix qn == Just "office" )+ (maybe id addHlStyles (writerHighlightStyle opts))+ $ d )+ | otherwise = pure e+ entries <- mapM goEntry (zEntries arch) return arch{ zEntries = entries } +addHlStyles :: Style -> Element -> Element+addHlStyles sty el =+ el{ elContent = filter (not . isHlStyle) (elContent el) +++ styleToOpenDocument sty }+ where+ isHlStyle (Elem e) = "Tok" `T.isSuffixOf` (qName (elName e))+ isHlStyle _ = False++-- top-down search+transformElement :: (QName -> Bool)+ -> (Element -> Element)+ -> Element+ -> Element+transformElement g f el+ | g (elName el)+ = f el+ | otherwise+ = el{ elContent = map go (elContent el) }+ where+ go (Elem e) = Elem (transformElement g f e)+ go x = x+ -- TODO FIXME avoid this generic traversal! addLang :: Lang -> Element -> Element addLang lang = everywhere' (mkT updateLangAttr)@@ -304,3 +333,36 @@ inTags False "config:config-item" [("config:name", "IsTextMode") ,("config:type", "boolean")] $ text $ if isTextMode then "true" else "false")++styleToOpenDocument :: Style -> [Content]+styleToOpenDocument style = map (Elem . toStyle) alltoktypes+ where alltoktypes = enumFromTo KeywordTok NormalTok+ styleName x =+ case T.break (== ':') x of+ (b, a) | T.null a -> QName x Nothing (Just "style")+ | otherwise -> QName (T.drop 1 a) Nothing (Just b)+ styleAttr (x, y) = Attr (styleName x) y+ styleAttrs = map styleAttr+ styleElement x attrs cs =+ Element (styleName x) (styleAttrs attrs) cs Nothing+ toStyle toktype =+ styleElement "style"+ [("name", tshow toktype), ("family", "text")]+ [Elem (styleElement "text-properties"+ (tokColor toktype ++ tokBgColor toktype +++ [("fo:font-style", "italic") |+ tokFeature tokenItalic toktype ] +++ [("fo:font-weight", "bold") |+ tokFeature tokenBold toktype ] +++ [("style:text-underline-style", "solid") |+ tokFeature tokenUnderline toktype ])+ [])]+ tokStyles = tokenStyles style+ tokFeature f toktype = maybe False f $ Map.lookup toktype tokStyles+ tokColor toktype =+ maybe [] (\c -> [("fo:color", T.pack (fromColor c))])+ ((tokenColor =<< Map.lookup toktype tokStyles)+ `mplus` defaultColor style)+ tokBgColor toktype =+ maybe [] (\c -> [("fo:background-color", T.pack (fromColor c))])+ (tokenBackground =<< Map.lookup toktype tokStyles)
@@ -35,9 +35,9 @@ else Nothing meta' = B.setMeta "date" (B.str $ convertDate $ docDate meta) meta metadata <- metaToContext opts- (fmap literal . writeMarkdown def . Pandoc nullMeta)+ (fmap literal . writeMarkdown' opts . Pandoc nullMeta) (\ils -> literal . T.stripEnd <$>- writeMarkdown def (Pandoc nullMeta [Plain ils]))+ writeMarkdown' opts (Pandoc nullMeta [Plain ils])) meta' let blocks' = makeSections False (Just 1) blocks main <- render colwidth . vcat <$>@@ -49,6 +49,11 @@ Nothing -> main Just tpl -> render colwidth $ renderTemplate tpl context +writeMarkdown' :: PandocMonad m => WriterOptions -> Pandoc -> m Text+writeMarkdown' opts = writeMarkdown def{ writerWrapText = writerWrapText opts+ , writerColumns = writerColumns opts+ , writerExtensions = pandocExtensions+ } writeHtmlInlines :: PandocMonad m => [Inline] -> m Text writeHtmlInlines ils =@@ -71,7 +76,7 @@ htmlIls <- writeHtmlInlines title md <- if null blocks then return mempty- else writeMarkdown def $ Pandoc nullMeta blocks+ else writeMarkdown' opts $ Pandoc nullMeta blocks let attrs = ("text", htmlIls) : [("_note", T.stripEnd md) | not (null blocks)] rest' <- vcat <$> mapM (blockToOPML opts) rest
@@ -15,7 +15,7 @@ -} module Text.Pandoc.Writers.OpenDocument ( writeOpenDocument ) where import Control.Arrow ((***), (>>>))-import Control.Monad (unless, liftM, MonadPlus(mplus))+import Control.Monad (unless, liftM) import Control.Monad.State.Strict ( StateT(..), modify, gets, lift ) import Data.Char (chr) import Data.Foldable (find)@@ -44,8 +44,7 @@ import Text.Pandoc.XML import Text.Printf (printf) import Text.Pandoc.Highlighting (highlight)-import Skylighting-import qualified Data.Map as M+import Skylighting (FormatOptions(..), SourceLine, Token) -- | Auxiliary function to convert Plain block to Para. plainToPara :: Block -> Block@@ -268,11 +267,9 @@ [("style:name", "L" <> tshow n)] (vcat l) let listStyles = map listStyle (stListStyles s) let automaticStyles = vcat $ reverse $ styles ++ listStyles- let highlightingStyles = maybe mempty styleToOpenDocument (writerHighlightStyle opts) let context = defField "body" body . defField "toc" (writerTableOfContents opts) . defField "toc-depth" (tshow $ writerTOCDepth opts)- . defField "highlighting-styles" highlightingStyles . defField "automatic-styles" automaticStyles $ metadata return $ render colwidth $@@ -922,24 +919,3 @@ Left _ -> do report $ InvalidLang l action--styleToOpenDocument :: Style -> Doc Text-styleToOpenDocument style = vcat (map toStyle alltoktypes)- where alltoktypes = enumFromTo KeywordTok NormalTok- toStyle toktype = inTags True "style:style" [("style:name", tshow toktype),- ("style:family", "text")] $- selfClosingTag "style:text-properties"- (tokColor toktype ++ tokBgColor toktype ++- [("fo:font-style", "italic") |- tokFeature tokenItalic toktype ] ++- [("fo:font-weight", "bold") |- tokFeature tokenBold toktype ] ++- [("style:text-underline-style", "solid") |- tokFeature tokenUnderline toktype ])- tokStyles = tokenStyles style- tokFeature f toktype = maybe False f $ M.lookup toktype tokStyles- tokColor toktype = maybe [] (\c -> [("fo:color", T.pack (fromColor c))])- $ (tokenColor =<< M.lookup toktype tokStyles)- `mplus` defaultColor style- tokBgColor toktype = maybe [] (\c -> [("fo:background-color", T.pack (fromColor c))])- $ (tokenBackground =<< M.lookup toktype tokStyles)
@@ -45,6 +45,11 @@ (Comparison { mine = sort (elAttribs myElem) , good = sort (elAttribs goodElem) })))+ <|> (if length (elContent myElem) == length (elContent goodElem)+ then Nothing+ else Just+ (ElemChildrenDiffer+ (Comparison { mine = elContent myElem, good = elContent goodElem}))) <|> asum (zipWith compareXML (elContent myElem) (elContent goodElem)) compareXML (Text goodCData) (Text myCData) = (if cdVerbatim myCData == cdVerbatim goodCData@@ -60,6 +65,7 @@ data XMLDifference = ElemNamesDiffer (Comparison QName) | ElemAttributesDiffer (Comparison [Attr])+ | ElemChildrenDiffer (Comparison [Content]) | CDatasDiffer (Comparison CData) | CRefsDiffer (Comparison String) | OtherContentsDiffer (Comparison Content)
@@ -21,101 +21,6 @@ <office:font-face-decls> <style:font-face style:name="Courier New" style:font-family-generic="modern" style:font-pitch="fixed" svg:font-family="'Courier New'" /> </office:font-face-decls>- <office:styles>- <style:style style:name="KeywordTok" style:family="text">- <style:text-properties fo:color="#007020" fo:font-weight="bold" />- </style:style>- <style:style style:name="DataTypeTok" style:family="text">- <style:text-properties fo:color="#902000" />- </style:style>- <style:style style:name="DecValTok" style:family="text">- <style:text-properties fo:color="#40a070" />- </style:style>- <style:style style:name="BaseNTok" style:family="text">- <style:text-properties fo:color="#40a070" />- </style:style>- <style:style style:name="FloatTok" style:family="text">- <style:text-properties fo:color="#40a070" />- </style:style>- <style:style style:name="ConstantTok" style:family="text">- <style:text-properties fo:color="#880000" />- </style:style>- <style:style style:name="CharTok" style:family="text">- <style:text-properties fo:color="#4070a0" />- </style:style>- <style:style style:name="SpecialCharTok" style:family="text">- <style:text-properties fo:color="#4070a0" />- </style:style>- <style:style style:name="StringTok" style:family="text">- <style:text-properties fo:color="#4070a0" />- </style:style>- <style:style style:name="VerbatimStringTok" style:family="text">- <style:text-properties fo:color="#4070a0" />- </style:style>- <style:style style:name="SpecialStringTok" style:family="text">- <style:text-properties fo:color="#bb6688" />- </style:style>- <style:style style:name="ImportTok" style:family="text">- <style:text-properties fo:color="#008000" fo:font-weight="bold" />- </style:style>- <style:style style:name="CommentTok" style:family="text">- <style:text-properties fo:color="#60a0b0" fo:font-style="italic" />- </style:style>- <style:style style:name="DocumentationTok" style:family="text">- <style:text-properties fo:color="#ba2121" fo:font-style="italic" />- </style:style>- <style:style style:name="AnnotationTok" style:family="text">- <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />- </style:style>- <style:style style:name="CommentVarTok" style:family="text">- <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />- </style:style>- <style:style style:name="OtherTok" style:family="text">- <style:text-properties fo:color="#007020" />- </style:style>- <style:style style:name="FunctionTok" style:family="text">- <style:text-properties fo:color="#06287e" />- </style:style>- <style:style style:name="VariableTok" style:family="text">- <style:text-properties fo:color="#19177c" />- </style:style>- <style:style style:name="ControlFlowTok" style:family="text">- <style:text-properties fo:color="#007020" fo:font-weight="bold" />- </style:style>- <style:style style:name="OperatorTok" style:family="text">- <style:text-properties fo:color="#666666" />- </style:style>- <style:style style:name="BuiltInTok" style:family="text">- <style:text-properties fo:color="#008000" />- </style:style>- <style:style style:name="ExtensionTok" style:family="text">- <style:text-properties />- </style:style>- <style:style style:name="PreprocessorTok" style:family="text">- <style:text-properties fo:color="#bc7a00" />- </style:style>- <style:style style:name="AttributeTok" style:family="text">- <style:text-properties fo:color="#7d9029" />- </style:style>- <style:style style:name="RegionMarkerTok" style:family="text">- <style:text-properties />- </style:style>- <style:style style:name="InformationTok" style:family="text">- <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />- </style:style>- <style:style style:name="WarningTok" style:family="text">- <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />- </style:style>- <style:style style:name="AlertTok" style:family="text">- <style:text-properties fo:color="#ff0000" fo:font-weight="bold" />- </style:style>- <style:style style:name="ErrorTok" style:family="text">- <style:text-properties fo:color="#ff0000" fo:font-weight="bold" />- </style:style>- <style:style style:name="NormalTok" style:family="text">- <style:text-properties />- </style:style>- </office:styles> <office:automatic-styles> <style:style style:name="fr2" style:family="graphic" style:parent-style-name="Formula"><style:graphic-properties style:vertical-pos="middle" style:vertical-rel="text" style:horizontal-pos="center" style:horizontal-rel="paragraph-content" style:wrap="none" /></style:style> <style:style style:name="fr1" style:family="graphic" style:parent-style-name="Formula"><style:graphic-properties style:vertical-pos="middle" style:vertical-rel="text" /></style:style>
@@ -15,101 +15,6 @@ <office:font-face-decls> <style:font-face style:name="Courier New" style:font-family-generic="modern" style:font-pitch="fixed" svg:font-family="'Courier New'" /> </office:font-face-decls>- <office:styles>- <style:style style:name="KeywordTok" style:family="text">- <style:text-properties fo:color="#007020" fo:font-weight="bold" />- </style:style>- <style:style style:name="DataTypeTok" style:family="text">- <style:text-properties fo:color="#902000" />- </style:style>- <style:style style:name="DecValTok" style:family="text">- <style:text-properties fo:color="#40a070" />- </style:style>- <style:style style:name="BaseNTok" style:family="text">- <style:text-properties fo:color="#40a070" />- </style:style>- <style:style style:name="FloatTok" style:family="text">- <style:text-properties fo:color="#40a070" />- </style:style>- <style:style style:name="ConstantTok" style:family="text">- <style:text-properties fo:color="#880000" />- </style:style>- <style:style style:name="CharTok" style:family="text">- <style:text-properties fo:color="#4070a0" />- </style:style>- <style:style style:name="SpecialCharTok" style:family="text">- <style:text-properties fo:color="#4070a0" />- </style:style>- <style:style style:name="StringTok" style:family="text">- <style:text-properties fo:color="#4070a0" />- </style:style>- <style:style style:name="VerbatimStringTok" style:family="text">- <style:text-properties fo:color="#4070a0" />- </style:style>- <style:style style:name="SpecialStringTok" style:family="text">- <style:text-properties fo:color="#bb6688" />- </style:style>- <style:style style:name="ImportTok" style:family="text">- <style:text-properties fo:color="#008000" fo:font-weight="bold" />- </style:style>- <style:style style:name="CommentTok" style:family="text">- <style:text-properties fo:color="#60a0b0" fo:font-style="italic" />- </style:style>- <style:style style:name="DocumentationTok" style:family="text">- <style:text-properties fo:color="#ba2121" fo:font-style="italic" />- </style:style>- <style:style style:name="AnnotationTok" style:family="text">- <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />- </style:style>- <style:style style:name="CommentVarTok" style:family="text">- <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />- </style:style>- <style:style style:name="OtherTok" style:family="text">- <style:text-properties fo:color="#007020" />- </style:style>- <style:style style:name="FunctionTok" style:family="text">- <style:text-properties fo:color="#06287e" />- </style:style>- <style:style style:name="VariableTok" style:family="text">- <style:text-properties fo:color="#19177c" />- </style:style>- <style:style style:name="ControlFlowTok" style:family="text">- <style:text-properties fo:color="#007020" fo:font-weight="bold" />- </style:style>- <style:style style:name="OperatorTok" style:family="text">- <style:text-properties fo:color="#666666" />- </style:style>- <style:style style:name="BuiltInTok" style:family="text">- <style:text-properties fo:color="#008000" />- </style:style>- <style:style style:name="ExtensionTok" style:family="text">- <style:text-properties />- </style:style>- <style:style style:name="PreprocessorTok" style:family="text">- <style:text-properties fo:color="#bc7a00" />- </style:style>- <style:style style:name="AttributeTok" style:family="text">- <style:text-properties fo:color="#7d9029" />- </style:style>- <style:style style:name="RegionMarkerTok" style:family="text">- <style:text-properties />- </style:style>- <style:style style:name="InformationTok" style:family="text">- <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />- </style:style>- <style:style style:name="WarningTok" style:family="text">- <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />- </style:style>- <style:style style:name="AlertTok" style:family="text">- <style:text-properties fo:color="#ff0000" fo:font-weight="bold" />- </style:style>- <style:style style:name="ErrorTok" style:family="text">- <style:text-properties fo:color="#ff0000" fo:font-weight="bold" />- </style:style>- <style:style style:name="NormalTok" style:family="text">- <style:text-properties />- </style:style>- </office:styles> <office:automatic-styles> <style:style style:name="T1" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style> <style:style style:name="fr2" style:family="graphic" style:parent-style-name="Formula"><style:graphic-properties style:vertical-pos="middle" style:vertical-rel="text" style:horizontal-pos="center" style:horizontal-rel="paragraph-content" style:wrap="none" /></style:style>
@@ -0,0 +1,18 @@+```+% pandoc -t latex --biblatex+[@scott2000, p. 33]+[@scott2000, pp. 33-34 and elsewhere; @scott2001, ch. 4]+^D+\autocite[33]{scott2000} \autocites[33-34 and+elsewhere]{scott2000}[ch.~4]{scott2001}++```++```+% pandoc -t latex --biblatex -Mlang=de+[@scott2000, p. 33]+[@scott2000, S. 33]+^D+\autocite[p.~33]{scott2000} \autocite[33]{scott2000}++```
@@ -0,0 +1,131 @@+```+% pandoc -f org -t native+#+LABEL: tbl:Cosasexample+#+CAPTION: Cosas++-------+-------++| cosas | cosas |+| cosas | cosas |++=======+=======++| cosas | cosas |+| cosas | cosas |++-------+-------++^D+[ Table+ ( "tbl:Cosasexample" , [] , [] )+ (Caption Nothing [ Plain [ Str "Cosas" ] ])+ [ ( AlignDefault , ColWidth 0.1111111111111111 )+ , ( AlignDefault , ColWidth 0.1111111111111111 )+ ]+ (TableHead+ ( "" , [] , [] )+ [ Row+ ( "" , [] , [] )+ [ Cell+ ( "" , [] , [] )+ AlignDefault+ (RowSpan 1)+ (ColSpan 1)+ [ Plain [ Str "cosas" , SoftBreak , Str "cosas" ] ]+ , Cell+ ( "" , [] , [] )+ AlignDefault+ (RowSpan 1)+ (ColSpan 1)+ [ Plain [ Str "cosas" , SoftBreak , Str "cosas" ] ]+ ]+ ])+ [ TableBody+ ( "" , [] , [] )+ (RowHeadColumns 0)+ []+ [ Row+ ( "" , [] , [] )+ [ Cell+ ( "" , [] , [] )+ AlignDefault+ (RowSpan 1)+ (ColSpan 1)+ [ Plain [ Str "cosas" , SoftBreak , Str "cosas" ] ]+ , Cell+ ( "" , [] , [] )+ AlignDefault+ (RowSpan 1)+ (ColSpan 1)+ [ Plain [ Str "cosas" , SoftBreak , Str "cosas" ] ]+ ]+ ]+ ]+ (TableFoot ( "" , [] , [] ) [])+]+```++```+% pandoc -f org -t markdown+#+LABEL: tbl:Cosasexample+#+CAPTION: Cosas++-------+-------++| cosas | cosas |+| cosas | cosas |++=======+=======++| cosas | cosas |+| cosas | cosas |++-------+-------++^D+ ---------------+ cosas cosas+ cosas cosas+ ------- -------+ cosas cosas+ cosas cosas++ ---------------++ : Cosas {#tbl:Cosasexample}++```++```+% pandoc -f org -t markdown+#+LABEL: tbl:Cosasexample++-------+-------++| cosas | cosas |+| cosas | cosas |++=======+=======++| cosas | cosas |+| cosas | cosas |++-------+-------++^D+ ---------------+ cosas cosas+ cosas cosas+ ------- -------+ cosas cosas+ cosas cosas++ ---------------++```++```+% pandoc -f org -t markdown+#+CAPTION: Cosas++-------+-------++| cosas | cosas |+| cosas | cosas |++=======+=======++| cosas | cosas |+| cosas | cosas |++-------+-------++^D+ ---------------+ cosas cosas+ cosas cosas+ ------- -------+ cosas cosas+ cosas cosas++ ---------------++ : Cosas++```
@@ -0,0 +1,29 @@+```+% pandoc -f mediawiki -t native+* Linearity in the first argument:+*:<math>\begin{align}+\langle a \mathbf u, \mathbf v\rangle &= a \langle \mathbf u, \mathbf v\rangle. \\+\langle \mathbf u + \mathbf v, \mathbf w\rangle &= \langle \mathbf u, \mathbf w\rangle+ \langle \mathbf v, \mathbf w\rangle.+\end{align}</math>+^D+[ BulletList+ [ [ Plain+ [ Str "Linearity"+ , Space+ , Str "in"+ , Space+ , Str "the"+ , Space+ , Str "first"+ , Space+ , Str "argument:"+ ]+ , Para+ [ Math+ DisplayMath+ "\\begin{align}\n\\langle a \\mathbf u, \\mathbf v\\rangle &= a \\langle \\mathbf u, \\mathbf v\\rangle. \\\\\n\\langle \\mathbf u + \\mathbf v, \\mathbf w\\rangle &= \\langle \\mathbf u, \\mathbf w\\rangle+ \\langle \\mathbf v, \\mathbf w\\rangle.\n\\end{align}"+ ]+ ]+ ]+]+```
binary file changed (10096 → 9986 bytes)
binary file changed (9911 → 9801 bytes)
binary file changed (10249 → 10134 bytes)
binary file changed (10014 → 9901 bytes)
binary file changed (10643 → 10532 bytes)
binary file changed (12388 → 12544 bytes)
binary file changed (9911 → 9800 bytes)
binary file changed (9917 → 9808 bytes)
binary file changed (10402 → 10293 bytes)
binary file changed (10050 → 9940 bytes)
binary file changed (26792 → 26682 bytes)
binary file changed (9850 → 9740 bytes)
binary file changed (10030 → 9921 bytes)
binary file changed (26790 → 26680 bytes)
binary file changed (10072 → 9962 bytes)
binary file changed (10243 → 10133 bytes)
binary file changed (10309 → 10204 bytes)
binary file changed (10105 → 9996 bytes)
binary file changed (9958 → 9850 bytes)
binary file changed (10187 → 10081 bytes)
binary file changed (10103 → 9994 bytes)
binary file changed (10243 → 10133 bytes)
binary file changed (10019 → 9909 bytes)
binary file changed (9951 → 9841 bytes)
binary file changed (10085 → 9975 bytes)
binary file changed (9940 → 9826 bytes)
binary file changed (10259 → 10146 bytes)
binary file changed (10286 → 10172 bytes)
binary file changed (10301 → 10186 bytes)
binary file changed (9936 → 9822 bytes)
binary file changed (9894 → 9784 bytes)
binary file changed (9877 → 9767 bytes)
binary file changed (9911 → 9801 bytes)
binary file changed (10023 → 9910 bytes)
binary file changed (9836 → 9726 bytes)
binary file changed (9883 → 9773 bytes)
@@ -231,9 +231,6 @@ code span.vs { color: #4070a0; } /* VerbatimString */ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ </style>- <!--[if lt IE 9]>- <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>- <![endif]--> </head> <body> <h1 id="lhs-test">lhs test</h1>
@@ -231,9 +231,6 @@ code span.vs { color: #4070a0; } /* VerbatimString */ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ </style>- <!--[if lt IE 9]>- <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>- <![endif]--> </head> <body> <h1 id="lhs-test">lhs test</h1>
@@ -170,9 +170,6 @@ } .display.math{display: block; text-align: center; margin: 0.5rem auto;} </style>- <!--[if lt IE 9]>- <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>- <![endif]--> </head> <body> <header id="title-block-header">
@@ -3,101 +3,6 @@ <office:font-face-decls> <style:font-face style:name="Courier New" style:font-family-generic="modern" style:font-pitch="fixed" svg:font-family="'Courier New'" /> </office:font-face-decls>- <office:styles>- <style:style style:name="KeywordTok" style:family="text">- <style:text-properties fo:color="#007020" fo:font-weight="bold" />- </style:style>- <style:style style:name="DataTypeTok" style:family="text">- <style:text-properties fo:color="#902000" />- </style:style>- <style:style style:name="DecValTok" style:family="text">- <style:text-properties fo:color="#40a070" />- </style:style>- <style:style style:name="BaseNTok" style:family="text">- <style:text-properties fo:color="#40a070" />- </style:style>- <style:style style:name="FloatTok" style:family="text">- <style:text-properties fo:color="#40a070" />- </style:style>- <style:style style:name="ConstantTok" style:family="text">- <style:text-properties fo:color="#880000" />- </style:style>- <style:style style:name="CharTok" style:family="text">- <style:text-properties fo:color="#4070a0" />- </style:style>- <style:style style:name="SpecialCharTok" style:family="text">- <style:text-properties fo:color="#4070a0" />- </style:style>- <style:style style:name="StringTok" style:family="text">- <style:text-properties fo:color="#4070a0" />- </style:style>- <style:style style:name="VerbatimStringTok" style:family="text">- <style:text-properties fo:color="#4070a0" />- </style:style>- <style:style style:name="SpecialStringTok" style:family="text">- <style:text-properties fo:color="#bb6688" />- </style:style>- <style:style style:name="ImportTok" style:family="text">- <style:text-properties fo:color="#008000" fo:font-weight="bold" />- </style:style>- <style:style style:name="CommentTok" style:family="text">- <style:text-properties fo:color="#60a0b0" fo:font-style="italic" />- </style:style>- <style:style style:name="DocumentationTok" style:family="text">- <style:text-properties fo:color="#ba2121" fo:font-style="italic" />- </style:style>- <style:style style:name="AnnotationTok" style:family="text">- <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />- </style:style>- <style:style style:name="CommentVarTok" style:family="text">- <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />- </style:style>- <style:style style:name="OtherTok" style:family="text">- <style:text-properties fo:color="#007020" />- </style:style>- <style:style style:name="FunctionTok" style:family="text">- <style:text-properties fo:color="#06287e" />- </style:style>- <style:style style:name="VariableTok" style:family="text">- <style:text-properties fo:color="#19177c" />- </style:style>- <style:style style:name="ControlFlowTok" style:family="text">- <style:text-properties fo:color="#007020" fo:font-weight="bold" />- </style:style>- <style:style style:name="OperatorTok" style:family="text">- <style:text-properties fo:color="#666666" />- </style:style>- <style:style style:name="BuiltInTok" style:family="text">- <style:text-properties fo:color="#008000" />- </style:style>- <style:style style:name="ExtensionTok" style:family="text">- <style:text-properties />- </style:style>- <style:style style:name="PreprocessorTok" style:family="text">- <style:text-properties fo:color="#bc7a00" />- </style:style>- <style:style style:name="AttributeTok" style:family="text">- <style:text-properties fo:color="#7d9029" />- </style:style>- <style:style style:name="RegionMarkerTok" style:family="text">- <style:text-properties />- </style:style>- <style:style style:name="InformationTok" style:family="text">- <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />- </style:style>- <style:style style:name="WarningTok" style:family="text">- <style:text-properties fo:color="#60a0b0" fo:font-style="italic" fo:font-weight="bold" />- </style:style>- <style:style style:name="AlertTok" style:family="text">- <style:text-properties fo:color="#ff0000" fo:font-weight="bold" />- </style:style>- <style:style style:name="ErrorTok" style:family="text">- <style:text-properties fo:color="#ff0000" fo:font-weight="bold" />- </style:style>- <style:style style:name="NormalTok" style:family="text">- <style:text-properties />- </style:style>- </office:styles> <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=".">
@@ -21,52 +21,52 @@ <outline text="Level 3" _note="with no blank line"> </outline> </outline>- <outline text="Level 2" _note="with no blank line ------------------------------------------------------------------------">+ <outline text="Level 2" _note="with no blank line --------------------------------------------------------------------------------"> </outline> </outline>-<outline text="Paragraphs" _note="Here’s a regular paragraph. In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item. Here’s one with a bullet. \* criminey. There should be a hard line break here. ------------------------------------------------------------------------">+<outline text="Paragraphs" _note="Here's a regular paragraph. In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item. Here's one with a bullet. \* criminey. There should be a hard line break\ here. --------------------------------------------------------------------------------"> </outline>-<outline text="Block Quotes" _note="E-mail style: > This is a block quote. It is pretty short. > Code in a block quote: > > sub status { > print "working"; > } > > A list: > > 1. item one > 2. item two > > Nested block quotes: > > > nested > > > nested This should not be a block quote: 2 &gt; 1. And a following paragraph. ------------------------------------------------------------------------">+<outline text="Block Quotes" _note="E-mail style: > This is a block quote. It is pretty short. > Code in a block quote: > > sub status { > print "working"; > } > > A list: > > 1. item one > 2. item two > > Nested block quotes: > > > nested > > > nested This should not be a block quote: 2 \> 1. And a following paragraph. --------------------------------------------------------------------------------"> </outline>-<outline text="Code Blocks" _note="Code: ---- (should be four hyphens) sub status { print "working"; } this code block is indented by one tab And: this code block is indented by two tabs These should not be escaped: \$ \\ \> \[ \{ ------------------------------------------------------------------------">+<outline text="Code Blocks" _note="Code: ---- (should be four hyphens) sub status { print "working"; } this code block is indented by one tab And: this code block is indented by two tabs These should not be escaped: \$ \\ \> \[ \{ --------------------------------------------------------------------------------"> </outline> <outline text="Lists"> <outline text="Unordered" _note="Asterisks tight: - asterisk 1 - asterisk 2 - asterisk 3 Asterisks loose: - asterisk 1 - asterisk 2 - asterisk 3 Pluses tight: - Plus 1 - Plus 2 - Plus 3 Pluses loose: - Plus 1 - Plus 2 - Plus 3 Minuses tight: - Minus 1 - Minus 2 - Minus 3 Minuses loose: - Minus 1 - Minus 2 - Minus 3"> </outline>- <outline text="Ordered" _note="Tight: 1. First 2. Second 3. Third and: 1. One 2. Two 3. Three Loose using tabs: 1. First 2. Second 3. Third and using spaces: 1. One 2. Two 3. Three Multiple paragraphs: 1. Item 1, graf one. Item 1. graf two. The quick brown fox jumped over the lazy dog’s back. 2. Item 2. 3. Item 3.">+ <outline text="Ordered" _note="Tight: 1. First 2. Second 3. Third and: 1. One 2. Two 3. Three Loose using tabs: 1. First 2. Second 3. Third and using spaces: 1. One 2. Two 3. Three Multiple paragraphs: 1. Item 1, graf one. Item 1. graf two. The quick brown fox jumped over the lazy dog's back. 2. Item 2. 3. Item 3."> </outline>- <outline text="Nested" _note="- Tab - Tab - Tab Here’s another: 1. First 2. Second: - Fee - Fie - Foe 3. Third Same thing but with paragraphs: 1. First 2. Second: - Fee - Fie - Foe 3. Third">+ <outline text="Nested" _note="- Tab - Tab - Tab Here's another: 1. First 2. Second: - Fee - Fie - Foe 3. Third Same thing but with paragraphs: 1. First 2. Second: - Fee - Fie - Foe 3. Third"> </outline> <outline text="Tabs and spaces" _note="- this is a list item indented with tabs - this is a list item indented with spaces - this is an example list item indented with tabs - this is an example list item indented with spaces"> </outline>- <outline text="Fancy list markers" _note="1. begins with 2 2. and now 3 with a continuation 1. sublist with roman numerals, starting with 4 2. more items 1. a subsublist 2. a subsublist Nesting: 1. Upper Alpha 1. Upper Roman. 1. Decimal start with 6 1. Lower alpha with paren Autonumbering: 1. Autonumber. 2. More. 1. Nested. Should not be a list item: M.A. 2007 B. Williams ------------------------------------------------------------------------">+ <outline text="Fancy list markers" _note="(2) begins with 2 (3) and now 3 with a continuation iv. sublist with roman numerals, starting with 4 v. more items (A) a subsublist (B) a subsublist Nesting: A. Upper Alpha I. Upper Roman. (6) Decimal start with 6 c) Lower alpha with paren Autonumbering: 1. Autonumber. 2. More. 1. Nested. Should not be a list item: M.A. 2007 B. Williams --------------------------------------------------------------------------------"> </outline> </outline>-<outline text="Definition Lists" _note="Tight using spaces: apple red fruit orange orange fruit banana yellow fruit Tight using tabs: apple red fruit orange orange fruit banana yellow fruit Loose: apple red fruit orange orange fruit banana yellow fruit Multiple blocks with italics: *apple* red fruit contains seeds, crisp, pleasant to taste *orange* orange fruit { orange code block } > orange block quote Multiple definitions, tight: apple red fruit computer orange orange fruit bank Multiple definitions, loose: apple red fruit computer orange orange fruit bank Blank line after term, indented marker, alternate markers: apple red fruit computer orange orange fruit 1. sublist 2. sublist">+<outline text="Definition Lists" _note="Tight using spaces: apple : red fruit orange : orange fruit banana : yellow fruit Tight using tabs: apple : red fruit orange : orange fruit banana : yellow fruit Loose: apple : red fruit orange : orange fruit banana : yellow fruit Multiple blocks with italics: *apple* : red fruit contains seeds, crisp, pleasant to taste *orange* : orange fruit { orange code block } > orange block quote Multiple definitions, tight: apple : red fruit : computer orange : orange fruit : bank Multiple definitions, loose: apple : red fruit : computer orange : orange fruit : bank Blank line after term, indented marker, alternate markers: apple : red fruit : computer orange : orange fruit 1. sublist 2. sublist"> </outline>-<outline text="HTML Blocks" _note="Simple block on one line: foo And nested without indentation: foo bar Interpreted markdown in a table: This is *emphasized* And this is **strong** Here’s a simple block: foo This should be a code block, though: <div> foo </div> As should this: <div>foo</div> Now, nested: foo This should just be an HTML comment: Multiline: Code block: <!-- Comment --> Just plain comment, with trailing spaces on the line: Code: <hr /> Hr’s: ------------------------------------------------------------------------">+<outline text="HTML Blocks" _note="Simple block on one line: <div> foo </div> And nested without indentation: <div> <div> <div> foo </div> </div> <div> bar </div> </div> Interpreted markdown in a table: ```{=html} <table> ``` ```{=html} <tr> ``` ```{=html} <td> ``` This is *emphasized* ```{=html} </td> ``` ```{=html} <td> ``` And this is **strong** ```{=html} </td> ``` ```{=html} </tr> ``` ```{=html} </table> ``` ```{=html} <script type="text/javascript">document.write('This *should not* be interpreted as markdown');</script> ``` Here's a simple block: <div> foo </div> This should be a code block, though: <div> foo </div> As should this: <div>foo</div> Now, nested: <div> <div> <div> foo </div> </div> </div> This should just be an HTML comment: ```{=html} <!-- Comment --> ``` Multiline: ```{=html} <!-- Blah Blah --> ``` ```{=html} <!-- This is another comment. --> ``` Code block: <!-- Comment --> Just plain comment, with trailing spaces on the line: ```{=html} <!-- foo --> ``` Code: <hr /> Hr's: ```{=html} <hr> ``` ```{=html} <hr /> ``` ```{=html} <hr /> ``` ```{=html} <hr> ``` ```{=html} <hr /> ``` ```{=html} <hr /> ``` ```{=html} <hr class="foo" id="bar" /> ``` ```{=html} <hr class="foo" id="bar" /> ``` ```{=html} <hr class="foo" id="bar"> ``` --------------------------------------------------------------------------------"> </outline>-<outline text="Inline Markup" _note="This is *emphasized*, and so *is this*. This is **strong**, and so **is this**. An *[emphasized link](/url)*. ***This is strong and em.*** So is ***this*** word. ***This is strong and em.*** So is ***this*** word. This is code: `>`, `$`, `\`, `\$`, `<html>`. This is *strikeout*. Superscripts: a^(bc)d a^(*hello*) a^(hello there). Subscripts: H₂O, H₂₃O, H_(many of them)O. These should not be superscripts or subscripts, because of the unescaped spaces: a^b c^d, a~b c~d. ------------------------------------------------------------------------">+<outline text="Inline Markup" _note="This is *emphasized*, and so *is this*. This is **strong**, and so **is this**. An *[emphasized link](/url)*. ***This is strong and em.*** So is ***this*** word. ***This is strong and em.*** So is ***this*** word. This is code: `>`, `$`, `\`, `\$`, `<html>`. ~~This is *strikeout*.~~ Superscripts: a^bc^d a^*hello*^ a^hello there^. Subscripts: H~2~O, H~23~O, H~many of them~O. These should not be superscripts or subscripts, because of the unescaped spaces: a\^b c\^d, a\~b c\~d. --------------------------------------------------------------------------------"> </outline>-<outline text="Smart quotes, ellipses, dashes" _note="“Hello,” said the spider. “‘Shelob’ is my name.” ‘A’, ‘B’, and ‘C’ are letters. ‘Oak,’ ‘elm,’ and ‘beech’ are names of trees. So is ‘pine.’ ‘He said, “I want to go.”’ Were you alive in the 70’s? Here is some quoted ‘`code`’ and a “[quoted link](http://example.com/?foo=1&bar=2)”. Some dashes: one—two — three—four — five. Dashes between numbers: 5–7, 255–66, 1987–1999. Ellipses…and…and…. ------------------------------------------------------------------------">+<outline text="Smart quotes, ellipses, dashes" _note=""Hello," said the spider. "'Shelob' is my name." 'A', 'B', and 'C' are letters. 'Oak,' 'elm,' and 'beech' are names of trees. So is 'pine.' 'He said, "I want to go."' Were you alive in the 70's? Here is some quoted '`code`' and a "[quoted link](http://example.com/?foo=1&bar=2)". Some dashes: one---two --- three---four --- five. Dashes between numbers: 5--7, 255--66, 1987--1999. Ellipses...and...and.... --------------------------------------------------------------------------------"> </outline>-<outline text="LaTeX" _note="- - 2 + 2 = 4 - *x* ∈ *y* - *α* ∧ *ω* - 223 - *p*-Tree - Here’s some display math: $$\frac{d}{dx}f(x)=\lim\_{h\to 0}\frac{f(x+h)-f(x)}{h}$$ - Here’s one that has a line break in it: *α* + *ω* × *x*². These shouldn’t be math: - To get the famous equation, write `$e = mc^2$`. - $22,000 is a *lot* of money. So is $34,000. (It worked if “lot” is emphasized.) - Shoes ($20) and socks ($5). - Escaped `$`: $73 *this should be emphasized* 23$. Here’s a LaTeX table: ------------------------------------------------------------------------">+<outline text="LaTeX" _note="- `\cite[22-23]{smith.1899}`{=tex} - $2+2=4$ - $x \in y$ - $\alpha \wedge \omega$ - $223$ - $p$-Tree - Here's some display math: $$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$ - Here's one that has a line break in it: $\alpha + \omega \times x^2$. These shouldn't be math: - To get the famous equation, write `$e = mc^2$`. - \$22,000 is a *lot* of money. So is \$34,000. (It worked if "lot" is emphasized.) - Shoes (\$20) and socks (\$5). - Escaped `$`: \$73 *this should be emphasized* 23\$. Here's a LaTeX table: ```{=tex} \begin{tabular}{|l|l|}\hline Animal & Number \\ \hline Dog & 2 \\ Cat & 1 \\ \hline \end{tabular} ``` --------------------------------------------------------------------------------"> </outline>-<outline text="Special Characters" _note="Here is some unicode: - I hat: Î - o umlaut: ö - section: § - set membership: ∈ - copyright: © AT&T has an ampersand in their name. AT&T is another way to write it. This & that. 4 &lt; 5. 6 &gt; 5. Backslash: \\ Backtick: \` Asterisk: \* Underscore: \_ Left brace: { Right brace: } Left bracket: \[ Right bracket: \] Left paren: ( Right paren: ) Greater-than: &gt; Hash: \# Period: . Bang: ! Plus: + Minus: - ------------------------------------------------------------------------">+<outline text="Special Characters" _note="Here is some unicode: - I hat: Î - o umlaut: ö - section: § - set membership: ∈ - copyright: © AT&T has an ampersand in their name. AT&T is another way to write it. This & that. 4 \< 5. 6 \> 5. Backslash: \\ Backtick: \` Asterisk: \* Underscore: \_ Left brace: { Right brace: } Left bracket: \[ Right bracket: \] Left paren: ( Right paren: ) Greater-than: \> Hash: \# Period: . Bang: ! Plus: + Minus: - --------------------------------------------------------------------------------"> </outline> <outline text="Links">- <outline text="Explicit" _note="Just a [URL](/url/). [URL and title](/url/ "title"). [URL and title](/url/ "title preceded by two spaces"). [URL and title](/url/ "title preceded by a tab"). [URL and title](/url/ "title with "quotes" in it") [URL and title](/url/ "title with single quotes") [with\_underscore](/url/with_underscore) [Email link](mailto:nobody@nowhere.net) [Empty]().">+ <outline text="Explicit" _note="Just a [URL](/url/). [URL and title](/url/ "title"). [URL and title](/url/ "title preceded by two spaces"). [URL and title](/url/ "title preceded by a tab"). [URL and title](/url/ "title with "quotes" in it") [URL and title](/url/ "title with single quotes") [with_underscore](/url/with_underscore) [Email link](mailto:nobody@nowhere.net) [Empty]()."> </outline> <outline text="Reference" _note="Foo [bar](/url/). With [embedded \[brackets\]](/url/). [b](/url/) by itself should be a link. Indented [once](/url). Indented [twice](/url). Indented [thrice](/url). This should \[not\]\[\] be a link. [not]: /url Foo [bar](/url/ "Title with "quotes" inside"). Foo [biz](/url/ "Title with "quote" inside")."> </outline>- <outline text="With ampersands" _note="Here’s a [link with an ampersand in the URL](http://example.com/?foo=1&bar=2). Here’s a link with an amersand in the link text: [AT&T](http://att.com/ "AT&T"). Here’s an [inline link](/script?foo=1&bar=2). Here’s an [inline link in pointy braces](/script?foo=1&bar=2).">+ <outline text="With ampersands" _note="Here's a [link with an ampersand in the URL](http://example.com/?foo=1&bar=2). Here's a link with an amersand in the link text: [AT&T](http://att.com/ "AT&T"). Here's an [inline link](/script?foo=1&bar=2). Here's an [inline link in pointy braces](/script?foo=1&bar=2)."> </outline>- <outline text="Autolinks" _note="With an ampersand: <http://example.com/?foo=1&bar=2> - In a list? - <http://example.com/> - It should. An e-mail address: <nobody@nowhere.net> > Blockquoted: <http://example.com/> Auto-links should not occur here: `<http://example.com/>` or here: <http://example.com/> ------------------------------------------------------------------------">+ <outline text="Autolinks" _note="With an ampersand: <http://example.com/?foo=1&bar=2> - In a list? - <http://example.com/> - It should. An e-mail address: <nobody@nowhere.net> > Blockquoted: <http://example.com/> Auto-links should not occur here: `<http://example.com/>` or here: <http://example.com/> --------------------------------------------------------------------------------"> </outline> </outline>-<outline text="Images" _note="From “Voyage dans la Lune” by Georges Melies (1902):  lalune Here is a movie  icon. ------------------------------------------------------------------------">+<outline text="Images" _note="From "Voyage dans la Lune" by Georges Melies (1902):  Here is a movie  icon. --------------------------------------------------------------------------------"> </outline>-<outline text="Footnotes" _note="Here is a footnote reference,[1] and another.[2] This should *not* be a footnote reference, because it contains a space.\[^my note\] Here is an inline note.[3] > Notes can go in quotes.[4] 1. And in list items.[5] This paragraph should not be part of the note, as it is not indented. [1] Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document. [2] Here’s the long note. This one contains multiple blocks. Subsequent blocks are indented to show that they belong to the footnote (as with list items). { <code> } If you want, you can indent every line, but you can also be lazy and just indent the first line of each block. [3] This is *easier* to type. Inline notes may contain [links](http://google.com) and `]` verbatim characters, as well as \[bracketed text\]. [4] In quote. [5] In list.">+<outline text="Footnotes" _note="Here is a footnote reference,[^1] and another.[^2] This should *not* be a footnote reference, because it contains a space.\[\^my note\] Here is an inline note.[^3] > Notes can go in quotes.[^4] 1. And in list items.[^5] This paragraph should not be part of the note, as it is not indented. [^1]: Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document. [^2]: Here's the long note. This one contains multiple blocks. Subsequent blocks are indented to show that they belong to the footnote (as with list items). { <code> } If you want, you can indent every line, but you can also be lazy and just indent the first line of each block. [^3]: This is *easier* to type. Inline notes may contain [links](http://google.com) and `]` verbatim characters, as well as \[bracketed text\]. [^4]: In quote. [^5]: In list."> </outline> </body> </opml>