Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#6483 closed defect (fixed)

Image macro documentation for defining width is incorrect

Reported by: sid Owned by: osimons
Priority: normal Milestone: 0.11
Component: wiki system Version: devel
Severity: normal Keywords: imagemacro
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

The TracWikiMacros page incorrectly says that you can use this syntax to limit a displayed image width:

[[Image(pic.png, 120px)]]

The syntax that works is:

[[Image(pic.png, 120)]]

Here is a patch to fix that page and the code:

  • macros.py

     
    291291    Examples:
    292292    {{{
    293293        [[Image(photo.jpg)]]                           # simplest
    294         [[Image(photo.jpg, 120px)]]                    # with size
     294        [[Image(photo.jpg, 120)]]                      # with image width size
    295295        [[Image(photo.jpg, right)]]                    # aligned by keyword
    296296        [[Image(photo.jpg, nolink)]]                   # without link to source
    297297        [[Image(photo.jpg, align=right)]]              # aligned by attribute

Attachments (0)

Change History (4)

comment:1 by osimons, 16 years ago

Milestone: 0.11.1
Owner: changed from Jonas Borgström to osimons

Hmm. Wonder if the best would be to support both? If you do width=120px as a named argument, it works fine. Would be natural to keep the same behavior also without the keyword? If so, we could change the regexp like this:

  • trac/wiki/macros.py

     
    323323        filespec = args[0]
    324324
    325325        # style information
    326         size_re = re.compile('[0-9]+%?$')
     326        size_re = re.compile('[0-9]+(%|px)?$')
    327327        attr_re = re.compile('(align|border|width|height|alt'
    328328                             '|title|longdesc|class|id|usemap)=(.+)')
    329329        quoted_re = re.compile("(?:[\"'])(.*)(?:[\"'])$")

I'll also use your wording to make it explicity that we set the width attribute.

Looks OK?

comment:2 by Christian Boos, 16 years ago

Yeah, it's preferable to work as advertised, this might even be a regression from 0.10.

comment:3 by osimons, 16 years ago

Component: generalwiki
Keywords: imagemacro added
Milestone: 0.11.10.11
Resolution: fixed
Status: newclosed

Fixed in [6319]. Closing.

comment:4 by osimons, 16 years ago

#3814 marked as duplicate (one of two issues mentioned).

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain osimons.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from osimons 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.