Movatterモバイル変換


[0]ホーム

URL:


Trac Hacks
wiki:TopMacro

Context Navigation


Contents

  1. Description
    1. Styling
    2. Behavior
  2. Bugs/Feature Requests
  3. Source
  4. Installation
  5. Configuration
  6. Recent Changes
  7. Author/Contributors

Top of page Macro

Notice: This plugin is unmaintained and availableforadoption.

Description

This macro inserts a "top of page" link in your Trac wiki page. The only option is a string that is inserted into the content of the markup. This defaults to a single circumflex "^" character (more commonly known as a caret), surrounded by square brackets. The anchor element returned includes a "Top of Page" title attribute so the user knows its purpose, and a "topofpage" class so the Wiki author may apply their preferred style rules.

Inserting the macro in your wiki page would be as follows:

[[Top]][[Top(^)]][[Top(top)]][[Top(Top of page)]]

More specifically:

[[Top]] returns:[<a href="#" title="Top of page">^</a>]

You could of course achieve the same effect by doing this:

{{{#!html[<a href="#" title="Top of page">^</a>]}}}

Resulting in this:

[^]

Note that the brackets do not form part of the anchor itself. This is a personal preference. If you pass a string to themacro they are omitted.

Styling

If you like the caret, but prefer to omit the brackets and style the link yourself withCSS, try something like this:

Note: If you're going to style the anchor like this, you should also pass an argument to the macro or you'll end up with the default brackets in addition to the styling.

Behavior

If you want to get really fancy, you can use jQuery to create a smooth scrolling effect when the link is clicked. In yoursite.html template add:

Note: Returning false from the lambda, or anonymous, function prevents the browser from kicking in its own event model. However, it degrades nicely and still works even if the user has JavaScript disabled.

Bugs/Feature Requests

Existing bugs and feature requests forTopMacro arehere.

If you have any issues, create anew ticket.

Source

Installation

Download the zipped source fromhere or clone the repository (seeabove) from GitHub to a location on your local drive.Unzip the archive to a temporary location, visit the0.11 directory and run:

python setup.py bdist_eggcp dist/*.egg /trac/env/Project/plugins

Configuration

Enable the macro in/trac/env/Project/conf/trac.ini:

[components]top.*=enabled

You may need to restart your Web server.

Recent Changes

5040 bydwclifton on 2008-12-21 20:51:41
New hackTopMacro, created bydwclifton
(more)

Author/Contributors

Author:dwclifton
Maintainer:none (needsadoption)
Contributors:

Last modified3 years agoLast modified on Mar 27, 2022, 8:06:06 AM

Attachments(1)

Download all attachments as:.zip

Download in other formats:


Trac Powered

Powered byTrac 1.2.6
ByEdgewall Software.


[8]ページ先頭

©2009-2025 Movatter.jp