From 6ea706256de67c5480b300b0063729ae8f459c4c Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Sat, 2 Jun 2018 21:37:15 -0700
Subject: [PATCH] Support --number-sections in RST output...

via the "section-numbering" directive in standalone output.
---
 data/templates/default.rst     | 4 ++++
 src/Text/Pandoc/Writers/RST.hs | 1 +
 2 files changed, 5 insertions(+)

diff --git a/data/templates/default.rst b/data/templates/default.rst
index e9c0dc203..937eb72ae 100644
--- a/data/templates/default.rst
+++ b/data/templates/default.rst
@@ -30,6 +30,10 @@ $if(toc)$
    :depth: $toc-depth$
 ..
 
+$endif$
+$if(number-sections)$
+.. section-numbering::
+
 $endif$
 $for(header-includes)$
 $header-includes$
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs
index f82597c55..1fd984a6d 100644
--- a/src/Text/Pandoc/Writers/RST.hs
+++ b/src/Text/Pandoc/Writers/RST.hs
@@ -103,6 +103,7 @@ pandocToRST (Pandoc meta blocks) = do
   let context = defField "body" main
               $ defField "toc" (writerTableOfContents opts)
               $ defField "toc-depth" (show $ writerTOCDepth opts)
+              $ defField "number-sections" (writerNumberSections opts)
               $ defField "math" hasMath
               $ defField "title" (render Nothing title :: String)
               $ defField "math" hasMath