Edgewall Software
Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#11296 closed enhancement (fixed)

"application/x-dos-batch" is an unknown mimetype when Pygments is not installed

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: low Milestone: 1.0.2
Component: rendering Version: 1.0-stable
Severity: normal Keywords: mimetype wikiprocessor syntaxcoloring
Cc: Branch:
Release Notes:

Added shortnames bat, batch, cmd and dos for the mimetype application/x-dos-batch.

API Changes:

Description

The WikiProcessor #!application/x-dos-batch is used on the TracRepositoryAdmin page. In an installation without Pygments, the following error will be seen:

I propose the following patch to fix the issue, followed by replacement of #!application/x-dos-batch with #!dos on the TracRepositoryAdmin page.

  • trac/mimeview/api.py

    diff --git a/trac/mimeview/api.py b/trac/mimeview/api.py
    index 2e3ca1d..aaaa550 100644
    a b KNOWN_MIME_TYPES = {  
    290290    'application/pdf':        'pdf',
    291291    'application/postscript': 'ps',
    292292    'application/rtf':        'rtf',
     293    'application/x-dos-batch': 'dos batch cmd',
    293294    'application/x-sh':       'sh',
    294295    'application/x-csh':      'csh',
    295296    'application/x-troff':    'nroff roff troff',

Attachments (1)

WikiSyntaxError.png (58.7 KB ) - added by Ryan J Ollos 6 years ago.

Download all attachments as: .zip

Change History (4)

by Ryan J Ollos, 6 years ago

Attachment: WikiSyntaxError.png added

comment:1 by Ryan J Ollos, 6 years ago

Pygment's BatchLexer defines the shortname bat for mimetype application/x-dos-batch in the latest release of Pygments, which is 1.6. dosbatch and winbatch have since been added to the mainline (changes made in 414d4a1e and pulled in c3493668).

It seems like dos, batch and cmd are all reasonable guesses at a shortname for the mimetype, and they aren't used elsewhere in Trac WikiProcessors or Pygments, so I'll add bat batch cmd dos as short names for the mimetype application/x-dos-batch.

Last edited 6 years ago by Ryan J Ollos (previous) (diff)

comment:2 by Ryan J Ollos, 6 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: newclosed

Committed to 1.0-stable in [12041:12042]. Merged to trunk in [12043:12044].

The TracRepositoryAdmin page was updated in revision 32. It had been edited to use the application/x-dos-batch in revision 9. I didn't find any other uses of #!application/x-dos-batch in the documentation.

Last edited 6 years ago by Ryan J Ollos (previous) (diff)

comment:3 by Ryan J Ollos, 6 years ago

The 100% sized image in comment:description makes for quite a view below TracQuery#Customizingthetableformat!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.