aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Shared.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-12-05 09:54:18 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2019-12-05 09:59:50 -0800
commit992f77c17c4c86b7f4836767457094a3a20cdc65 (patch)
tree8983a100f0b03ad8db2f77fd531e11ef4361bda1 /src/Text/Pandoc/Shared.hs
parent5711ca3880ee8844f2e61566b5acee8363e76101 (diff)
downloadpandoc-992f77c17c4c86b7f4836767457094a3a20cdc65.tar.gz
Roll back part of of `--shift-heading-level-by` change.
With positive heading shifts, starting in 2.8 this option caused metadata titles to be removed and changed to regular headings. This behavior is incompatible with the old behavior of `--base-header-level` and breaks old workflows, so with this commit we are rolling back this change. Now, there is an asymmetry in positive and negative heading level shifts: + With positive shifts, the metadata title stays the same and does not get changed to a heading in the body. + With negative shifts, a heading can be converted into the metadata title. I think this is a desirable combination of features, despite the asymmetry. One might, e.g., want to have a document with level-1 section headigs, but render it to HTML with level-2 headings, retaining the metadata title (which pandoc will render as a level-1 heading with the default template). Closes #5957. Revises #5615.
Diffstat (limited to 'src/Text/Pandoc/Shared.hs')
-rw-r--r--src/Text/Pandoc/Shared.hs6
1 files changed, 0 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index efb2e56dd..0e195d3da 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -641,12 +641,6 @@ headerShift n (Pandoc meta (Header m _ ils : bs))
| n < 0
, m + n == 0 = headerShift n $
B.setTitle (B.fromList ils) $ Pandoc meta bs
-headerShift n (Pandoc meta bs)
- | n > 0
- , not (null (docTitle meta))
- = Pandoc meta' (Header n nullAttr (docTitle meta) : bs')
- where
- Pandoc meta' bs' = headerShift n $ B.deleteMeta "title" $ Pandoc meta bs
headerShift n (Pandoc meta bs) = Pandoc meta (walk shift bs)
where
shift :: Block -> Block