Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'release/0.3.5'

  • Loading branch information...
commit 9976d778c15cc9f9fd10adc3e6faf45e307575c3 2 parents 8523882 + 6a46fcd
Shuhei Tanuma authored
34 Changelog
... ... @@ -1,11 +1,35 @@
1   -2010-04-22 Shuhei Tanuma <chobieeee@php.net>
  1 +2012-05-17 Shuhei Tanuma <chobieeee@php.net>
  2 +
  3 + * bumped up 0.3.5
  4 +
  5 + fix #19 Autolink is broken for emails
  6 +
  7 + [added constants]:
  8 + Sundown\Render\MKDA_NORMAL
  9 + Sundown\Render\MKDA_EMAIL
  10 +
  11 + [changed signature]:
  12 + Sundown\Render\Base::autolink(string$link, int $type)
  13 + type should be Sundown\Render\MKDA_NORMAL or Sundown\Render\MKDA_EMAIL
  14 +
  15 +2012-05-14 Shuhei Tanuma <chobieeee@php.net>
  16 +
  17 + * bumped up 0.3.4
  18 +
  19 + [summary]
  20 + * add Sundown\Render\HTML_TOC render.
  21 + * add Sundown\Markdown::setRender(Sundown\Render\Base $render);
  22 + * improve build script.
  23 + * add Changelog, adjust package.xml
  24 +
  25 +2012-04-22 Shuhei Tanuma <chobieeee@php.net>
2 26
3 27 * bumped up 0.3.3:
4 28
5 29 [summary]
6 30 * fix #16 missing space_after_headers extension
7 31
8   -2010-04-02 Shuhei Tanuma <chobieeee@php.net>
  32 +2012-04-02 Shuhei Tanuma <chobieeee@php.net>
9 33
10 34 * bumped up 0.3.1:
11 35
@@ -14,7 +38,7 @@
14 38 * fixed segfault when calling render method more than once.
15 39 * implement more test cases.
16 40
17   -2010-03-04 Shuhei Tanuma <chobieeee@php.net>
  41 +2012-03-04 Shuhei Tanuma <chobieeee@php.net>
18 42
19 43 * bumped up 0.3.0:
20 44
@@ -30,7 +54,7 @@
30 54 * fix memory leaks
31 55 * implement more test cases.
32 56
33   -2010-03-04 Shuhei Tanuma <chobieeee@php.net>
  57 +2012-03-04 Shuhei Tanuma <chobieeee@php.net>
34 58
35 59 * bumped up 0.2.0:
36 60
@@ -55,7 +79,7 @@
55 79 * hanging whitespace breaks tables
56 80
57 81
58   -2010-02-05 Shuhei Tanuma <chobieeee@php.net>
  82 +2012-02-05 Shuhei Tanuma <chobieeee@php.net>
59 83
60 84 * bumped up 0.2.0:
61 85 - Initial PECL Sundown release.
4 docs/Render.md
Source Rendered
@@ -35,7 +35,9 @@ there are two render in php-sundown:
35 35
36 36 ### SundownRenderBase::tableCell(string $content, string $alignment)
37 37
38   -### SundownRenderBase::autolink(string $link, string $link_type)
  38 +### SundownRenderBase::autolink(string $link, long $link_type)
  39 +
  40 +link type should be Sundown\Render\MKDA_EMAIL or Sundown\Render\MKDA_NORMAL.
39 41
40 42 ### SundownRenderBase::codespan(string $code)
41 43
44 package.xml
@@ -15,10 +15,10 @@ PECL Sundown provides straight forward object oriented Markdown API and customiz
15 15 <email>chobieeee@php.net</email>
16 16 <active>yes</active>
17 17 </lead>
18   - <date>2012-05-14</date>
  18 + <date>2012-05-16</date>
19 19 <version>
20   - <release>0.3.4</release>
21   - <api>0.3.4</api>
  20 + <release>0.3.5</release>
  21 + <api>0.3.5</api>
22 22 </version>
23 23 <stability>
24 24 <release>beta</release>
@@ -26,14 +26,18 @@ PECL Sundown provides straight forward object oriented Markdown API and customiz
26 26 </stability>
27 27 <license uri="http://www.php.net/license">PHP</license>
28 28 <notes>
29   -bumped up 0.3.4
  29 + * bumped up 0.3.5
30 30
31   -[summary]
32   - * add Sundown\Render\HTML_TOC render.
33   - * add Sundown\Markdown::setRender(Sundown\Render\Base $render);
34   - * improve build script.
35   - * add Changelog, adjust package.xml
36   - </notes>
  31 +fix #19 Autolink is broken for emails
  32 +
  33 +[added constants]:
  34 +Sundown\Render\MKDA_NORMAL
  35 +Sundown\Render\MKDA_EMAIL
  36 +
  37 +[changed signature]:
  38 +Sundown\Render\Base::autolink(string$link, int $type)
  39 + type should be Sundown\Render\MKDA_NORMAL or Sundown\Render\MKDA_EMAIL
  40 +</notes>
37 41 <contents>
38 42 <dir name="/">
39 43 <file role="doc" name="CREDITS" />
@@ -129,6 +133,26 @@ bumped up 0.3.4
129 133 <api>beta</api>
130 134 </stability>
131 135 <version>
  136 + <release>0.3.4</release>
  137 + <api>0.3.4</api>
  138 + </version>
  139 + <date>2012-05-14</date>
  140 + <notes>
  141 + * bumped up 0.3.4
  142 +
  143 + [summary]
  144 + * add Sundown\Render\HTML_TOC render.
  145 + * add Sundown\Markdown::setRender(Sundown\Render\Base $render);
  146 + * improve build script.
  147 + * add Changelog, adjust package.xml
  148 + </notes>
  149 + </release>
  150 + <release>
  151 + <stability>
  152 + <release>beta</release>
  153 + <api>beta</api>
  154 + </stability>
  155 + <version>
132 156 <release>0.3.3</release>
133 157 <api>0.3.0</api>
134 158 </version>
2  php_sundown.c
@@ -222,6 +222,8 @@ PHP_MINIT_FUNCTION(sundown) {
222 222
223 223 REGISTER_NS_STRING_CONSTANT(ZEND_NS_NAME("Sundown","Render"), "HTML", "Sundown\\Render\\HTML", CONST_CS | CONST_PERSISTENT);
224 224 REGISTER_NS_LONG_CONSTANT(ZEND_NS_NAME("Sundown","Render"), "LIST_ORDERED", 1, CONST_CS | CONST_PERSISTENT);
  225 + REGISTER_NS_LONG_CONSTANT(ZEND_NS_NAME("Sundown","Render"), "MKDA_EMAIL", MKDA_EMAIL, CONST_CS | CONST_PERSISTENT);
  226 + REGISTER_NS_LONG_CONSTANT(ZEND_NS_NAME("Sundown","Render"), "MKDA_NORMAL", MKDA_NORMAL, CONST_CS | CONST_PERSISTENT);
225 227 return SUCCESS;
226 228 }
227 229
7 render_base.c
@@ -352,12 +352,13 @@ PHP_METHOD(sundown_render_base, tableCell)
352 352 */
353 353 PHP_METHOD(sundown_render_base, autolink)
354 354 {
355   - char *link, *link_type;
356   - int link_len, link_type_len;
  355 + char *link;
  356 + int link_len;
  357 + long link_type;
357 358 php_sundown_buffer_t *object;
358 359
359 360 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
360   - "ss",&link, &link_len, &link_type, &link_type_len) == FAILURE) {
  361 + "sl",&link, &link_len, &link_type) == FAILURE) {
361 362 return;
362 363 }
363 364 RETVAL_STRINGL(link,link_len,1);
13 render_html.c
@@ -458,23 +458,22 @@ PHP_METHOD(sundown_render_html, tableCell)
458 458 */
459 459 PHP_METHOD(sundown_render_html, autolink)
460 460 {
461   - char *link, *link_type;
462   - int link_len, link_type_len;
  461 + char *link;
  462 + int link_len = 0;
  463 + long link_type;
463 464 struct buf *m_link, *output;
464 465 php_sundown_buffer_t *object;
465   - /* @Todo: map types. */
466   - enum mkd_autolink type = MKDA_NORMAL;
467 466 php_sundown_render_html_t *html;
468 467
469 468 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
470   - "ss", &link, &link_len, &link_type, &link_type_len) == FAILURE) {
  469 + "sl", &link, &link_len, &link_type) == FAILURE) {
471 470 return;
472 471 }
473   -
  472 +
474 473 m_link = str2buf(link, link_len);
475 474 output = bufnew(128);
476 475 html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC);
477   - html->cb.autolink(output,m_link,type, &html->html);
  476 + html->cb.autolink(output,m_link,link_type, &html->html);
478 477 bufrelease(m_link);
479 478 RETVAL_STRINGL(output->data, output->size,1);
480 479 bufrelease(output);
10 sundown_markdown.c
@@ -109,15 +109,7 @@ static void rndr_tablecell(struct buf *ob, const struct buf *text, int align, vo
109 109 */
110 110 static int rndr_autolink(struct buf *ob, const struct buf *link, enum mkd_autolink type, void *opaque)
111 111 {
112   - zval *m_type;
113   -
114   - MAKE_STD_ZVAL(m_type);
115   - if (type == MKDA_NORMAL) {
116   - ZVAL_STRING(m_type, "url",1);
117   - } else {
118   - ZVAL_STRING(m_type, "email",1);
119   - }
120   - SPAN_CALLBACK_EX(ob,"autolink", 2,buf2str(link),m_type);
  112 + SPAN_CALLBACK_EX(ob,"autolink", 2,buf2str(link),buf2long(type));
121 113 }
122 114
123 115 static int rndr_codespan(struct buf *ob, const struct buf *text, void *opaque)
28 tests/999-regression-no19.phpt
... ... @@ -0,0 +1,28 @@
  1 +--TEST--
  2 +Check for https://github.com/chobie/php-sundown/issues/19
  3 +--SKIPIF--
  4 +<?php if (!extension_loaded("sundown")) print "skip"; ?>
  5 +--FILE--
  6 +<?php
  7 +//https://github.com/chobie/php-sundown/issues/19
  8 +$sundown = new Sundown\Markdown(
  9 + new Sundown\Render\HTML(array('hard_wrap' => true)),
  10 + array(
  11 + 'no_intra_emphasis' =>true,
  12 + 'tables' => true,
  13 + 'fenced_code_blocks' => true,
  14 + 'autolink' => true,
  15 + 'strikethrough' => true,
  16 + 'lax_html_blocks' => true,
  17 + )
  18 +);
  19 +
  20 +echo $sundown->render(
  21 + <<<MARKDOWN
  22 +http://foo.bar/
  23 +test@example.com
  24 +MARKDOWN
  25 +);
  26 +--EXPECT--
  27 +<p><a href="http://foo.bar/">http://foo.bar/</a><br>
  28 +<a href="mailto:test@example.com">test@example.com</a></p>

0 comments on commit 9976d77

Please sign in to comment.
Something went wrong with that request. Please try again.