wiki:CodeExampleMacro

Version 6 (modified by anonymous, 5 years ago) (diff)

--

Code example box with syntax highlighting

Description

The CodeExampleMacro renders a code example box with syntax highlighting. It support three types of examples: simple, correct, and incorrect. The SELECT ALL link highlights all of the code in the box to simplify the copy and paste action.

All rights reserved by Codedgers Inc.

Bugs/Feature Requests

Existing bugs and feature requests for CodeExampleMacro are here.

If you have any issues, create a new ticket.

Download

Download the zipped source from here.

Source

You can check out CodeExampleMacro from here using Subversion, or browse the source with Trac.

Example

The simple example:

{{{
#!CodeExample
#!python
    def apply_timer(self):
        timer = QTimer(self)
        self.connect(timer, SIGNAL('timeout()'), self.update_statusbar)
        timer.start(settings.HINTS_UPDATE_PERIOD)
}}}

will be rendered as:

The simple example image.

The incorrect example:

{{{
#!BadCodeExample
#!python
    def create_hint_list(self):
        self.hints.extend(self.globals.get_hint_list())
}}}

will be rendered as:

The incorrect example image.

The correct example:

{{{
#!GoodCodeExample
#!python
    def update_statusbar(self):
        self.combo_box.insertItem(0, self.hints.get_current_hint())
        self.combo_box.setCurrentIndex(0)
}}}

will be rendered as:

The correct example image.

Recent Changes

[14039] by rjollos on 2014-07-26 02:37:54
1.2: Include images in egg and fixed links to sample screenshots. Fixes #8331.

Thanks to AllenB and ilewismsl for the patches.

[14038] by rjollos on 2014-07-26 02:37:35
Added URL to setup.py and bumped version to 1.1. Refs #9716.
[14037] by rjollos on 2014-07-26 02:37:25
Fixed title bar link when repository is specified. Fixes #9716.

Author/Contributors

Author: nuald
Contributors:

Attachments (7)

Download all attachments as: .zip