Changes between Version 11 and Version 12 of CodeExampleMacro
- Timestamp:
- Sep 29, 2010, 6:53:36 AM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CodeExampleMacro
v11 v12 29 29 #!CodeExample 30 30 #!python 31 def apply_timer(self): 32 timer = QTimer(self) 33 self.connect(timer, SIGNAL('timeout()'), self.update_statusbar) 34 timer.start(settings.HINTS_UPDATE_PERIOD) 31 @staticmethod 32 def get_templates_dirs(): 33 """ Notify Trac about templates dir. """ 34 from pkg_resources import resource_filename 35 return [resource_filename(__name__, 'templates')] 35 36 }}} 36 37 }}} … … 38 39 will be rendered as: 39 40 40 [[Image(example .png)]]41 [[Image(example1.png)]] 41 42 42 43 The incorrect example: 43 44 {{{ 44 45 {{{ 45 #! BadCodeExample46 # !python47 def create_hint_list(self): 48 self.hints.extend(self.globals.get_hint_list()) 46 #!CodeExample 47 ## type = bad 48 #!haskell 49 fibs = 0 : 1 : [ a + b | a <- fibs | b <- tail fibs ] 49 50 }}} 50 51 }}} … … 52 53 will be rendered as: 53 54 54 [[Image( incorrect_example.png)]]55 [[Image(example2.png)]] 55 56 56 57 The correct example: 57 58 {{{ 58 59 {{{ 59 #!GoodCodeExample 60 #!python 61 def update_statusbar(self): 62 self.combo_box.insertItem(0, self.hints.get_current_hint()) 63 self.combo_box.setCurrentIndex(0) 60 #!CodeExample 61 ## type = good 62 #!haskell 63 fibs = 0 : 1 : zipWith (+) fibs (tail fibs) 64 64 }}} 65 65 }}} … … 67 67 will be rendered as: 68 68 69 [[Image( correct_example.png)]]69 [[Image(example3.png)]] 70 70 71 The is also support for getting sources from the repository using !CodeExamplePath, !BadCodeExamplePath, !GoodCodeExamplePath. 72 71 There is also support for getting sources from the repository: 73 72 {{{ 74 73 {{{ 75 #! GoodCodeExamplePath76 # !python77 path=gws/main/main_view.py 78 regex="def update_statusbar" 79 lines=3 74 #!CodeExample 75 ## path=GPGMail/Source/GPGMailPreferences.m 76 ## regex=".*updater\s*{" 77 ## lines=3 78 #!objective-c 80 79 }}} 81 80 }}} … … 83 82 will be rendered as: 84 83 85 [[Image( correct_example.png)]]84 [[Image(example4.png)]] 86 85 87 Parameters for *Path macros: 88 * '''path''' - a file in the repository 89 * '''regex''' - (optional) a regular expression indicates which to start getting 90 * '''lines''' - (optional) limits number of lines of code to get 86 Parameters: 87 * '''type''' - (optional) a type of the example: simple (default), 88 good, bad 89 * '''path''' - (optional) a file in the repository (using TracLinks 90 format for source code) 91 * '''regex''' - (optional) a regular expression indicates 92 where to start an example 93 * '''lines''' - (optional) number of lines to show 91 94 92 95 == Recent Changes ==