Docx reader: Move pandoc inline styling inside custom-style span
Previously Emph, Strong, etc were outside the custom-style span. This moves them inside in order to make it easier to write filters that act on the formatting in these contents. Tests and MANUAL example are changed to match.
This commit is contained in:
parent
87e0728b87
commit
8b7df2d915
3 changed files with 10 additions and 10 deletions
|
@ -4538,8 +4538,8 @@ And with the extension:
|
|||
:::
|
||||
|
||||
::: {custom-style="BodyText"}
|
||||
This is text with an *[emphasized]{custom-style="Emphatic"}* text style.
|
||||
And this is text with a **[strengthened]{custom-style="Strengthened"}**
|
||||
This is text with an [*emphasized*]{custom-style="Emphatic"} text style.
|
||||
And this is text with a [**strengthened**]{custom-style="Strengthened"}
|
||||
text style.
|
||||
:::
|
||||
|
||||
|
|
|
@ -301,37 +301,37 @@ runStyleToTransform rPr
|
|||
extraInfo <- extraRunStyleInfo rPr
|
||||
transform <- local (\e -> e{docxCustomStyleAlready = True}) $
|
||||
runStyleToTransform rPr {isItalic = Nothing}
|
||||
return $ emph . extraInfo . transform
|
||||
return $ extraInfo . emph . transform
|
||||
| Just True <- isBold rPr = do
|
||||
extraInfo <- extraRunStyleInfo rPr
|
||||
transform <- local (\e -> e{docxCustomStyleAlready = True}) $
|
||||
runStyleToTransform rPr {isBold = Nothing}
|
||||
return $ strong . extraInfo . transform
|
||||
return $ extraInfo . strong . transform
|
||||
| Just True <- isSmallCaps rPr = do
|
||||
extraInfo <- extraRunStyleInfo rPr
|
||||
transform <- local (\e -> e{docxCustomStyleAlready = True}) $
|
||||
runStyleToTransform rPr {isSmallCaps = Nothing}
|
||||
return $ smallcaps . extraInfo .transform
|
||||
return $ extraInfo . smallcaps . transform
|
||||
| Just True <- isStrike rPr = do
|
||||
extraInfo <- extraRunStyleInfo rPr
|
||||
transform <- local (\e -> e{docxCustomStyleAlready = True}) $
|
||||
runStyleToTransform rPr {isStrike = Nothing}
|
||||
return $ strikeout . extraInfo . transform
|
||||
return $ extraInfo . strikeout . transform
|
||||
| Just SupScrpt <- rVertAlign rPr = do
|
||||
extraInfo <- extraRunStyleInfo rPr
|
||||
transform <- local (\e -> e{docxCustomStyleAlready = True}) $
|
||||
runStyleToTransform rPr {rVertAlign = Nothing}
|
||||
return $ superscript . extraInfo . transform
|
||||
return $ extraInfo . superscript . transform
|
||||
| Just SubScrpt <- rVertAlign rPr = do
|
||||
extraInfo <- extraRunStyleInfo rPr
|
||||
transform <- local (\e -> e{docxCustomStyleAlready = True}) $
|
||||
runStyleToTransform rPr {rVertAlign = Nothing}
|
||||
return $ subscript . extraInfo . transform
|
||||
return $ extraInfo . subscript . transform
|
||||
| Just "single" <- rUnderline rPr = do
|
||||
extraInfo <- extraRunStyleInfo rPr
|
||||
transform <- local (\e -> e{docxCustomStyleAlready = True}) $
|
||||
runStyleToTransform rPr {rUnderline = Nothing}
|
||||
return $ underlineSpan . extraInfo . transform
|
||||
return $ extraInfo . underlineSpan . transform
|
||||
| otherwise = extraRunStyleInfo rPr
|
||||
|
||||
runToInlines :: PandocMonad m => Run -> DocxContext m Inlines
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[Div ("",[],[("custom-style","FirstParagraph")])
|
||||
[Para [Str "This",Space,Str "is",Space,Str "some",Space,Str "text."]]
|
||||
,Div ("",[],[("custom-style","BodyText")])
|
||||
[Para [Str "This",Space,Str "is",Space,Str "text",Space,Str "with",Space,Str "an",Space,Emph [Span ("",[],[("custom-style","Emphatic")]) [Str "emphasized"]],Space,Str "text",Space,Str "style.",Space,Str "And",Space,Str "this",Space,Str "is",Space,Str "text",Space,Str "with",Space,Str "a",Space,Strong [Span ("",[],[("custom-style","Strengthened")]) [Str "strengthened"]],Space,Str "text",Space,Str "style."]]
|
||||
[Para [Str "This",Space,Str "is",Space,Str "text",Space,Str "with",Space,Str "an",Space,Span ("",[],[("custom-style","Emphatic")]) [Emph [Str "emphasized"]],Space,Str "text",Space,Str "style.",Space,Str "And",Space,Str "this",Space,Str "is",Space,Str "text",Space,Str "with",Space,Str "a",Space,Span ("",[],[("custom-style","Strengthened")]) [Strong [Str "strengthened"]],Space,Str "text",Space,Str "style."]]
|
||||
,Div ("",[],[("custom-style","MyBlockStyle")])
|
||||
[BlockQuote
|
||||
[Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "styled",Space,Str "paragraph",Space,Str "that",Space,Str "inherits",Space,Str "from",Space,Str "Block",Space,Str "Text."]]]]
|
||||
|
|
Loading…
Add table
Reference in a new issue