Modify

Opened 10 years ago

Closed 5 years ago

#1605 closed defect (fixed)

Preserve wiki formatting within colored text

Reported by: anonymous Owned by: Ryan J Ollos
Priority: normal Component: ColorMacro
Severity: normal Keywords:
Cc: chris@… Trac Release: 0.11

Description

with current macro, when I tried like this

Color(white,blue,Research?

It should change only color, I suppose. But it wasn't. Only changing the color is desirable without effecting any wiki formatting. Is is possbile to do this? Thank you very much.

Attachments (4)

ColorMacro_1605.patch (2.1 KB) - added by Franz 5 years ago.
possible patch for this ticket
ColorMacro_1605_processor.patch (3.8 KB) - added by Franz 5 years ago.
another patch: it is now also usable as WikiProcessor
ColorMacro_1605_processor2.patch (4.3 KB) - added by Franz 5 years ago.
another patch, which have rewritten most of the plugins code
ColorMacro.py (3.8 KB) - added by Franz 5 years ago.
Python file, identical when merging with ColorMacro_1605_processor2.patch

Download all attachments as: .zip

Change History (13)

comment:1 Changed 8 years ago by David Roussel

That should be possible as the TracWikiMacros page says we can do this:

  text = "whatever wiki markup you want, even containing other macros"
  # Convert Wiki markup to HTML, new style
  out = StringIO()
  Formatter(self.env, formatter.context).format(text, out)
  return Markup(out.getvalue())

comment:2 Changed 8 years ago by David Roussel

comment:3 Changed 6 years ago by Ryan J Ollos

Summary: keeping all formattings and changing only colorsPreserve wiki formatting within colored text

#7696 closed as a duplicate.

comment:4 Changed 6 years ago by anonymous

Cc: chris@… added; anonymous removed

Changed 5 years ago by Franz

Attachment: ColorMacro_1605.patch added

possible patch for this ticket

comment:5 Changed 5 years ago by Franz

I uploaded a possible solution for this ticket. All simple Wiki formatting should work (like bold, italic, links to tickets, etc.). But it seems that no macros are working.

So this example is working with that patch:

[[Color(lime,None,wiki,This is ''just'' an '''simple''' test, for more info see #7696 or TitleIndex)]]

This example however is not working (it just prints "recent changes: [[RecentChanges(,3" in lime background):

[[Color(lime,None,wiki,recent changes: [[RecentChanges(,3)]])]]

Changed 5 years ago by Franz

another patch: it is now also usable as WikiProcessor

comment:6 Changed 5 years ago by Franz

I added another possible patch, which allows using it as processor. And in that you can use wiki processors and wiki formatting.

Changed 5 years ago by Franz

another patch, which have rewritten most of the plugins code

Changed 5 years ago by Franz

Attachment: ColorMacro.py added

Python file, identical when merging with ColorMacro_1605_processor2.patch

comment:7 Changed 5 years ago by Franz

I saw just now, that the functionality, which is provided by ColorMacro is already implemented as default in Trac, see http://trac.edgewall.org/wiki/WikiHtml#HowtoUseDivSpan. And using span- and div-macro is even more powerful.

comment:8 Changed 5 years ago by Ryan J Ollos

Owner: changed from David Roussel to Ryan J Ollos

(In [11892]): Fixes #1605, #5651,

  • Use Genshi to construct span element.
  • Removed padding around span element.
  • Format wiki to html, allowing wiki markup to be used as the text argument to the Color macro.

comment:9 Changed 5 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed
Trac Release: 0.100.11

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.