Syntax highlighting in SVN repo only with svn:mime-type property set

28 views
Skip to first unread message

Alexander Lunev

unread,
Feb 7, 2022, 10:05:06 AM2/7/22
to Trac Users
Hello everybody!
My Trac installation will not do syntax highlighting based on file extension in Subversion repository browser, only when I set it explicitly, like:

svn propset svn:mime-type "`file -bi start.pl`" start.pl

Only then syntax highlighting works, for this file only.
Do I have to set this property on all files to see them highlighted?

--
With best regards!
Alexander

RjOllos

unread,
Feb 7, 2022, 10:23:10 PM2/7/22
to Trac Users
It shouldn't be necessary to set the mime-type, at least for recent Trac versions. Which Trac version are you running? 


Ryan 

Alexander Lunev

unread,
Feb 8, 2022, 8:34:14 AM2/8/22
to trac-...@googlegroups.com
Oh, sorry, Trac version is 1.5.3. Syntax coloring works in source code (SVN) only when svn:mime-type set. In Wiki coloring works when set wiki processor, like
{{{
#!php
<?php
if (true) {
}
?>
}}}

вт, 8 февр. 2022 г. в 05:23, RjOllos <rjo...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/d953b301-8c3c-47c6-aa30-795dd5f27fdcn%40googlegroups.com.


--
your sweet isn't ready yet

Jun Omae

unread,
Feb 8, 2022, 6:39:22 PM2/8/22
to trac-...@googlegroups.com
Hi,

On 2022/02/08 15:53, Alexander Lunev wrote:
> Oh, sorry, Trac version is 1.5.3. Syntax coloring works in source code (SVN) only when svn:mime-type set. In Wiki coloring works when set wiki processor, like
> {{{
> #!php
> <?php
> if (true) {
> }
> ?>
> }}}

Thanks. Reproduced with Subversion repository on my environment.
Could you please try the following patch?

[[[
diff --git a/tracopt/versioncontrol/svn/svn_fs.py b/tracopt/versioncontrol/svn/svn_fs.py
index b5fd52854..bac8fa157 100644
--- a/tracopt/versioncontrol/svn/svn_fs.py
+++ b/tracopt/versioncontrol/svn/svn_fs.py
@@ -827,7 +827,7 @@ class SubversionNode(Node):
def _get_prop(self, name):
value = fs.node_prop(self.root, self._scoped_path_utf8, name,
self.pool)
- return to_unicode(value)
+ return _from_svn(value)

def get_branch_origin(self):
"""Return the revision in which the node's path was created.
]]]

--
Jun Omae <jun...@gmail.com> (大前 潤)

Alexander Lunev

unread,
Feb 9, 2022, 4:46:43 AM2/9/22
to trac-...@googlegroups.com
Yes, this patch is a fix! Thank you!

ср, 9 февр. 2022 г. в 01:39, Jun Omae <jun...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+...@googlegroups.com.

Jun Omae

unread,
Feb 9, 2022, 5:07:04 AM2/9/22
to trac-...@googlegroups.com
Thanks for the feedback!
I've filed the issue at https://trac.edgewall.org/ticket/13459, and
the issue will be fixed in Trac 1.5.4.
Reply all
Reply to author
Forward
0 new messages