It will be a little more fragile, but if you're *sure* that you will use heading at the end of document, then you can skip over it, like this: import Text.Pandoc.JSON > > >> main :: IO () > > main = toJSONFilter addHangPara > > >> addHangPara :: Maybe Format -> Block -> Block > > addHangPara (Just (Format "latex")) (Div ("",["references"],[]) >> (h:blocks)) = > > Div ("",["references"],[]) ( [h , latex "\\begin{hangparas}"] ++ > > blocks ++ [latex "\\end{hangparas}"] ) > > where latex = RawBlock (Format "latex") > > addHangPara _ x = x > > It is of course possible to handle cases with no heading as well by pattern-matching "h" as "h@(Header 1 _ _)", and adding handler for other cases, if you need to, but that tends to be unnecessarily verbose. пятница, 27 марта 2015 г., 11:19:17 UTC+3 пользователь nickba...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org написал: > > Thanks a lot. – However, this encloses the "References" section header, > too – and doesn't work since the \section command cancels out the effects > of \begin{hangparas}. > > Actual output: > > \begin{hangparas} > > \section*{References}\label{references} > \addcontentsline{toc}{section}{References} > > \hyperdef{}{ref-item2}{} > Doe, John. ``Article.'' \emph{Journal of Generic Studies} 6, no. 4 > (2006): 33--34. > > \end{hangparas} > > > Expected output: > > \section*{References}\label{references} > \addcontentsline{toc}{section}{References} > > \begin{hangparas} > > \hyperdef{}{ref-item2}{} > Doe, John. ``Article.'' \emph{Journal of Generic Studies} 6, no. 4 > (2006): 33--34. > > \end{hangparas} > > > On Friday, 27 March 2015 04:05:49 UTC, John MacFarlane wrote: >> >> Sure. After the pandoc-citeproc filter is done, your document will >> end with a >> >> Div ("",["references"],[]) [...list of blocks...] >> >> So you could write a filter that adds a bit of raw >> latex "\begin{hangparas}" at the beginning of ...list of blocks... >> and another bit "\end{hangparas}" at the end. >> >> Something like (untested): >> >> import Text.Pandoc.JSON >> >> main :: IO () >> main = toJSONFilter addHangPara >> >> addHangPara :: Maybe Format -> Block -> Block >> addHangPara (Format "latex") (Div ("",["references"],[]) blocks) = >> Div ("",["references"],[]) ( [latex "\\begin{hangparas}"] ++ >> blocks ++ [latex "\\end{hangparas}"] ) >> where latex = RawBlock (Format "latex") >> addHangPara _ x = x >> >> Just make sure you use this filter *after* pandoc-citeproc: >> >> -F pandoc-citeproc -F ./addhangpara.hs >> >> +++ nickba...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [Mar 26 15 12:57 ]: >> >Is there any way – a filter, e.g. – that would let me enclose just the >> >reference list entries – *without* the "References" section header – in >> >latex environment such as `\begin{hangparas} ... \end{hangparas}`? >> > >> >-- >> >You received this message because you are subscribed to the Google >> Groups "pandoc-discuss" group. >> >To unsubscribe from this group and stop receiving emails from it, send >> an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >To view this discussion on the web visit >> https://groups.google.com/d/msgid/pandoc-discuss/ce053b54-950b-497b-ba33-f0a43c0dd559%40googlegroups.com. >> >> >For more options, visit https://groups.google.com/d/optout. >> >> -- You received this message because you are subscribed to the Google Groups "pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/e881c6dc-b3ad-425d-a1d5-7e030adb9d68%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.