Skip to content

Ability to render HTML from JSON #17

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

Merged
merged 17 commits into from
Jan 5, 2020
Merged

Ability to render HTML from JSON #17

merged 17 commits into from
Jan 5, 2020

Conversation

hasan-ozbey
Copy link
Contributor

@hasan-ozbey hasan-ozbey commented Jan 4, 2020

For #16

okay i've made some radical changes so take your time to analyze it.

with these changes, you'll be able to convert JSON renderer's output to any other HTML (Inline or SideBySide) renderer's output.

Here's a sample usage:

$old = "old text";
$new = "new text";
$differOptions = [ ... ];
$rendererOptions = [ ... ];

// JSON result to store in a db table
$JsonResult = DiffHelper::calculate($old, $new, 'Json', $differOptions, $rendererOptions);
----------------
// Convert it to HTML (Inline Style)
$renderer = RendererFactory::make('Inline', $rendererOptions);
$InlineResult = $renderer->renderArray(json_decode($JsonResult, true));

@jfcherng jfcherng added the enhancement New feature or request label Jan 5, 2020
@jfcherng
Copy link
Owner

jfcherng commented Jan 5, 2020

Thanks you. I am okay with most changes. I would like to do some tweaks and add tests but to save time, I will do it on my side after merging this.

@jfcherng jfcherng merged commit 8235504 into jfcherng:v6 Jan 5, 2020
@jfcherng jfcherng mentioned this pull request Jan 5, 2020
@jfcherng
Copy link
Owner

jfcherng commented Jan 5, 2020

Has been added in 6.3.0.

@hasan-ozbey hasan-ozbey deleted the the-turk-patch branch January 5, 2020 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants