diff options
| author | Nokome Bentley <me@noko.me> | 2018-03-06 06:44:34 +1300 | 
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2018-03-05 09:44:34 -0800 | 
| commit | 7d193b2aadfed75b4c85a97f24ba5b36a3961fa9 (patch) | |
| tree | f5bbfec79a03861b6037b2ebba3219edefadc8d0 /src/Text/Pandoc/Writers | |
| parent | 475f46fa7ca731429ffb3197e6e1d1d69258ba80 (diff) | |
| download | pandoc-7d193b2aadfed75b4c85a97f24ba5b36a3961fa9.tar.gz | |
Remove extraneous, significant whitespace in JATS writer output (#4335)
This patch fixes some cases where the JATS writer was introducing
semantically significant whitespace by indenting and wrapping tags.
Note that the JATS spec has a content model for `<p>` tags of `(#PCDATA | ...`.
Any tag where `#PCDATA` children are possible should not have any
indentation. The same is true for `<th>`, `<td>`, `<term>`, `<label>`.
Diffstat (limited to 'src/Text/Pandoc/Writers')
| -rw-r--r-- | src/Text/Pandoc/Writers/JATS.hs | 12 | 
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/JATS.hs b/src/Text/Pandoc/Writers/JATS.hs index 639961acd..3b33e5a19 100644 --- a/src/Text/Pandoc/Writers/JATS.hs +++ b/src/Text/Pandoc/Writers/JATS.hs @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  Conversion of 'Pandoc' documents to JATS XML.  Reference: -https://jats.nlm.nih.gov/publishing/tag-library/1.1d3/element/mml-math.html +https://jats.nlm.nih.gov/publishing/tag-library  -}  module Text.Pandoc.Writers.JATS ( writeJATS ) where  import Control.Monad.Reader @@ -139,7 +139,7 @@ deflistItemToJATS opts term defs = do    term' <- inlinesToJATS opts term    def' <- blocksToJATS opts $ concatMap (map plainToPara) defs    return $ inTagsIndented "def-item" $ -      inTagsIndented "term" term' $$ +      inTagsSimple "term" term' $$        inTagsIndented "def" def'  -- | Convert a list of lists of blocks to a list of JATS list items. @@ -156,7 +156,7 @@ listItemToJATS :: PandocMonad m  listItemToJATS opts mbmarker item = do    contents <- blocksToJATS opts item    return $ inTagsIndented "list-item" $ -           maybe empty (\lbl -> inTagsIndented "label" (text lbl)) mbmarker +           maybe empty (\lbl -> inTagsSimple "label" (text lbl)) mbmarker             $$ contents  imageMimeType :: String -> [(String, String)] -> (String, String) @@ -250,7 +250,7 @@ blockToJATS _ (Para [Image (ident,_,kvs) _ (src, tit)]) = do                          "xlink:type"]]    return $ selfClosingTag "graphic" attr  blockToJATS opts (Para lst) = -  inTagsIndented "p" <$> inlinesToJATS opts lst +  inTagsSimple "p" <$> inlinesToJATS opts lst  blockToJATS opts (LineBlock lns) =    blockToJATS opts $ linesToPara lns  blockToJATS opts (BlockQuote blocks) = @@ -326,10 +326,10 @@ tableItemToJATS :: PandocMonad m                     -> [Block]                     -> JATS m Doc  tableItemToJATS opts isHeader [Plain item] = -  inTags True (if isHeader then "th" else "td") [] <$> +  inTags False (if isHeader then "th" else "td") [] <$>      inlinesToJATS opts item  tableItemToJATS opts isHeader item = -  (inTags True (if isHeader then "th" else "td") [] . vcat) <$> +  (inTags False (if isHeader then "th" else "td") [] . vcat) <$>      mapM (blockToJATS opts) item  -- | Convert a list of inline elements to JATS.  | 
