Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

adding rel-tag to images #5

Open
wants to merge 1 commit into from

2 participants

@zurborg

example usage to enable the nice lightbox:

!/path/to/image/ {lightbox}!

or to create an image group:

!/path/to/image1 {lightbox[foo]}!
!/path/to/image2 {lightbox[foo]}!

for more information see: http://lokeshdhakar.com/projects/lightbox2/

David Zurborg added rel-tag for images
example usage to enable the nice lightbox:

!/path/to/image/ {lightbox}!

or to create an image group:

!/path/to/image1 {lightbox[foo]}!
!/path/to/image2 {lightbox[foo]}!

for more information see: http://lokeshdhakar.com/projects/lightbox2/
5722d0a
@bradchoate
Owner

I'm not really interested in supporting a rel attribute for images... image markup is already kind of complicated. I would suggest using the class name method instead. You could then do this ahead of the lightbox2 initialization:

$('.lightbox').each(function() { $(this).attr('rel', 'lightbox'); });

Would that be suitable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 29, 2012
  1. added rel-tag for images

    David Zurborg authored
    example usage to enable the nice lightbox:
    
    !/path/to/image/ {lightbox}!
    
    or to create an image group:
    
    !/path/to/image1 {lightbox[foo]}!
    !/path/to/image2 {lightbox[foo]}!
    
    for more information see: http://lokeshdhakar.com/projects/lightbox2/
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/Text/Textile.pm
View
8 lib/Text/Textile.pm
@@ -1544,10 +1544,12 @@ sub format_image {
$tag .= qq{ align="$alignment"} if $alignment;
}
}
- my ($pctw, $pcth, $w, $h, $alt);
+ my ($pctw, $pcth, $w, $h, $alt, $rel);
if (defined $extra) {
($alt) = $extra =~ m/\(([^\)]+)\)/;
+ ($rel) = $extra =~ m/\{([^\}]+)\}/;
$extra =~ s/\([^\)]+\)//;
+ $extra =~ s/\{[^\}]+\}//;
my ($pct) = ($extra =~ m/(^|\s)(\d+)%(\s|$)/)[1];
if (!$pct) {
($pctw, $pcth) = ($extra =~ m/(^|\s)(\d+)%x(\d+)%(\s|$)/)[1,2];
@@ -1570,6 +1572,10 @@ sub format_image {
if ($self->{flavor} !~ m/^xhtml2/) {
$tag .= ' alt="' . $self->encode_html_basic($alt) . '"';
}
+ $rel = '' unless defined $rel;
+ if ($self->{flavor} !~ m/^xhtml2/) {
+ $tag .= ' rel="' . $self->encode_html_basic($rel) . '"';
+ }
if ($w && $h) {
if ($self->{flavor} !~ m/^xhtml2/) {
$tag .= qq{ height="$h" width="$w"};
Something went wrong with that request. Please try again.