ソースを参照

Fix GitHub source code link in docs for 'latest' path

Marcel Stör 8 年 前
コミット
6bb6996d2b
1 ファイル変更5 行追加1 行削除
  1. 5 1
      docs/js/extra.js

+ 5 - 1
docs/js/extra.js

@@ -202,7 +202,11 @@ var nodemcu = nodemcu || {};
     if (window.location.origin.indexOf('readthedocs') > -1) {
       // path is like /en/<branch>/<lang>/build/ -> extract 'lang'
       // split[0] is an '' because the path starts with the separator
-      branch = path.split('/')[2];
+      var thirdPathSegment = path.split('/')[2];
+      // 'latest' is an alias on RTD for the 'dev' branch - which is the default for 'branch' here
+      if (thirdPathSegment != 'latest') {
+        branch = thirdPathSegment;
+      }
     }
     return branch;
   }