Mailing List Archive

Syntax highlighting in SVN repo only with svn:mime-type property set
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

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/e7c9f29a-a6d9-424e-b2e2-5333ac0603a8n%40googlegroups.com.
Re: Syntax highlighting in SVN repo only with svn:mime-type property set [ In reply to ]
On Monday, February 7, 2022 at 7:05:06 AM UTC-8 sol...@gmail.com wrote:

> 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
>

It shouldn't be necessary to set the mime-type, at least for recent Trac
versions. Which Trac version are you running?

https://trac.edgewall.org/wiki/TracSyntaxColoring

Ryan

--
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+unsubscribe@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.
Re: Re: Syntax highlighting in SVN repo only with svn:mime-type property set [ In reply to ]
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 <rjollos@gmail.com>:

>
>
> On Monday, February 7, 2022 at 7:05:06 AM UTC-8 sol...@gmail.com wrote:
>
>> 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
>>
>
> It shouldn't be necessary to set the mime-type, at least for recent Trac
> versions. Which Trac version are you running?
>
> https://trac.edgewall.org/wiki/TracSyntaxColoring
>
> Ryan
>
> --
> 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+unsubscribe@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
> <https://groups.google.com/d/msgid/trac-users/d953b301-8c3c-47c6-aa30-795dd5f27fdcn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


--
your sweet isn't ready yet

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/CABk4_A6ba-W%3D7%3D3KtXL6juEZzC8rrh6NpQOwpkgd%3DP1Bj9bjxA%40mail.gmail.com.
Re: Re: Syntax highlighting in SVN repo only with svn:mime-type property set [ In reply to ]
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 <jun66j5@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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/498ae396-733e-442c-d9c3-8359ae7212d7%40gmail.com.
Re: Re: Syntax highlighting in SVN repo only with svn:mime-type property set [ In reply to ]
Yes, this patch is a fix! Thank you!

??, 9 ????. 2022 ?. ? 01:39, Jun Omae <jun66j5@gmail.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 <jun66j5@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+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/trac-users/498ae396-733e-442c-d9c3-8359ae7212d7%40gmail.com
> .
>


--
your sweet isn't ready yet

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/CABk4_A7%2BmOr9rR38N6kbpjFm-QtuYhPwL3uU5%3DY575zqmKrhuQ%40mail.gmail.com.
Re: Re: Syntax highlighting in SVN repo only with svn:mime-type property set [ In reply to ]
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.

On Wed, Feb 9, 2022 at 6:46 PM Alexander Lunev <sol289@gmail.com> wrote:
>
> Yes, this patch is a fix! Thank you!
>
> ??, 9 ????. 2022 ?. ? 01:39, Jun Omae <jun66j5@gmail.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 <jun66j5@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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/CAEVLMajHpKTKD3uMZ%2B-idv9VeE%3DM33Eji6HJm7gUHFYFSB6HkA%40mail.gmail.com.