Revert "Allow specifying string value in metadata using !!literal tag."

This reverts commit 3493d6afaa.

This might be worth considering in the future, but let's not do
it yet...the additional complexity needs a better justification.
This commit is contained in:
John MacFarlane 2020-02-17 15:58:21 -08:00
parent 3493d6afaa
commit 0edc084c50
3 changed files with 5 additions and 23 deletions

View file

@ -3914,8 +3914,7 @@ from the main markdown input document.
Metadata will be taken from the fields of the YAML object and added to any Metadata will be taken from the fields of the YAML object and added to any
existing document metadata. Metadata can contain lists and objects (nested existing document metadata. Metadata can contain lists and objects (nested
arbitrarily), but all string scalars will be interpreted as arbitrarily), but all string scalars will be interpreted as Markdown. Fields
Markdown, unless marked with the YAML tag `!!literal`. Fields
with names ending in an underscore will be ignored by pandoc. (They may be with names ending in an underscore will be ignored by pandoc. (They may be
given a role by external processors.) Field names must not be given a role by external processors.) Field names must not be
interpretable as YAML numbers or boolean values (so, for interpretable as YAML numbers or boolean values (so, for
@ -3946,11 +3945,6 @@ when the field contains blank lines or block-level formatting:
This is the abstract. This is the abstract.
It consists of two paragraphs. It consists of two paragraphs.
# This is a YAML comment; it will be ignored.
# The following field is marked as literal and will be
# interpreted as a literal string rather than Markdown:
catalog_number: !!literal '*abc123<f>*'
... ...
Template variables will be set automatically from the metadata. Thus, for Template variables will be set automatically from the metadata. Thus, for

View file

@ -99,12 +99,10 @@ yamlToMetaValue pBlocks (YAML.Scalar _ x) =
YAML.SBool b -> return $ return $ MetaBool b YAML.SBool b -> return $ return $ MetaBool b
YAML.SFloat d -> return $ return $ MetaString $ tshow d YAML.SFloat d -> return $ return $ MetaString $ tshow d
YAML.SInt i -> return $ return $ MetaString $ tshow i YAML.SInt i -> return $ return $ MetaString $ tshow i
YAML.SUnknown tag t YAML.SUnknown _ t ->
| (T.takeWhileEnd (/= ':') <$> YE.tagToText tag) == case checkBoolean t of
Just "literal" -> return $ return $ MetaString t Just b -> return $ return $ MetaBool b
| otherwise -> case checkBoolean t of Nothing -> toMetaValue pBlocks t
Just b -> return $ return $ MetaBool b
Nothing -> toMetaValue pBlocks t
YAML.SNull -> return $ return $ MetaString "" YAML.SNull -> return $ return $ MetaString ""
yamlToMetaValue pBlocks (YAML.Sequence _ _ xs) = do yamlToMetaValue pBlocks (YAML.Sequence _ _ xs) = do

View file

@ -1,10 +0,0 @@
```
% pandoc -t native -s
---
hi: !!literal '*ook*'
there: '*ook*'
...
^D
Pandoc (Meta {unMeta = fromList [("hi",MetaString "*ook*"),("there",MetaInlines [Emph [Str "ook"]])]})
[]
```