Edgewall Software

Ticket #4464 (closed defect: wontfix)

Opened 2 years ago

Last modified 2 years ago

PHP files doesn't shown correctly

Reported by: anonymous Owned by: cboos
Priority: normal Milestone:
Component: version control/browser Version: devel
Severity: normal Keywords:
Cc:

Description

I using trac 0.11dev, with some php files in my svn brunch. Some of this php files are shown correctly but some doesn't shown. They looks like they are empty.

Here the logfile of trac.log:

2006-12-27 16:57:28,799 Trac[api] WARNING: HTML preview using <tracpygments.PygmentsRenderer object at 0xb6e54a6c> failed ('module' object has no attribute 'get_lexer_by_name')
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/trac/mimeview/api.py", line 459, in render
    rendered_content, filename, url)
  File "build/bdist.linux-i686/egg/tracpygments/__init__.py", line 77, in render
  File "build/bdist.linux-i686/egg/tracpygments/__init__.py", line 112, in _format
AttributeError: 'module' object has no attribute 'get_lexer_by_name'

Attachments

Change History

  Changed 2 years ago by thatch

  • keywords needinfo added
  • owner changed from jonas to cboos
  • component changed from general to browser

anonymous,

Trunk now supports Pygments without using the plugin. Try disabling the plugin and see if it works. Make sure you're using trunk from at least r4466 along with Pygments 0.6+.

  Changed 2 years ago by anonymous

Thanks, the warning, error is gone. But the php source doesn't shown after the change.

  Changed 2 years ago by thatch

Okay, first verify your Genshi is recent (0.3.6 IIRC). If it's still an issue, please paste the relevant portion of the log.

follow-up: ↓ 5   Changed 2 years ago by anonymous

I have the newest genshi version installed on my system (version 0.3.6). I set the LOG output to DEBUG, but nothing is written to the logfile if i browse to "browser/trunk/lib/Calc.php?order=name".

in reply to: ↑ 4   Changed 2 years ago by anonymous

Replying to anonymous:

I have the newest genshi version installed on my system (version 0.3.6). I set the LOG output to DEBUG, but nothing is written to the logfile if i browse to "browser/trunk/lib/Calc.php?order=name".

Sry, i have forgotten to restart tracd, here the logfile output:

2006-12-28 14:24:52,712 Trac[main] DEBUG: Dispatching <Request "GET /browser/trunk/lib/Calc.php">
2006-12-28 14:24:52,724 Trac[chrome] DEBUG: Prepare chrome data for request
2006-12-28 14:24:52,734 Trac[browser] DEBUG: Rendering preview of node Calc.php@None with mime-type text/x-php; charset=iso-8859-15
2006-12-28 14:24:52,735 Trac[api] DEBUG: Trying to render HTML preview using PygmentsRenderer

  Changed 2 years ago by anonymous

Can this a bug of the php interpreter (/usr/bin/php), that handle the php highlighting?

  Changed 2 years ago by thatch

If that's all the log shows, it would not be caused by the php highlighter, because it's using Pygments which is completely separate.

Rereading the initial report, does it only do this on certain files, or do all php files show up as blank? Is there something special about those (non-ascii characters, CR-only line separators) and do other files using Pygments render correctly (css, for example)?

  Changed 2 years ago by anonymous

This is some different php files but not all php files, thats a little bit strange. --- After a little test i found out the difference between this php files, some have the close tag:

?>

and some haven't. That files that haven't this tag doesn't shown by trac.

  Changed 2 years ago by thatch

  • keywords needinfo removed
  • status changed from new to closed
  • resolution set to wontfix

Confirmed. That's indeed a Pygments bug, now reported as http://trac.pocoo.org/ticket/180

You can work around this in the meantime by setting

[mimeviewer]
pygments_modes =  text/x-php:php:9

in your trac.ini, which disables the combo html+php renderer in favor of just php.

Closing as wontfix, since it's a Pygments bug.

  Changed 2 years ago by Georg Brandl

Just wanted to note that this is now fixed in Pygments trunk.

Add/Change #4464 (PHP files doesn't shown correctly)

Author



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