properly handle inline references in apple dev docs
parent
dd46072666
commit
0cbf5ad99c
|
@ -1,5 +1,8 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
|
dev_references: [],
|
||||||
|
|
||||||
|
|
||||||
dev_doc_url: function (url) {
|
dev_doc_url: function (url) {
|
||||||
|
|
||||||
let query_parts = url.split('?');
|
let query_parts = url.split('?');
|
||||||
|
@ -25,6 +28,10 @@ module.exports = {
|
||||||
|
|
||||||
parse_dev_doc_json: function (json) {
|
parse_dev_doc_json: function (json) {
|
||||||
let text = "";
|
let text = "";
|
||||||
|
|
||||||
|
if (typeof json.references !== 'undefined') {
|
||||||
|
this.dev_references = json.references;
|
||||||
|
}
|
||||||
if (typeof json.primaryContentSections !== 'undefined') {
|
if (typeof json.primaryContentSections !== 'undefined') {
|
||||||
text += this.process_sections(json.primaryContentSections);
|
text += this.process_sections(json.primaryContentSections);
|
||||||
} else if (typeof json.sections !== 'undefined') {
|
} else if (typeof json.sections !== 'undefined') {
|
||||||
|
@ -111,10 +118,11 @@ module.exports = {
|
||||||
} else if (inline.type == "link") {
|
} else if (inline.type == "link") {
|
||||||
inline_text += "["+inline.title+"]("+inline.destination+")";
|
inline_text += "["+inline.title+"]("+inline.destination+")";
|
||||||
} else if (inline.type == "reference") {
|
} else if (inline.type == "reference") {
|
||||||
let ref = inline.identifier.split('/');
|
if (typeof inline.identifier !== 'undefined') {
|
||||||
let name = ref[ref.length-1];
|
if (typeof this.dev_references[inline.identifier] !== 'undefined') {
|
||||||
let parts = name.split('-');
|
inline_text += this.dev_references[inline.identifier].title;
|
||||||
inline_text += parts[parts.length-1];
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue