Skip to content

Commit

Permalink
Merge branch 'release/0.3.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
chobie committed Aug 11, 2012
2 parents cf18bf1 + 0854fdd commit fbd4274
Show file tree
Hide file tree
Showing 12 changed files with 353 additions and 281 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "sundown"]
path = sundown
url = https://github.com/tanoku/sundown.git
url = https://github.com/vmg/sundown.git
ignore = dirty
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PHP + Sundown
===========================

php-sundown is just simple wrapper of <https://github.com/tanoku/sundown>.
php-sundown is just simple wrapper of <https://github.com/vmg/sundown>.

[![Build Status](https://secure.travis-ci.org/chobie/php-sundown.png)](http://travis-ci.org/chobie/php-sundown)

Expand Down Expand Up @@ -32,9 +32,8 @@ PHP5.3 higher
Install for developpers
-----------------------

git clone https://github.com/chobie/php-sundown.git php-sundown -b development
git clone https://github.com/chobie/php-sundown.git php-sundown --recursive
cd php-sundown
git submodule init && git submodule update
phpze
./configure
make
Expand Down Expand Up @@ -265,6 +264,8 @@ documented at [ExtensionsAndRenderFlags.md](https://github.com/chobie/php-sundow

Contributors
------------

* Dominic Scheirlinck
* stealth35
* Reeze Xia
* Shuhei Tanuma
* stealth35
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

desc "compile php-sundown"
task :compile => ['sundown/src/markdown.h'] do
sh "phpize"
Expand All @@ -19,6 +18,7 @@ desc "run php test cases"
task :test do
ENV["TESTS"] = "--show-diff -q"
sh "make test"
sh "cat tests/*.diff; if [ $? -eq 0 ];then exit 1; fi"
end

desc "Run conformance tests"
Expand Down
2 changes: 1 addition & 1 deletion config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sundown/html/houdini_html_e.c
"

PHP_NEW_EXTENSION(sundown,$SUNDOWN_SOURCES, $ext_shared)
CFLAGS=" -Wunused-variable -Wpointer-sign -Wimplicit-function-declaration"
CFLAGS="-Wunused-variable -Wpointer-sign -Wimplicit-function-declaration -Winline -Wunused-macros -Wredundant-decls -Wstrict-aliasing=2 -Wswitch-enum -Wdeclaration-after-statement"
PHP_SUBST([CFLAGS])

PHP_ADD_BUILD_DIR([$ext_builddir/sundown/src])
Expand Down
67 changes: 48 additions & 19 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,32 @@ PECL Sundown provides straight forward object oriented Markdown API and customiz
<email>[email protected]</email>
<active>yes</active>
</lead>
<date>2012-06-02</date>
<date>2012-08-11</date>
<version>
<release>0.3.6</release>
<api>0.3.6</api>
<release>0.3.7</release>
<api>0.3.7</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<license uri="http://www.php.net/license">PHP</license>
<notes>
* bumped up 0.3.6

now, php-sundown is able to use under windows box.
Thank you stealth35!
* bumped up 0.3.7

* prettify phpinfo, add ext and sundown version
* windows support
* fix several compile warnings

[removed constants]:
Sundown\Render\LIST_ORDERED
Sundown\Render\MKDA_NORMAL
Sundown\Render\MKDA_EMAIL
fixed SEGV when processing tableCell and prettify source codes.

[added constants]:
Sundown\Render\Base::LIST_ORDERED
Sundown\Render\Base::MKDA_NORMAL
Sundown\Render\Base::MKDA_EMAIL
9582b04 update contributors
1f11ace update README
497d0a4 add a space after comma.
7bc4703 fix several compile warnings
a11eb98 update CFLAGS for fix compile warnings
9a86d00 fixes #26:prevent SEGV when calling Sundwon\Base\tableCell
26b77d6 change submodule to vmg/sundown from tanoku/sundown
ee8a132 Merge pull request #24 from reeze/patch-2
0a08969 Fix build in php-src
b0adcc7 Merge pull request #23 from reeze/patch-1
ebae34b Make travis report test failure since make test didn't report exit code
</notes>
<contents>
<dir name="/">
Expand Down Expand Up @@ -91,6 +88,7 @@ Sundown\Render\Base::MKDA_EMAIL
<file role="test" name="006-render-custom-codeblock.phpt" />
<file role="test" name="999-regression-no12.phpt" />
<file role="test" name="999-regression-no19.phpt" />
<file role="test" name="999-regression-no26.phpt" />
</dir>
<dir name="docs">
<file role="doc" name="ExtensionsAndRenderFlags.md" />
Expand Down Expand Up @@ -135,6 +133,37 @@ Sundown\Render\Base::MKDA_EMAIL
<providesextension>sundown</providesextension>
<extsrcrelease/>
<changelog>
<release>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<version>
<release>0.3.6</release>
<api>0.3.6</api>
</version>
<date>2012-06-02</date>
<notes>
* bumped up 0.3.6

now, php-sundown is able to use under windows box.
Thank you stealth35!

* prettify phpinfo, add ext and sundown version
* windows support
* fix several compile warnings

[removed constants]:
Sundown\Render\LIST_ORDERED
Sundown\Render\MKDA_NORMAL
Sundown\Render\MKDA_EMAIL

[added constants]:
Sundown\Render\Base::LIST_ORDERED
Sundown\Render\Base::MKDA_NORMAL
Sundown\Render\Base::MKDA_EMAIL
</notes>
</release>
<release>
<stability>
<release>beta</release>
Expand Down
52 changes: 26 additions & 26 deletions php_sundown.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,18 @@ static void sundown__render(SundownRendererType render_type, INTERNAL_FUNCTION_P
HashTable *table;

object = getThis();
buffer = Z_STRVAL_P(zend_read_property(sundown_class_entry, getThis(),"data",sizeof("data")-1, 0 TSRMLS_CC));
buffer = Z_STRVAL_P(zend_read_property(sundown_class_entry, getThis(), "data", sizeof("data")-1, 0 TSRMLS_CC));
buffer_len = strlen(buffer);

memset(&input_buf, 0x0, sizeof(struct buf));
input_buf.data = buffer;
input_buf.data = (uint8_t *)buffer;
input_buf.size = strlen(buffer);

output_buf = bufnew(128);
bufgrow(output_buf, strlen(buffer) * 1.2f);

if (Z_TYPE_P(zend_read_property(sundown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC)) != IS_NULL) {
table = Z_ARRVAL_P(zend_read_property(sundown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC));
if (Z_TYPE_P(zend_read_property(sundown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC)) != IS_NULL) {
table = Z_ARRVAL_P(zend_read_property(sundown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC));
}
php_sundown__get_flags(table, &enabled_extensions, &render_flags);

Expand All @@ -77,7 +77,7 @@ static void sundown__render(SundownRendererType render_type, INTERNAL_FUNCTION_P
sdhtml_renderer(&sundown_render, &opt.html, render_flags);
break;
case SUNDOWN_RENDER_TOC:
sdhtml_toc_renderer(&sundown_render,&opt.html);
sdhtml_toc_renderer(&sundown_render, &opt.html);
break;
default:
RETURN_FALSE;
Expand All @@ -88,38 +88,38 @@ static void sundown__render(SundownRendererType render_type, INTERNAL_FUNCTION_P
sd_markdown_render(output_buf, input_buf.data, input_buf.size, markdown);
sd_markdown_free(markdown);

if (Z_BVAL_P(zend_read_property(sundown_class_entry, getThis(),"enable_pants",sizeof("enable_pants")-1, 0 TSRMLS_CC))) {
if (Z_BVAL_P(zend_read_property(sundown_class_entry, getThis(), "enable_pants", sizeof("enable_pants")-1, 0 TSRMLS_CC))) {
struct buf *smart_buf = bufnew(128);
sdhtml_smartypants(smart_buf, output_buf->data,output_buf->size);
RETVAL_STRINGL(smart_buf->data, smart_buf->size,1);
sdhtml_smartypants(smart_buf, output_buf->data, output_buf->size);
RETVAL_STRINGL((char*)smart_buf->data, smart_buf->size, 1);
bufrelease(smart_buf);
} else {
RETVAL_STRINGL(output_buf->data, output_buf->size,1);
RETVAL_STRINGL((char*)output_buf->data, output_buf->size, 1);
}
}

/* {{{ proto string Sundonw::__construct(string $string [, array $extensions])
setup Sundown extension */
PHP_METHOD(sundown, __construct)
{
zval *extensions = NULL,*c_extensions = NULL;
zval *extensions = NULL, *c_extensions = NULL;
char *buffer;
int buffer_len = 0;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,"s|a",&buffer, &buffer_len, &extensions) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|a", &buffer, &buffer_len, &extensions) == FAILURE) {
return;
}

add_property_string_ex(getThis(),"data",sizeof("data"),buffer,1 TSRMLS_CC);
add_property_string_ex(getThis(), "data", sizeof("data"), buffer, 1 TSRMLS_CC);

if (extensions == NULL) {
MAKE_STD_ZVAL(c_extensions);
array_init(c_extensions);
} else {
ALLOC_INIT_ZVAL(c_extensions);
ZVAL_ZVAL(c_extensions,extensions,1,0);
ZVAL_ZVAL(c_extensions, extensions, 1, 0);
}
add_property_zval_ex(getThis(),"extensions",sizeof("extensions"),c_extensions TSRMLS_CC);
add_property_zval_ex(getThis(), "extensions", sizeof("extensions"), c_extensions TSRMLS_CC);
}
/* }}} */

Expand All @@ -129,7 +129,7 @@ PHP_METHOD(sundown, __destruct)
{
zval *extensions;

extensions = zend_read_property(sundown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC);
extensions = zend_read_property(sundown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC);
zval_ptr_dtor(&extensions);
}
/* }}} */
Expand All @@ -138,23 +138,23 @@ PHP_METHOD(sundown, __destruct)
Returns converted HTML string */
PHP_METHOD(sundown, toHtml)
{
sundown__render(SUNDOWN_RENDER_HTML,INTERNAL_FUNCTION_PARAM_PASSTHRU);
sundown__render(SUNDOWN_RENDER_HTML, INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} */

/* {{{ proto string Sundonw::__toString()
Returns converted HTML string */
PHP_METHOD(sundown, __toString)
{
sundown__render(SUNDOWN_RENDER_HTML,INTERNAL_FUNCTION_PARAM_PASSTHRU);
sundown__render(SUNDOWN_RENDER_HTML, INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} */

/* {{{ proto string Sundonw::toToc()
Returns table of contents*/
PHP_METHOD(sundown, toToc)
{
sundown__render(SUNDOWN_RENDER_TOC,INTERNAL_FUNCTION_PARAM_PASSTHRU);
sundown__render(SUNDOWN_RENDER_TOC, INTERNAL_FUNCTION_PARAM_PASSTHRU);
}


Expand All @@ -172,8 +172,8 @@ PHP_METHOD(sundown, hasExtension)
return;
}

if (Z_TYPE_P(zend_read_property(sundown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC)) != IS_NULL) {
table = Z_ARRVAL_P(zend_read_property(sundown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC));
if (Z_TYPE_P(zend_read_property(sundown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC)) != IS_NULL) {
table = Z_ARRVAL_P(zend_read_property(sundown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC));
RETVAL_BOOL(php_sundown_has_ext(table, name));
}
}
Expand All @@ -191,8 +191,8 @@ PHP_METHOD(sundown, hasRenderFlag)
return;
}

if (Z_TYPE_P(zend_read_property(sundown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC)) != IS_NULL) {
table = Z_ARRVAL_P(zend_read_property(sundown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC));
if (Z_TYPE_P(zend_read_property(sundown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC)) != IS_NULL) {
table = Z_ARRVAL_P(zend_read_property(sundown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC));
RETVAL_BOOL(php_sundown_has_ext(table, name));
}
}
Expand Down Expand Up @@ -221,17 +221,17 @@ PHP_MINIT_FUNCTION(sundown) {
php_sundown_render_html_toc_init(TSRMLS_C);
php_sundown_markdown_init(TSRMLS_C);

REGISTER_NS_STRING_CONSTANT(ZEND_NS_NAME("Sundown","Render"), "HTML", "Sundown\\Render\\HTML", CONST_CS | CONST_PERSISTENT);
REGISTER_NS_STRING_CONSTANT(ZEND_NS_NAME("Sundown", "Render"), "HTML", "Sundown\\Render\\HTML", CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}


PHP_MINFO_FUNCTION(sundown)
{
php_info_print_table_start();
php_info_print_table_header(2,"Sundown Support", "enabled");
php_info_print_table_row(2,"Version", PHP_SUNDOWN_EXTVER);
php_info_print_table_row(2,"Sundown Version", SUNDOWN_VERSION);
php_info_print_table_header(2, "Sundown Support", "enabled");
php_info_print_table_row(2, "Version", PHP_SUNDOWN_EXTVER);
php_info_print_table_row(2, "Sundown Version", SUNDOWN_VERSION);
php_info_print_table_end();
}

Expand Down
Loading

0 comments on commit fbd4274

Please sign in to comment.