Html documentation generation requires legacy PHP
I tried running the documentation generator and the following error occurred:
PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /home/joe/git/xrnx/Xtra/HtmlGen/api_to_html.php on line 152
And it spit out .html pages with no documentation.
I have PHPv7 on my machine. I've never touched PHP code before, so I looked at their docs and found this.
So I changed api_to_html.php at L152 to this:
$markdown = preg_replace_callback(
'/(={4,}|-{4,})\n(.*?)(={4,}|-{4,})\n/s',
function ($m) {
return "header_transform('$m[1]', '$m[2]')";
},
$markdown
);
And it worked...mostly. The header_transform function came out as plain text on the .html page:
header_transform('============================================================================', 'Renoise Script Debugging HowTo ') In addition to the usual print....
It's a warning, not an error. You can suppress it using the @ character. Example:
$markdown = @preg_replace('/(={4,}|-{4,})\n(.*?)(={4,}|-{4,})\n/se', "header_transform('$1', '$2')", $markdown);
For your fix: header_transform is a function in global space found a bit higher up in the file (line ~51). You must remove the quotes which is converting it to a string. Try:
$markdown = preg_replace_callback(
'/(={4,}|-{4,})\n(.*?)(={4,}|-{4,})\n/s',
function ($m) {
return header_transform('$m[1]', '$m[2]');
},
$markdown
);
Yep, raised this issue too soon, just figured out that fix myself. Thank you!
To get api_to_html.php building the docs with PHP7, Would it be preferable to suppress the warning, or update that statement?
Updating the statement is preferable. :)