Moodle Community Sites

PHP syntax highighter in Moodle docs

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Component/s: docs.moodle.org
  • Labels:
    None

Description

Mediawiki has a PHP syntax filter, it would be really handy to activate it on docs.moodle.org. We are starting to have quite a few PHP code samples, which are much easier to ready when highlighted correctly.

Activity

Hide
Helen Foster added a comment -

Eloy, please could we consider this once we've completed the wiki upgrade.

Example page where PHP syntax highlighter would help: http://docs.moodle.org/en/Development:dmllib_2.0_migration_docs

Show
Helen Foster added a comment - Eloy, please could we consider this once we've completed the wiki upgrade. Example page where PHP syntax highlighter would help: http://docs.moodle.org/en/Development:dmllib_2.0_migration_docs
Hide
Eloy Lafuente (stronk7) added a comment -

I think this is the filter:

http://www.mediawiki.org/wiki/Extension:GeSHiCodeTag

Installed and running in Test Docs:

http://docs.moodle.org/test/Sandbox#Some_syntax_highlight

Please test and will install in production (with Helen/MD approval).

Ciao

Show
Eloy Lafuente (stronk7) added a comment - I think this is the filter: http://www.mediawiki.org/wiki/Extension:GeSHiCodeTag Installed and running in Test Docs: http://docs.moodle.org/test/Sandbox#Some_syntax_highlight Please test and will install in production (with Helen/MD approval). Ciao
Hide
Martin Dougiamas added a comment -

+1 from me!

Show
Martin Dougiamas added a comment - +1 from me!
Hide
Eloy Lafuente (stronk7) added a comment -

Done. Now it's installed in production wiki.

<code php>...</code> are the tags to use.

Some examples:

http://docs.moodle.org/en/Development:DML_functions

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Done. Now it's installed in production wiki. <code php>...</code> are the tags to use. Some examples: http://docs.moodle.org/en/Development:DML_functions Ciao
Hide
Eloy Lafuente (stronk7) added a comment -

Detected problem with HTML templates and Geshi trying to process them.

I've disabled disabled "simple" mode so only <code xxx>...<code> parts will be processed. Templates woking ok now, with highligter enabled:

http://docs.moodle.org/en/About_Moodle
http://docs.moodle.org/en/Development:DML_functions

Show
Eloy Lafuente (stronk7) added a comment - Detected problem with HTML templates and Geshi trying to process them. I've disabled disabled "simple" mode so only <code xxx>...<code> parts will be processed. Templates woking ok now, with highligter enabled: http://docs.moodle.org/en/About_Moodle http://docs.moodle.org/en/Development:DML_functions
Hide
Helen Foster added a comment -

Nicolas, thanks for suggesting this feature, and Eloy, thanks for implementing it

I'll add a note about the PHP syntax highlighting filter to Moodle Docs before closing this issue.

Show
Helen Foster added a comment - Nicolas, thanks for suggesting this feature, and Eloy, thanks for implementing it I'll add a note about the PHP syntax highlighting filter to Moodle Docs before closing this issue.
Hide
Helen Foster added a comment -

Reopening this issue, as using <code xxx>...</code> for the PHP syntax highlighter causes a problem for all pages in which <code>... </code> is used.

For example, http://docs.moodle.org/en/NTLM_authentication which Iñaki edited - compare with http://docs.moodle.org/en/index.php?title=NTLM_authentication&oldid=40962

Show
Helen Foster added a comment - Reopening this issue, as using <code xxx>...</code> for the PHP syntax highlighter causes a problem for all pages in which <code>... </code> is used. For example, http://docs.moodle.org/en/NTLM_authentication which Iñaki edited - compare with http://docs.moodle.org/en/index.php?title=NTLM_authentication&oldid=40962
Hide
Eloy Lafuente (stronk7) added a comment -

Fixed in test: http://docs.moodle.org/test/NTLM_authentication

I've modified the extension a bit so, when no xxx language is passed, it just returns original enclosed by <tt>...</tt>. Before that, it was processing the content with the 'text' language, causing the boxes and so to appear.

That way, old <code></code> tags will be working as they used to be.

Can you confirm it works as expected? If so, I'll apply the change to production in minutes.

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Fixed in test: http://docs.moodle.org/test/NTLM_authentication I've modified the extension a bit so, when no xxx language is passed, it just returns original enclosed by <tt>...</tt>. Before that, it was processing the content with the 'text' language, causing the boxes and so to appear. That way, old <code></code> tags will be working as they used to be. Can you confirm it works as expected? If so, I'll apply the change to production in minutes. Ciao
Hide
Eloy Lafuente (stronk7) added a comment -

Re-resolving as fixed. Now the extensions leaves the original <code>...</code> tags if no language is specified (instead of <tt>...</tt>). Looks better.

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Re-resolving as fixed. Now the extensions leaves the original <code>...</code> tags if no language is specified (instead of <tt>...</tt>). Looks better. Ciao
Hide
Helen Foster added a comment -

Eloy, thanks for fixing everything

PHP syntax highlighting information added to Moodle Docs:

http://docs.moodle.org/en/Help:Editing
http://docs.moodle.org/en/MoodleDocs:Style_guide

Show
Helen Foster added a comment - Eloy, thanks for fixing everything PHP syntax highlighting information added to Moodle Docs: http://docs.moodle.org/en/Help:Editing http://docs.moodle.org/en/MoodleDocs:Style_guide

Dates

  • Created:
    Updated:
    Resolved: