mirror of
https://github.com/jaspervdj/patat.git
synced 2024-12-02 06:37:32 +03:00
Support comments
This commit is contained in:
parent
943326d88d
commit
81696a9d2d
19
README.md
19
README.md
@ -211,6 +211,25 @@ two content slides.
|
||||
|
||||
For more information, see [Advanced slide splitting](#advanced-slide-splitting).
|
||||
|
||||
Patat supports comments which can be used as speaker notes.
|
||||
|
||||
---
|
||||
title: This is my presentation
|
||||
author: Jane Doe
|
||||
...
|
||||
|
||||
# Chapter 1
|
||||
|
||||
<!--
|
||||
Note: I should not bore the audience with my thoughts on powerpoint but
|
||||
just get straight to the point.
|
||||
-->
|
||||
|
||||
Slide contents. Yay.
|
||||
|
||||
<!-- TODO: Finish the rest of the presentation. -->
|
||||
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
|
@ -15,7 +15,7 @@ import Control.Applicative ((<$>))
|
||||
import Control.Monad (mplus, unless)
|
||||
import qualified Data.Aeson.Extended as A
|
||||
import Data.Data.Extended (grecQ)
|
||||
import Data.List (intersperse)
|
||||
import qualified Data.List as L
|
||||
import Data.Maybe (fromMaybe)
|
||||
import Data.Monoid (mconcat, mempty, (<>))
|
||||
import qualified Data.Text as T
|
||||
@ -113,11 +113,11 @@ dumpPresentation :: Presentation -> IO ()
|
||||
dumpPresentation pres =
|
||||
let theme = fromMaybe Theme.defaultTheme (psTheme $ pSettings pres) in
|
||||
PP.putDoc $ withWrapSettings (pSettings pres) $
|
||||
PP.vcat $ intersperse "----------" $ do
|
||||
PP.vcat $ L.intersperse "----------" $ do
|
||||
slide <- pSlides pres
|
||||
return $ case slide of
|
||||
TitleSlide block -> "~~~title" <$$> prettyBlock theme block
|
||||
ContentSlide fragments -> PP.vcat $ intersperse "~~~frag" $ do
|
||||
ContentSlide fragments -> PP.vcat $ L.intersperse "~~~frag" $ do
|
||||
fragment <- fragments
|
||||
return $ prettyFragment theme fragment
|
||||
|
||||
@ -238,7 +238,7 @@ prettyBlock theme@Theme {..} (Pandoc.LineBlock inliness) =
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
prettyBlocks :: Theme -> [Pandoc.Block] -> PP.Doc
|
||||
prettyBlocks theme = PP.vcat . map (prettyBlock theme)
|
||||
prettyBlocks theme = PP.vcat . map (prettyBlock theme) . filter isVisibleBlock
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@ -327,3 +327,11 @@ isReferenceLink :: Pandoc.Inline -> Bool
|
||||
isReferenceLink (Pandoc.Link _attrs text (target, _)) =
|
||||
[Pandoc.Str target] /= text
|
||||
isReferenceLink _ = False
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
isVisibleBlock :: Pandoc.Block -> Bool
|
||||
isVisibleBlock Pandoc.Null = False
|
||||
isVisibleBlock (Pandoc.RawBlock (Pandoc.Format "html") t) =
|
||||
not ("<!--" `L.isPrefixOf` t && "-->" `L.isSuffixOf` t)
|
||||
isVisibleBlock _ = True
|
||||
|
@ -1,4 +1,4 @@
|
||||
resolver: lts-11.5
|
||||
resolver: lts-11.7
|
||||
packages:
|
||||
- '.'
|
||||
flags:
|
||||
@ -7,3 +7,4 @@ flags:
|
||||
extra-deps:
|
||||
- 'pandoc-2.2'
|
||||
- 'pandoc-types-1.17.4.2'
|
||||
- 'haddock-library-1.5.0.1'
|
||||
|
16
tests/comments.md
Normal file
16
tests/comments.md
Normal file
@ -0,0 +1,16 @@
|
||||
# This is a test
|
||||
|
||||
Hello world
|
||||
|
||||
<!--
|
||||
This is a comment so please don't include it.
|
||||
-->
|
||||
|
||||
# This is a second slide
|
||||
|
||||
<!--- Differently-formatted comment -->
|
||||
|
||||
Where are my raw blocks at
|
||||
|
||||
<!-- Differently-formatted
|
||||
comment -->
|
8
tests/comments.md.dump
Normal file
8
tests/comments.md.dump
Normal file
@ -0,0 +1,8 @@
|
||||
[34m# This is a test[0m
|
||||
|
||||
[mHello world[0m
|
||||
|
||||
[m----------[0m
|
||||
[34m# This is a second slide[0m
|
||||
|
||||
[mWhere are my raw blocks at[0m
|
Loading…
Reference in New Issue
Block a user