Skip to content

Commit

Permalink
keep attributes that start with _op_ for use in DocPacker (#317)
Browse files Browse the repository at this point in the history
  • Loading branch information
herohua authored and vwxyzh committed May 18, 2016
1 parent aa2a52d commit 6e26cf4
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ exports.transform = function (model) {
"requirements"
];

model = opCommon.resetKeysAndSystemAttributes(model, resetKeys);
model = opCommon.resetKeysAndSystemAttributes(model, resetKeys, true);

// For metadata consumed by docs themes, rename with prefix "_op_"
var metaForThemes = ["wordCount", "rawTitle"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports.transform = function (model) {
var resetKeys = [
"newFileRepository"
];
model = opCommon.resetKeysAndSystemAttributes(model, resetKeys);
model = opCommon.resetKeysAndSystemAttributes(model, resetKeys, true);
return {
content: JSON.stringify(model)
};
Expand Down
2 changes: 1 addition & 1 deletion src/docfx.website.themes/docs.html/RestApi.mta.json.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ exports.transform = function (model) {
"sections"
];

model = opCommon.resetKeysAndSystemAttributes(model, resetKeys);
model = opCommon.resetKeysAndSystemAttributes(model, resetKeys, true);
model._op_canonicalUrl = canonicalUrl;
return {
content: JSON.stringify(model)
Expand Down
2 changes: 1 addition & 1 deletion src/docfx.website.themes/docs.html/conceptual.mta.json.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ exports.transform = function (model) {
"source",
"newFileRepository"
];
model = opCommon.resetKeysAndSystemAttributes(model, resetKeys);
model = opCommon.resetKeysAndSystemAttributes(model, resetKeys, true);

// For metadata consumed by docs themes, rename with prefix "_op_"
var metaForThemes = ["wordCount", "rawTitle"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ exports.transform = function (model) {
"rawTitle"
];

model = opCommon.resetKeysAndSystemAttributes(model, resetKeys);
model = opCommon.resetKeysAndSystemAttributes(model, resetKeys, false);

return {
content: JSON.stringify(model)
Expand Down
2 changes: 1 addition & 1 deletion src/docfx.website.themes/op.html/Resource.mta.json.aux.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports.transform = function (model) {
var resetKeys = [
"newFileRepository"
];
model = opCommon.resetKeysAndSystemAttributes(model, resetKeys);
model = opCommon.resetKeysAndSystemAttributes(model, resetKeys, false);

return {
content: JSON.stringify(model)
Expand Down
2 changes: 1 addition & 1 deletion src/docfx.website.themes/op.html/conceptual.mta.json.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exports.transform = function (model) {
"newFileRepository"
];

model = opCommon.resetKeysAndSystemAttributes(model, resetKeys);
model = opCommon.resetKeysAndSystemAttributes(model, resetKeys, false);

return {
content: JSON.stringify(model)
Expand Down
10 changes: 8 additions & 2 deletions src/docfx.website.themes/op.html/op.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ exports.removeExtension = function (path) {
return path;
}

exports.resetKeysAndSystemAttributes = function (model, resetKeys){
exports.resetKeysAndSystemAttributes = function (model, resetKeys, keepOpAttributes){
return exports.batchSetProperties(
model,
function (key) {
return key.indexOf('_') === 0 || (exports.isArray(resetKeys) && resetKeys.indexOf(key) > -1);
if (exports.isArray(resetKeys) && resetKeys.indexOf(key) > -1) {
return true;
}
if (key.indexOf('_op_') === 0 && keepOpAttributes) {
return false;
}
return key.indexOf('_') === 0;
},
undefined);
}
Expand Down
Binary file modified src/docfx/Template/docs.html.zip
Binary file not shown.
Binary file modified src/docfx/Template/op.html.zip
Binary file not shown.

0 comments on commit 6e26cf4

Please sign in to comment.