Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[enhance] opadoc: allow different naming schemes (both buggy), depend…

…ing on an option
  • Loading branch information...
commit 0c2802e709f1111d1dd2d7fe2bf5462e2c4d3fdd 1 parent 4afcd49
François-Régis Sinot authored
9 opadoc/common/opaDocParameters.opa
View
@@ -43,6 +43,7 @@ type OpaDocParameters.t = {
help : bool
output_dir : option(string)
private : bool
+ long_uris : bool
}
/**
@@ -59,6 +60,7 @@ OpaDocParameters = {{
help = false
output_dir = {none}
private = false
+ long_uris = false
}
/**
@@ -101,6 +103,13 @@ OpaDocParameters = {{
state = { state with output_dir = {some = Text.to_string(path)}}
{no_params = state}
},
+ { CommandLine.default_parser with
+ names = [ "--long-uris" ]
+ description = "Use long uris of the form stdlib.core.rpc.core.network.opa instead of network.opa"
+ on_encounter(state) =
+ state = { state with long_uris = true }
+ {no_params = state}
+ },
]
}
4 opadoc/common/opaDocUtils.opa
View
@@ -87,4 +87,8 @@ OpaDocUtils = {{
String.ordering(String.to_lower(p1), String.to_lower(p2))
List.sort_with(aux, list)
+ uri_of_path =
+ if OpaDocParameters.get().long_uris
+ then String.replace(File.dir_sep, ".", _)
+ else File.basename
}}
6 opadoc/generator/opaApiFile.opa
View
@@ -31,10 +31,6 @@ OpaApiFile = {{
l = List.map(Xhtml.of_string, l)
<>{ List.intersperse(<br />, l) }</>
- /* not really the basename ... */
- @private basename(s) =
- String.replace(File.dir_sep, ".", s)
-
/**
* Build the association from types to values hyperlink, and entries by path_name
**/
@@ -43,7 +39,7 @@ OpaApiFile = {{
if OpaDocUtils.is_private(entry) then tuple_acc else
path_name = String.concat(".", entry.path)
path_html = OpaDocUtils.sanitize_path("{entry.pkg}.{path_name}")
- entry_html = (path_name, (entry, path_html, basename(entry.fname))) : Entry.html
+ entry_html = (path_name, (entry, path_html, OpaDocUtils.uri_of_path(entry.fname))) : Entry.html
type_table =
match entry.code_elt with
| { value = { ty = opatype ; ... } } ->
3  opadoc/generator/opaDocJoin.opa
View
@@ -92,10 +92,9 @@ OpaDocJoin = {{
* of mixed elements indexed by the original filenames.
**/
file_separation(all_join : list(Join.mix)) =
- basename(s) = String.replace(File.dir_sep, ".", s)
// list ==> stringmap of list, indexed by filename
upd(mix, map) =
- f = basename(get_file(mix))
+ f = OpaDocUtils.uri_of_path(get_file(mix))
new_list = List.cons(mix, StringMap.get(f, map) ? [])
StringMap.add(f, new_list, map)
List.foldl(upd, all_join, StringMap.empty)
2  opadoc/generator/opaDocTree.opa
View
@@ -281,7 +281,7 @@ OpaDocTree = {{
of_files(files) =
aux(acc, path) =
key = {file = path}
- path_dot = String.replace(File.dir_sep, ".", path)
+ path_dot = OpaDocUtils.uri_of_path(path)
node = {
tree = none
id = "node_file_{path_dot}"
Please sign in to comment.
Something went wrong with that request. Please try again.