Bug in "Parse contributors"
pfefferle opened this issue · 2 comments
There is a bug in the "Parse contributors" code...
I have a code block in my readme
header('Content-Type: application/xrd+xml; charset=' . get_bloginfo('charset'), true);
and the result is:
** header('Content-Type:** application/xrd+xml; charset=' . get_bloginfo('charset'), true);
I noticed this bug too. It occurs every time a text line contains a colon ":" character. The code which performs this text replacement should be executed only for plugin header section and not in the whole document.
Here's a quick fix: in wp_readme_to_markdow.js replace the line
readme = readme.replace( new RegExp("^([^:\r\n*]{1}[^:\r\n#\\]\\[]+): (.+)","gim"),"**$1:** $2 ");
with the following snippet
if ( header_match && header_match.length >= 1 ) {
var header_search = header_match[1];
var header_replace = header_search.replace( new RegExp("^([^:\r\n*]{1}[^:\r\n#\\]\\[]+): (.+)","gim"),"**$1:** $2 ");
readme = readme.replace( header_search, header_replace );
}
Thanks @marcochiesi I've made some changes to your original PR, but this should be fixed now. I'll be publishing a new release shortly.