Changeset 30226


Ignore:
Timestamp:
09/08/15 15:49:20 (6 years ago)
Author:
jmt12
Message:

Fixing two bugs - one that prevents a blank namespace restriction working and a second that meant updating internal links only worked if there were also bogus image reference tags to fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • documentation/trunk/wiki/plugins/greenstonedocs/syntax.php

    r30114 r30226  
    7474        {
    7575            // Determine the starting point for the update
    76             $base_dir = DOKU_INC . 'data/pages/' . $this->getConf('currentnamespace') . '/';
     76            $base_dir = DOKU_INC . 'data/pages/';
     77            if (!empty($this->getConf('currentnamespace')))
     78            {
     79                $base_dir .= $this->getConf('currentnamespace') . '/';
     80            }
    7781            // - ensure trailing : for consistency in namespaces
    7882            $current_namespace = $this->getConf('currentnamespace');
     
    173177                $pattern = '/(<imgcaption .+?>)(<\/imgcaption>)\s*(\{\{.+?\}\})/s';
    174178                $replace = '${1}${3}${2}';
    175                 $page_content = preg_replace($pattern, $replace, $page_content, -1, $replace_count);
     179                $image_replace_count = 0;
     180                $page_content = preg_replace($pattern, $replace, $page_content, -1, $image_replace_count);
     181                $replace_count = $replace_count + $image_replace_count;
    176182                if ($replace_count > 0)
    177183                {
     
    209215        // Note that the result is FALSE if no match, and should be 0 if name-
    210216        // space starts with prefix.
    211         if (strpos($current_full_namespace, $this->target_namespace_prefix) === 0)
     217        if (empty($this->target_namespace_prefix) || strpos($current_full_namespace, $this->target_namespace_prefix) === 0)
    212218        {
    213219            // Hiding the section/translation ID tags in headers
Note: See TracChangeset for help on using the changeset viewer.