Commit 0645d555 authored by Boris Kocherov's avatar Boris Kocherov

support id_prefix configured by scope

parent e680c59b
...@@ -344,6 +344,8 @@ ...@@ -344,6 +344,8 @@
for (i = 0; i < scopes.length; i += 1) { for (i = 0; i < scopes.length; i += 1) {
size++; size++;
scope = scopes[i]; scope = scopes[i];
scope.id_prefix = scope.id_prefix || context._options.id_prefix;
scope.prefix = scope.prefix || "";
if (scope.excluded_paths) { if (scope.excluded_paths) {
context.excluded_paths = context.excluded_paths =
context.excluded_paths.concat(scope.excluded_paths); context.excluded_paths.concat(scope.excluded_paths);
...@@ -358,10 +360,10 @@ ...@@ -358,10 +360,10 @@
path = path.replace(scope.delete_path_part, ""); path = path.replace(scope.delete_path_part, "");
} }
path = path.split("/").join("_").split(".").join("_"); path = path.split("/").join("_").split(".").join("_");
if (path[path.length - 1] === "_") { if (['_', '.'].indexOf(path[path.length - 1]) >= 0) {
path = path + "*"; path = path + "*";
} }
context._template_path_list[context._options.id_prefix + path] = 1; context._template_path_list[scope.id_prefix + path] = 1;
} }
} }
if (size === 0) { if (size === 0) {
...@@ -380,7 +382,8 @@ ...@@ -380,7 +382,8 @@
.push(function (result) { .push(function (result) {
var id, path, last_index, filename, ext, i, size, var id, path, last_index, filename, ext, i, size,
xmldoc, bt_links = {}, template_path_list = [], xmldoc, bt_links = {}, template_path_list = [],
generated_appcache = [], document_publication_wfl; generated_appcache = [], document_publication_wfl,
id_prefix;
for (id in result) { for (id in result) {
if ( if (
result.hasOwnProperty(id) && result.hasOwnProperty(id) &&
...@@ -408,6 +411,7 @@ ...@@ -408,6 +411,7 @@
}; };
path = path + filename; path = path + filename;
size = 0; size = 0;
id_prefix = "";
for (i in context._paths) { for (i in context._paths) {
if (context._paths.hasOwnProperty(i)) { if (context._paths.hasOwnProperty(i)) {
size++; size++;
...@@ -418,6 +422,7 @@ ...@@ -418,6 +422,7 @@
if (context._paths[i].prefix) { if (context._paths[i].prefix) {
path = context._paths[i].prefix + path; path = context._paths[i].prefix + path;
} }
id_prefix = context._paths[i].id_prefix;
xmldoc.default_reference = path; xmldoc.default_reference = path;
break; break;
} }
...@@ -428,10 +433,10 @@ ...@@ -428,10 +433,10 @@
} else { } else {
xmldoc.default_reference = path; xmldoc.default_reference = path;
} }
if (!context._options.id_prefix && path === "index.html") { if (!id_prefix && path === "index.html") {
continue; continue;
} }
xmldoc.id = context._options.id_prefix + path; xmldoc.id = id_prefix + path;
xmldoc.id = xmldoc.id.split("/").join("_").split(".").join("_"); xmldoc.id = xmldoc.id.split("/").join("_").split(".").join("_");
ext = filename.substring(filename.lastIndexOf('.') + 1); ext = filename.substring(filename.lastIndexOf('.') + 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment