Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Html documentation generation requires legacy PHP #53

Open
jcpst opened this issue Jan 21, 2016 · 3 comments
Open

Html documentation generation requires legacy PHP #53

jcpst opened this issue Jan 21, 2016 · 3 comments

Comments

@jcpst
Copy link

jcpst commented Jan 21, 2016

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....
@dac514
Copy link
Contributor

dac514 commented Jan 21, 2016

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
);

@jcpst
Copy link
Author

jcpst commented Jan 21, 2016

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?

@dac514
Copy link
Contributor

dac514 commented Jan 21, 2016

Updating the statement is preferable. :)

bjorn-nesby added a commit that referenced this issue Feb 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants