Skip to content
This repository
Browse code

[fix] opadoc: fix for files node

  • Loading branch information...
commit 03210d53e194a904570f6eee8743f226c26e93a3 1 parent e93e2a5
Frederic Ye authored October 25, 2011
11  opadoc/common/opaDocComment.opa
@@ -265,16 +265,7 @@ OpaDocComment =
265 265
       content = file_content(fname)
266 266
 
267 267
       //do jlog(fname)
268  
-      len = String.length(fname)
269  
-      path = "_build/" // FIXME: VERY specific to build !!!
270  
-      path_len = String.length(path)
271  
-      fname = match String.index(path, fname)
272  
-              {some=idx} ->
273  
-                match String.get_suffix(len-idx-path_len, fname)
274  
-                {some=s} -> s
275  
-                {none} -> fname
276  
-                end
277  
-              {none} -> fname
  268
+      fname = OpaDocUtils.relative_path(fname)
278 269
 
279 270
       match Parser.parse(private.extract, content) with
280 271
       | [] -> []
15  opadoc/common/opaDocUtils.opa
@@ -98,4 +98,19 @@ OpaDocUtils = {{
98 98
     then String.replace(File.dir_sep, ".", p)
99 99
     else legacy_uri_of_path(p)
100 100
 
  101
+  relative_path(fname) =
  102
+    if not(OpaDocParameters.get().long_uris)
  103
+    then fname
  104
+    else
  105
+      len = String.length(fname)
  106
+      path = "_build/" // FIXME: VERY specific to build !!!
  107
+      path_len = String.length(path)
  108
+      match String.index(path, fname)
  109
+      {some=idx} ->
  110
+        match String.get_suffix(len-idx-path_len, fname)
  111
+        {some=s} -> s
  112
+        {none} -> fname
  113
+        end
  114
+      {none} -> fname
  115
+
101 116
 }}
1  opadoc/generator/opaDocTree.opa
@@ -280,6 +280,7 @@ OpaDocTree = {{
280 280
 
281 281
   of_files(files) =
282 282
     aux(acc, path) =
  283
+      path = OpaDocUtils.relative_path(path)
283 284
       key  = {file = path}
284 285
       path_dot = OpaDocUtils.uri_of_path(path)
285 286
       node = {

0 notes on commit 03210d5

Please sign in to comment.
Something went wrong with that request. Please try again.