-
Notifications
You must be signed in to change notification settings - Fork 23
/
delimited_block.go
38 lines (34 loc) · 976 Bytes
/
delimited_block.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package sgml
import (
"fmt"
"github.com/bytesparadise/libasciidoc/pkg/types"
)
func (r *sgmlRenderer) renderDelimitedBlock(ctx *context, b *types.DelimitedBlock) (string, error) {
switch b.Kind {
case types.Example:
if b.Attributes.Has(types.AttrStyle) {
return r.renderAdmonitionBlock(ctx, b)
}
return r.renderExampleBlock(ctx, b)
case types.Fenced:
return r.renderFencedBlock(ctx, b)
case types.Literal:
return r.renderLiteralBlock(ctx, b)
case types.Listing:
return r.renderListingBlock(ctx, b)
case types.MarkdownQuote:
return r.renderMarkdownQuoteBlock(ctx, b)
case types.Passthrough:
return r.renderPassthroughBlock(ctx, b)
case types.Quote:
return r.renderQuoteBlock(ctx, b)
case types.Verse:
return r.renderVerseBlock(ctx, b)
case types.Sidebar:
return r.renderSidebarBlock(ctx, b)
case types.Open:
return r.renderOpenBlock(ctx, b)
default:
return "", fmt.Errorf("unsupported kind of delimited block: '%s'", b.Kind)
}
}