Changeset 15176

Show
Ignore:
Timestamp:
07.04.2008 16:17:34 (11 years ago)
Author:
ak19
Message:

1. No longer does GLI add anchor tags around img tags (images embedded in html files. That means that no_image_links has become the default behaviour. 2. This has also overcome the problem that no_image_links previously had of not displaying images, so that the embedded images are now displayed while there are no unnecessary a href tags around them anymore

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugins/HTMLPlug.pm

    r14996 r15176  
    114114        'desc' => "{HTMLPlug.old_style_HDL}", 
    115115    'type' => "flag"}, 
    116       { 'name' => "no_image_links", 
    117         'desc' => "{HTMLPlug.no_image_links}", 
     116      { 'name' => "no_image_links",            # in future think about removing this option, 
     117        'desc' => "{HTMLPlug.no_image_links}", # since it has become the default behaviour 
    118118    'type' => "flag"},   
    119119      ]; 
     
    890890 
    891891    # trap images 
    892    if(!$self->{'no_image_links'}){ 
    893     $$textref =~ s/(<(?:img|embed|table|tr|td)[^>]*?(?:src|background)\s*=\s*)([\"\'][^\"\']+[\"\']|[^\s>]+)([^>]*>)/ 
    894         $self->replace_images ($1, $2, $3, $base_dir, $file, $doc_obj, $cursection)/isge; 
    895     } 
     892 
     893    # Previously, by default, HTMLPlug would embed <img> tags inside anchor tags 
     894    # i.e. <a href="image><img src="image"></a> in order to overcome a problem that 
     895    # turned regular text succeeding images into links. That is, by embedding <imgs> 
     896    # inside <a href=""></a>, the text following images were no longer misbehaving. 
     897    # However, there would be many occasions whereby images were not meant to link 
     898    # to their source images but where the images would link to another web page. 
     899    # To allow this, the no_image_links option was introduced: it would prevent 
     900    # the behaviour of embedding images into links that referenced the source images. 
     901 
     902    # Somewhere along the line, the problem of normal text turning into links when  
     903    # such text followed images which were not embedded in <a href=""></a> ceased  
     904    # to occur. This is why the following lines have been commented out (as well as  
     905    # two lines in replace_images). They appear to no longer apply. 
     906 
     907    # If at any time, there is a need for having images embedded in <a> anchor tags, 
     908    # then it might be better to turn that into an HTMLPlug option rather than make 
     909    # it the default behaviour. Also, eventually, no_image_links needs to become 
     910    # a deprecated option for HTMLPlug as it has now become the default behaviour. 
     911 
     912    #if(!$self->{'no_image_links'}){ 
     913    $$textref =~ s/(<(?:img|embed|table|tr|td)[^>]*?(?:src|background)\s*=\s*)([\"\'][^\"\']+[\"\']|[^\s>]+)([^>]*>)/ 
     914    $self->replace_images ($1, $2, $3, $base_dir, $file, $doc_obj, $cursection)/isge; 
     915    #} 
    896916 
    897917    # add text to document object 
     
    934954 
    935955    my $image_link = $front . $img_file .$back; 
    936     my $anchor_link = "<a href=\"$img_file\" >".$image_link."</a>";   
    937  
    938     return $anchor_link;     
     956    return $image_link; 
     957 
     958    # The reasons for why the following two lines are no longer necessary can be  
     959    # found in subroutine process_section 
     960    #my $anchor_link = "<a href=\"$img_file\" >".$image_link."</a>";   
     961    #return $anchor_link;    
     962     
    939963    #return $front . $img_file . $back . $anchor_name; 
    940964}