Permalink
Browse files

Merge branch 'release/0.3.5'

  • Loading branch information...
2 parents 8523882 + 6a46fcd commit 9976d778c15cc9f9fd10adc3e6faf45e307575c3 @chobie committed May 16, 2012
Showing with 107 additions and 35 deletions.
  1. +29 −5 Changelog
  2. +3 −1 docs/Render.md
  3. +34 −10 package.xml
  4. +2 −0 php_sundown.c
  5. +4 −3 render_base.c
  6. +6 −7 render_html.c
  7. +1 −9 sundown_markdown.c
  8. +28 −0 tests/999-regression-no19.phpt
View
@@ -1,11 +1,35 @@
-2010-04-22 Shuhei Tanuma <chobieeee@php.net>
+2012-05-17 Shuhei Tanuma <chobieeee@php.net>
+
+ * bumped up 0.3.5
+
+ fix #19 Autolink is broken for emails
+
+ [added constants]:
+ Sundown\Render\MKDA_NORMAL
+ Sundown\Render\MKDA_EMAIL
+
+ [changed signature]:
+ Sundown\Render\Base::autolink(string$link, int $type)
+ type should be Sundown\Render\MKDA_NORMAL or Sundown\Render\MKDA_EMAIL
+
+2012-05-14 Shuhei Tanuma <chobieeee@php.net>
+
+ * bumped up 0.3.4
+
+ [summary]
+ * add Sundown\Render\HTML_TOC render.
+ * add Sundown\Markdown::setRender(Sundown\Render\Base $render);
+ * improve build script.
+ * add Changelog, adjust package.xml
+
+2012-04-22 Shuhei Tanuma <chobieeee@php.net>
* bumped up 0.3.3:
[summary]
* fix #16 missing space_after_headers extension
-2010-04-02 Shuhei Tanuma <chobieeee@php.net>
+2012-04-02 Shuhei Tanuma <chobieeee@php.net>
* bumped up 0.3.1:
@@ -14,7 +38,7 @@
* fixed segfault when calling render method more than once.
* implement more test cases.
-2010-03-04 Shuhei Tanuma <chobieeee@php.net>
+2012-03-04 Shuhei Tanuma <chobieeee@php.net>
* bumped up 0.3.0:
@@ -30,7 +54,7 @@
* fix memory leaks
* implement more test cases.
-2010-03-04 Shuhei Tanuma <chobieeee@php.net>
+2012-03-04 Shuhei Tanuma <chobieeee@php.net>
* bumped up 0.2.0:
@@ -55,7 +79,7 @@
* hanging whitespace breaks tables
-2010-02-05 Shuhei Tanuma <chobieeee@php.net>
+2012-02-05 Shuhei Tanuma <chobieeee@php.net>
* bumped up 0.2.0:
- Initial PECL Sundown release.
View
@@ -35,7 +35,9 @@ there are two render in php-sundown:
### SundownRenderBase::tableCell(string $content, string $alignment)
-### SundownRenderBase::autolink(string $link, string $link_type)
+### SundownRenderBase::autolink(string $link, long $link_type)
+
+link type should be Sundown\Render\MKDA_EMAIL or Sundown\Render\MKDA_NORMAL.
### SundownRenderBase::codespan(string $code)
View
@@ -15,25 +15,29 @@ PECL Sundown provides straight forward object oriented Markdown API and customiz
<email>chobieeee@php.net</email>
<active>yes</active>
</lead>
- <date>2012-05-14</date>
+ <date>2012-05-16</date>
<version>
- <release>0.3.4</release>
- <api>0.3.4</api>
+ <release>0.3.5</release>
+ <api>0.3.5</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<license uri="http://www.php.net/license">PHP</license>
<notes>
-bumped up 0.3.4
+ * bumped up 0.3.5
-[summary]
- * add Sundown\Render\HTML_TOC render.
- * add Sundown\Markdown::setRender(Sundown\Render\Base $render);
- * improve build script.
- * add Changelog, adjust package.xml
- </notes>
+fix #19 Autolink is broken for emails
+
+[added constants]:
+Sundown\Render\MKDA_NORMAL
+Sundown\Render\MKDA_EMAIL
+
+[changed signature]:
+Sundown\Render\Base::autolink(string$link, int $type)
+ type should be Sundown\Render\MKDA_NORMAL or Sundown\Render\MKDA_EMAIL
+</notes>
<contents>
<dir name="/">
<file role="doc" name="CREDITS" />
@@ -129,6 +133,26 @@ bumped up 0.3.4
<api>beta</api>
</stability>
<version>
+ <release>0.3.4</release>
+ <api>0.3.4</api>
+ </version>
+ <date>2012-05-14</date>
+ <notes>
+ * bumped up 0.3.4
+
+ [summary]
+ * add Sundown\Render\HTML_TOC render.
+ * add Sundown\Markdown::setRender(Sundown\Render\Base $render);
+ * improve build script.
+ * add Changelog, adjust package.xml
+ </notes>
+ </release>
+ <release>
+ <stability>
+ <release>beta</release>
+ <api>beta</api>
+ </stability>
+ <version>
<release>0.3.3</release>
<api>0.3.0</api>
</version>
View
@@ -222,6 +222,8 @@ PHP_MINIT_FUNCTION(sundown) {
REGISTER_NS_STRING_CONSTANT(ZEND_NS_NAME("Sundown","Render"), "HTML", "Sundown\\Render\\HTML", CONST_CS | CONST_PERSISTENT);
REGISTER_NS_LONG_CONSTANT(ZEND_NS_NAME("Sundown","Render"), "LIST_ORDERED", 1, CONST_CS | CONST_PERSISTENT);
+ REGISTER_NS_LONG_CONSTANT(ZEND_NS_NAME("Sundown","Render"), "MKDA_EMAIL", MKDA_EMAIL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_NS_LONG_CONSTANT(ZEND_NS_NAME("Sundown","Render"), "MKDA_NORMAL", MKDA_NORMAL, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
View
@@ -352,12 +352,13 @@ PHP_METHOD(sundown_render_base, tableCell)
*/
PHP_METHOD(sundown_render_base, autolink)
{
- char *link, *link_type;
- int link_len, link_type_len;
+ char *link;
+ int link_len;
+ long link_type;
php_sundown_buffer_t *object;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
- "ss",&link, &link_len, &link_type, &link_type_len) == FAILURE) {
+ "sl",&link, &link_len, &link_type) == FAILURE) {
return;
}
RETVAL_STRINGL(link,link_len,1);
View
@@ -458,23 +458,22 @@ PHP_METHOD(sundown_render_html, tableCell)
*/
PHP_METHOD(sundown_render_html, autolink)
{
- char *link, *link_type;
- int link_len, link_type_len;
+ char *link;
+ int link_len = 0;
+ long link_type;
struct buf *m_link, *output;
php_sundown_buffer_t *object;
- /* @Todo: map types. */
- enum mkd_autolink type = MKDA_NORMAL;
php_sundown_render_html_t *html;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
- "ss", &link, &link_len, &link_type, &link_type_len) == FAILURE) {
+ "sl", &link, &link_len, &link_type) == FAILURE) {
return;
}
-
+
m_link = str2buf(link, link_len);
output = bufnew(128);
html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC);
- html->cb.autolink(output,m_link,type, &html->html);
+ html->cb.autolink(output,m_link,link_type, &html->html);
bufrelease(m_link);
RETVAL_STRINGL(output->data, output->size,1);
bufrelease(output);
View
@@ -109,15 +109,7 @@ static void rndr_tablecell(struct buf *ob, const struct buf *text, int align, vo
*/
static int rndr_autolink(struct buf *ob, const struct buf *link, enum mkd_autolink type, void *opaque)
{
- zval *m_type;
-
- MAKE_STD_ZVAL(m_type);
- if (type == MKDA_NORMAL) {
- ZVAL_STRING(m_type, "url",1);
- } else {
- ZVAL_STRING(m_type, "email",1);
- }
- SPAN_CALLBACK_EX(ob,"autolink", 2,buf2str(link),m_type);
+ SPAN_CALLBACK_EX(ob,"autolink", 2,buf2str(link),buf2long(type));
}
static int rndr_codespan(struct buf *ob, const struct buf *text, void *opaque)
@@ -0,0 +1,28 @@
+--TEST--
+Check for https://github.com/chobie/php-sundown/issues/19
+--SKIPIF--
+<?php if (!extension_loaded("sundown")) print "skip"; ?>
+--FILE--
+<?php
+//https://github.com/chobie/php-sundown/issues/19
+$sundown = new Sundown\Markdown(
+ new Sundown\Render\HTML(array('hard_wrap' => true)),
+ array(
+ 'no_intra_emphasis' =>true,
+ 'tables' => true,
+ 'fenced_code_blocks' => true,
+ 'autolink' => true,
+ 'strikethrough' => true,
+ 'lax_html_blocks' => true,
+ )
+);
+
+echo $sundown->render(
+ <<<MARKDOWN
+http://foo.bar/
+test@example.com
+MARKDOWN
+);
+--EXPECT--
+<p><a href="http://foo.bar/">http://foo.bar/</a><br>
+<a href="mailto:test@example.com">test@example.com</a></p>

0 comments on commit 9976d77

Please sign in to comment.