Skip to content

Commit a0cfb3f

Browse files
authored
Vimdoc writer (#11132)
Support for vimdoc, documentation format used by vim in its help pages. Relies heavily on definition lists and precise text alignment to generate tags.
1 parent 0ce85b0 commit a0cfb3f

15 files changed

+1877
-1
lines changed

MANUAL.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ header when requesting a document from a URL:
361361
- `s5` ([S5] HTML and JavaScript slide show)
362362
- `tei` ([TEI Simple])
363363
- `typst` ([typst])
364+
- `vimdoc` ([Vimdoc])
364365
- `xml` (XML version of native AST)
365366
- `xwiki` ([XWiki markup])
366367
- `zimwiki` ([ZimWiki markup])
@@ -511,6 +512,7 @@ header when requesting a document from a URL:
511512
[DokuWiki markup]: https://www.dokuwiki.org/dokuwiki
512513
[ZimWiki markup]: https://zim-wiki.org/manual/Help/Wiki_Syntax.html
513514
[XWiki markup]: https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiSyntax/
515+
[Vimdoc]: https://vimhelp.org/helphelp.txt.html#help-writing
514516
[TWiki markup]: https://twiki.org/cgi-bin/view/TWiki/TextFormattingRules
515517
[TikiWiki markup]: https://doc.tiki.org/Wiki-Syntax-Text#The_Markup_Language_Wiki-Syntax
516518
[Haddock markup]: https://www.haskell.org/haddock/doc/html/ch03s08.html

data/templates/default.vimdoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
$if(filename)$*${filename}* $endif$$if(abstract)$${abstract}$endif$$if(filename)$
2+
3+
4+
$endif$$if(combined-title)$${combined-title}
5+
6+
7+
$endif$$toc-reminder$
8+
9+
$if(toc)$
10+
$toc$
11+
12+
$endif$
13+
14+
$body$
15+
16+
$modeline$

pandoc.cabal

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ description: Pandoc is a Haskell library for converting from one markup
2323
txt2tags, djot)
2424
- HTML formats (HTML 4 and 5)
2525
- Ebook formats (EPUB v2 and v3, FB2)
26-
- Documentation formats (GNU TexInfo, Haddock)
26+
- Documentation formats (GNU TexInfo, Haddock, Vimdoc)
2727
- Roff formats (man, ms)
2828
- TeX formats (LaTeX, ConTeXt)
2929
- Typst
@@ -110,6 +110,7 @@ data-files:
110110
data/templates/fonts.latex
111111
data/templates/font-settings.latex
112112
data/templates/after-header-includes.latex
113+
data/templates/default.vimdoc
113114

114115
-- translations
115116
data/translations/*.yaml
@@ -386,6 +387,7 @@ extra-source-files:
386387
test/writer.zimwiki
387388
test/writer.xwiki
388389
test/writer.muse
390+
test/writer.vimdoc
389391
test/ansi-test.ansi
390392
test/writers-lang-and-dir.latex
391393
test/writers-lang-and-dir.context
@@ -433,6 +435,8 @@ extra-source-files:
433435
test/odt/markdown/*.md
434436
test/odt/native/*.native
435437
test/pod-reader.pod
438+
test/vimdoc/*.markdown
439+
test/vimdoc/*.vimdoc
436440
source-repository head
437441
type: git
438442
location: https://github.com/jgm/pandoc.git
@@ -660,6 +664,7 @@ library
660664
Text.Pandoc.Writers.AnnotatedTable,
661665
Text.Pandoc.Writers.BibTeX,
662666
Text.Pandoc.Writers.ANSI,
667+
Text.Pandoc.Writers.Vimdoc,
663668
Text.Pandoc.PDF,
664669
Text.Pandoc.UTF8,
665670
Text.Pandoc.Scripting,

src/Text/Pandoc/Writers.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ module Text.Pandoc.Writers
7979
, writeXML
8080
, writeXWiki
8181
, writeZimWiki
82+
, writeVimdoc
8283
, getWriter
8384
) where
8485

@@ -132,6 +133,7 @@ import Text.Pandoc.Writers.Typst
132133
import Text.Pandoc.Writers.XML
133134
import Text.Pandoc.Writers.XWiki
134135
import Text.Pandoc.Writers.ZimWiki
136+
import Text.Pandoc.Writers.Vimdoc
135137

136138
data Writer m = TextWriter (WriterOptions -> Pandoc -> m Text)
137139
| ByteStringWriter (WriterOptions -> Pandoc -> m BL.ByteString)
@@ -206,6 +208,7 @@ writers = [
206208
,("djot" , TextWriter writeDjot)
207209
,("ansi" , TextWriter writeANSI)
208210
,("xml" , TextWriter writeXML)
211+
,("vimdoc" , TextWriter writeVimdoc)
209212
]
210213

211214
-- | Retrieve writer, extensions based on formatSpec (format+extensions).

0 commit comments

Comments
 (0)