diff options
Diffstat (limited to 'blog/blocks.py')
-rw-r--r-- | blog/blocks.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/blog/blocks.py b/blog/blocks.py new file mode 100644 index 0000000..2a313ed --- /dev/null +++ b/blog/blocks.py @@ -0,0 +1,22 @@ +from wagtail.core import blocks + +CODE_CHOICES = [ + ('python', 'python'), + ('javascript', 'javascript'), + ('css', 'css'), + ('markup', 'markup'), + ('html', 'html'), + ('go', 'go'), + ('bash', 'bash'), +] + + +class CodeBlock(blocks.StructBlock): + language = blocks.ChoiceBlock(choices=CODE_CHOICES, default="bash") + text = blocks.TextBlock() + + class Meta: + template = "blog/code_block.html" + icon = "openquote" + label = "Code Block" + |