[Moin-user] Help needed with attachments
Jakub Kruszona-Zawadzki
jakub.kruszona at gemius.pl
Fri Aug 27 02:02:54 EDT 2010
On 26 Aug, 2010, at 17:11, R.Bauer wrote:
> Jakub Kruszona-Zawadzki schrieb:
>> Hi.
>>
>> I'm using MoinMoin version 1.9.3.
>>
>> I have some problems with text attachments. I want to include content of my attachment into page. My attachments are simple text files (most of them written in javascript)
>>
>> I'd like to have my files attached with color syntax, and without line numbers.
>
> ok
>
>>
>> When file is a part of a page it could be done easy as:
>>
>> {{{#!highlight js numbers=disable
>> .....
>> }}}
>>
>> But when I try to attach file with .js extension - like: {{attachment:file.js}} it turns on the page into funny small box with scrollbars (not usual gray box) - Moin doesn't detect it as a text file and places it as an 'object'. When I've added .txt ( like this: {{attachment:file.js.txt}} ) - it works, but there is no color syntax of course, and I have no idea how to disable line numbers (how to add display parameters such as 'numbers=disable' to attachments).
>
> hmm, I don't want to tell about features of fututre moin-2.0 so lets see
> what we can do in moin-1.9
>
>>
>> Is there any way to do that?
>
> the mimetype is application/x-javascript so it can't be detected as text
> file.
>
> Also this means that you found a bug, because MIMETYPES_sanitize_mapping
> is not working as it should.
> It looks like we sanitize the wrong mimetype for javascript.
>
> see
> http://moinmo.in/MoinMoinBugs/JS_Not_highlighted for a patch.
>
Thanks. It helped.
The same problem is with actionscript. '.as' files are detected as 'application/x-actionscript', so another mapping should be added to MIMETYPES_sanitize_mapping:
('application', 'x-actionscript'): ('text', 'actionscript'),
Probably there are more mime types to sanitize (things as "application/x-sh","application/x-dos-batch" etc.).
On the HelpOnParsers page (http://moinmo.in/HelpOnParsers) there is nice table on the bottom. In column "Mimetypes" there are a lot of mimetypes like "application/*". May be it would be better to ask highlighter (Pygments) if it can 'colorize' given file and only if answer is 'no' then check if major mime type is 'text'?
>
>> Are there options to turn off this line numbering thing globally?
>
>
> Please add a feature request for such a feature if there is no simple
> way to archieve it.
>
> Thanks for reporting
>
> cheers
>
> Reimar
>
>
> ------------------------------------------------------------------------------
> Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
> Be part of this innovative community and reach millions of netbook users
> worldwide. Take advantage of special opportunities to increase revenue and
> speed time-to-market. Join now, and jumpstart your future.
> http://p.sf.net/sfu/intel-atom-d2d
> _______________________________________________
> Moin-user mailing list
> Moin-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/moin-user
--
Jakub Kruszona-Zawadzki
More information about the Moin-user
mailing list