Changeset 30117


Ignore:
Timestamp:
2015-08-21T17:18:42+12:00 (6 years ago)
Author:
jmt12
Message:

Altered to fix bug where imgcaption tag closed before image actually output. Looks like this was intentional at some stage, but means problems in the Wiki, so I'll repair

Location:
documentation/trunk/php
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • documentation/trunk/php/gs-manual-export.php

    r27507 r30117  
    945945    }
    946946    // - images start with an image caption 'element'
    947     elseif (preg_match('/<imgcaption\s+figure_([a-z0-9_\-]+)\|(.+)>\s*<\/imgcaption>/', $line, $matches))
     947    elseif (preg_match('/<imgcaption\s+figure_([a-z0-9_\-]+)\|(.+)>([^<]*?)<\/imgcaption>/', $line, $matches))
    948948    {
    949949      $figure_id = $matches[1];
    950950      $figure_title = $matches[2];
     951      $image_content = $matches[3];
    951952      // - watch for the special withLineNumber flag
    952953      $class_attribute = '';
     
    986987      }
    987988      fwrite($xml_out, '</Title>' . "\n");
    988       $in_figure = true;
     989      // Try and find the image itself
     990      if (preg_match('/\{\{.+?[^:?]+\?\d+x\d+(&direct)?\}\}/', $image_content))
     991      {
     992        processImage($xml_out, $line);
     993        fwrite($xml_out, '</Figure>' . "\n");
     994      }
     995      // Didn't find an image? Weird, but mark the imgcaption as open, and
     996      // we'll chomp up the next image found as the content.
     997      else
     998      {
     999          $in_figure = true;
     1000      }
    9891001      // - record the id to prevent repeating
    9901002      $seen_ids[$figure_id] = true;
  • documentation/trunk/php/gs-manual-import.php

    r25052 r30117  
    291291       $txt .= '%!-- withLineNumber --%';
    292292     }
    293      $txt .= '></imgcaption>' . "\n";
     293     $txt .= '>';
    294294     if ($in_chapter)
    295295     {
     
    305305     if ($in_chapter)
    306306     {
    307        fwrite($chapter_txt_out, "\n\n");
    308      }
    309      else
    310      {
    311        $frontmatter_text .= "\n\n";
     307       fwrite($chapter_txt_out, "</imgcaption>\n\n");
     308     }
     309     else
     310     {
     311       $frontmatter_text .= "</imgcaption>\n\n";
    312312     }
    313313     // - no longer required
Note: See TracChangeset for help on using the changeset viewer.