Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added failing test case: custom render codeBlock() #13

Closed
wants to merge 1 commit into from

2 participants

@dominics

It seems an overriden codeBlock($code, $language) method in a custom
renderer never gets called. This test checks for normal code blocks and
fenced code blocks.

Unless I'm setting up the renderer wrong?

@dominics dominics Added failing test case: custom render codeBlock()
It seems an overriden codeBlock($code, $language) method in a custom
renderer never gets called. This test checks for normal code blocks and
fenced code blocks.
9ccd882
@chobie chobie closed this in c9eca45
@chobie
Owner

thanks spotting the issue. I've forgotten all of php functions converted to lowercase and stored to function_table.
I'll publish it to PECL soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 1, 2012
  1. @dominics

    Added failing test case: custom render codeBlock()

    dominics authored
    It seems an overriden codeBlock($code, $language) method in a custom
    renderer never gets called. This test checks for normal code blocks and
    fenced code blocks.
This page is out of date. Refresh to see the latest.
Showing with 46 additions and 0 deletions.
  1. +46 −0 tests/006-render-custom-codeblock.phpt
View
46 tests/006-render-custom-codeblock.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Check for custom render of codeBlocks
+--SKIPIF--
+<?php if (!extension_loaded("sundown")) print "skip"; ?>
+--FILE--
+<?php
+
+class CustomRender extends Sundown\Render\Base
+{
+ public function blockCode($code, $language)
+ {
+ echo "OK.";
+ return $code;
+ }
+}
+
+$m = new Sundown\Markdown(
+ new CustomRender(),
+ array()
+);
+
+$m->render('
+This is a normal paragraph.
+
+ This is a code block
+
+This is another normal paragraph.
+');
+
+$m2 = new Sundown\Markdown(
+ new CustomRender(),
+ array('fenced_code_blocks' => true)
+);
+
+$m->render('
+This is a normal paragraph.
+
+``` php
+This is a fenced code block
+```
+
+This is another normal paragraph.
+');
+
+--EXPECT--
+OK.OK.
Something went wrong with that request. Please try again.