Edgewall Software

Ticket #1932 (reopened defect)

Opened 3 years ago

Last modified 3 months ago

WikiFormatting does not detect php files

Reported by: Chris Petersen <xris*siliconmechanics.com> Owned by: jonas
Priority: normal Milestone: 0.13
Component: wiki system Version: devel
Severity: minor Keywords: pygments
Cc:

Description

I've tried <?php and #!php inside of {{{ }}} but neither enables php syntax highlighting.

Attachments

screenshot_trac.png (32.2 KB) - added by kontakt at meitzner dot net 17 months ago.
Finally able to upload the abovementioned screenshot

Change History

Changed 2 years ago by mgood

  • status changed from new to closed
  • resolution set to worksforme

Trac doesn't infer the language from content like "<?php". However, the #!php line does work. If it's not colored you either need to install SilverCity, Enscript, or set the "php_path" setting in trac.ini.

Changed 2 years ago by Tim Hatch <trac@…>

Also note that using the shebang #!php only works on the first line of a multiline code block. It doesn't work inline.

You'd use it like this -- but see WikiProcessors for more examples.

 {{{
 #!php
 function x() {}
 }}}

Changed 19 months ago by kontakt at meitzner dot net

  • status changed from closed to reopened
  • resolution worksforme deleted

Well, I've just made the experience that the abovementioned does not work as expected for me either.

Adding PHP-Sourcecode just with the shebang notation results merely in the code block background set to white instead of grey.

Only when I add additional <?php and ?> Tags at the beginning and end of the code block, the syntax highlighting is done. See Examples above, which show the behavior as of 2007-04-19. Now, I could not read from the documentation or this ticket that this behavior was intended. I regard it a bug, since the additional Tags are IMHO not "correct" on code excerpts.

// Comment
if ('1' != $is_it_true) {
  die('It\'s not true!');
}
<?php
// Comment
if ('1' != $is_it_true) {
  die('It\'s not true!');
}
?>

However, since this behavior may change with time in this online-version of trac, I'll add an additional screenshot in a minute.


Trac:0.11dev
Python:2.5 (release25-maint, Feb 16 2007, 18:42:37) [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu1)]
SQLite:3.3.10
pysqlite:2.3.2
Genshi:0.4dev-r494
Pygments:0.6
Subversion:1.4.2

Changed 19 months ago by kontakt at meitzner dot net

Hmm, I've got this nifty little screenshot, but I can't upload it due to unresolved #4087... Let me know if I should submit it otherwise.

Changed 19 months ago by mgood

Changing #!php to highlight as PHP snippets would break the consistency of how this is handled as well as making it impossible for people to include sections that mixed HTML and PHP sections in the Wiki. The Pygments PHP lexer does provide an option for "inline" PHP code without the <?php starting, so it would be possible to implement a plugin providing this type of highlighting under another name. I'm not sure if this belongs in the core, but I'll leave this open for now.

Changed 17 months ago by kontakt at meitzner dot net

Finally able to upload the abovementioned screenshot

Changed 5 months ago by Piotr Kuczynski <piotr.kuczynski@…>

  • severity changed from normal to minor
  • milestone set to 0.12

Changed 5 months ago by Piotr Kuczynski <piotr.kuczynski@…>

  • keywords pygments added

Add/Change #1932 (WikiFormatting does not detect php files)

Author



Change Properties
<Author field>
Action
as reopened
as The resolution will be set. Next status will be 'closed'
to The owner will change from jonas. Next status will be 'new'
 
Note: See TracTickets for help on using tickets.