Opened 5 years ago

Closed 5 years ago

#11781 closed Bug (fixed)

The codesnippetgeshi documentation is broken - colorize.php does not exist

Reported by: Piotrek Koszuliński Owned by: Marek Lewandowski
Priority: Normal Milestone: CKEditor 4.4.0
Component: Documentation & Samples Version: 4.4.0
Keywords: Cc:

Description

My idea is to include its source in the documentation for the plugin. The example is just few lines of code and IMO, the file should be kept outside CKEditor directory, to not cause problems during updating CKEditor.

<?php

include_once 'geshi/geshi.php';

$json_string = file_get_contents( 'php://input' );
$json_object = json_decode( $json_string );

$geshi = new GeSHi( $json_object->html, $json_object->lang );

echo $geshi->parse_code();

Change History (12)

comment:1 Changed 5 years ago by Piotrek Koszuliński

Status: newconfirmed

comment:2 Changed 5 years ago by Wiktor Walc

I'm fine with keeping the file inside the documentation.

If we ever gonna include colorize.php in the plugin folder by default and point codeSnippetGeshi_url into it, we should do two things:

  1. provide a reasonable error message in case the PHP file was returned as plain text (PHP is popular, but not every website in the world is using it)
  2. provide an error message (also an instruction), in case the geshi library was not detected

The 2nd point could look like this:

<?php

if (function_exists('stream_resolve_include_path') && stream_resolve_include_path('geshi/geshi.php') === FALSE) {
  die('<pre class="html">Please install the geshi library. Refer to plugins/codesnippetgeshi/README.md for more information.</pre>');
}

include_once 'geshi/geshi.php';

$json_string = file_get_contents( 'php://input' );
$json_object = json_decode( $json_string );

$geshi = new GeSHi( $json_object->html, $json_object->lang );

echo $geshi->parse_code();

die() it is not required if this code will land only in the documentation.

comment:3 Changed 5 years ago by Marek Lewandowski

Owner: set to Marek Lewandowski
Status: confirmedassigned

comment:4 Changed 5 years ago by Marek Lewandowski

Status: assignedreview

Docs pushed to t/11480@docs. They don't incldue JSON entry, because it will cause conflicts with ckeditor-sdk branch. It might be good idea for Anna to have a look on these docs.

Pushed small change to t/11781 at dev.

comment:5 Changed 5 years ago by Piotrek Koszuliński

Status: reviewreview_failed

README.md in codesnippetgeshi plugin directory should contain only a link to docs and nothing more. DRY.

comment:6 Changed 5 years ago by Piotrek Koszuliński

And second thing - created guides were not added to guides.json so they are not available in the menu.

comment:7 Changed 5 years ago by Piotrek Koszuliński

Ok, I got an info from Ania that she'll update guides.json so ignore comment:6.

comment:8 Changed 5 years ago by Piotrek Koszuliński

While using editor in [inline](#!/guide/dev_inline) or divarea mode - styles are not preserved.

Not preserved? This doesn't make sense. There's nothing to be preserved. They are not automatically loaded by CKEditor.

comment:9 Changed 5 years ago by Marek Lewandowski

Added requested update and few typos to t/11480@docs.

Pushed to t/11781 at dev.

comment:10 Changed 5 years ago by Marek Lewandowski

Status: review_failedreview

comment:11 Changed 5 years ago by Marek Lewandowski

Extra changes pushed to docs and t/11781 at dev branch.

comment:12 Changed 5 years ago by Marek Lewandowski

Resolution: fixed
Status: reviewclosed

Fixed with git:ab2f93f049 (merged to major) at dev. Added without changelog entry, since these are only docs changes.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy