[mm-common] util/doc-install.pl: Improve the update for Doxygen >= 1.8.16



commit 80f49c7e6f07651c73b58f74e084d1fd68c95d60
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Wed Jun 17 15:51:30 2020 +0200

    util/doc-install.pl: Improve the update for Doxygen >= 1.8.16
    
    * skeletonmm/doc/reference/meson.build:
    * util/doc-install.pl: Move some code from meson.build to doc-install.pl,
    where regular expressions can be used.

 skeletonmm/doc/reference/meson.build | 12 ------------
 util/doc-install.pl                  | 24 +++++++++++++++++++-----
 2 files changed, 19 insertions(+), 17 deletions(-)
---
diff --git a/skeletonmm/doc/reference/meson.build b/skeletonmm/doc/reference/meson.build
index d8db2c5..b653e6e 100644
--- a/skeletonmm/doc/reference/meson.build
+++ b/skeletonmm/doc/reference/meson.build
@@ -23,20 +23,8 @@ foreach module : tag_file_modules
     elif htmlrefdir == ''
       htmlrefdir = htmlrefpub
     endif
-    if htmlrefpub.startswith('/')
-      htmlrefpub = 'file://' + htmlrefpub
-    endif
-    if htmlrefdir.startswith('/')
-      htmlrefdir = 'file://' + htmlrefdir
-    endif
     doxygen_tagfiles += ' "' + doxytagfile + '=' + htmlrefpub + '"'
 
-    if not htmlrefdir.endswith('/')
-      htmlrefdir += '/'
-    endif
-    if not htmlrefpub.endswith('/')
-      htmlrefpub += '/'
-    endif
     # Doxygen <= 1.8.15
     docinstall_flags += ['-l', doxytagfile.split('/')[-1] + '@' + htmlrefdir]
     if htmlrefpub != htmlrefdir
diff --git a/util/doc-install.pl b/util/doc-install.pl
index 4068002..995c0bb 100755
--- a/util/doc-install.pl
+++ b/util/doc-install.pl
@@ -174,7 +174,6 @@ sub split_key_value ($)
 
     if (defined $path)
     {
-      notice('Using base path ', $path, ' for tag file ', $name);
       return ($name, $path, 0);
     }
     notice('Not changing base path for tag file ', $name);
@@ -188,7 +187,6 @@ sub split_key_value ($)
 
     if (defined $path)
     {
-      notice('Using base path ', $path, ' for ', $name);
       return ($name, $path, 1);
     }
     notice('Not changing base path for ', $name);
@@ -224,16 +222,32 @@ $message_prefix = ($message_prefix || 'doc-install') . ': ';
 
   foreach my $tag (@tags)
   {
-    my ($key, $value, $subst) = split_key_value($tag);
+    my ($name, $path, $subst) = split_key_value($tag);
     if (defined($subst))
     {
+      # Translate a local absolute path to URI.
+      # (If Autotools (not Meson) is used, this translation is
+      # also done in mm-doc.m4 (MM_ARG_WITH_TAGFILE_DOC).
+      # $path will not be changed, if these substitutions have been
+      # performed before.)
+      $path =~ s!\\!/!g;
+      $path =~ s! !%20!g;
+      $path =~ s!^/!file:///!;
+      $path =~ s!^([A-Za-z]:/)!file:///$1!; # Windows: C:/path
+      if ($path !~ m!/$!)
+      {
+        $path .= '/';
+      }
+
       if (!$subst)
       {
-        $tags_hash{$key} = $value;
+        notice('Using base path ', $path, ' for tag file ', $name);
+        $tags_hash{$name} = $path;
       }
       else
       {
-        $subst_hash{$key} = $value;
+        notice('Using base path ', $path, ' for ', $name);
+        $subst_hash{$name} = $path;
       }
     }
   }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]