From c8165b2729cdd2b138564606af6e1b054245ef92 Mon Sep 17 00:00:00 2001
From: Lars Trieloff <trieloff@adobe.com>
Date: Thu, 12 Apr 2018 13:57:57 +0000
Subject: [PATCH] Pass docs through to header writer

---
 lib/markdownWriter.js            | 4 ++--
 lib/schema.js                    | 2 +-
 spec/lib/integrationTest.spec.js | 4 +++-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/markdownWriter.js b/lib/markdownWriter.js
index 0077d99..31320e9 100644
--- a/lib/markdownWriter.js
+++ b/lib/markdownWriter.js
@@ -133,7 +133,7 @@ function ejsRender(template, ctx) {
   //return JSON.stringify(obj, null, 2);
 }
 
-const generateMarkdown = function(filename, schema, schemaPath, outDir, dependencyMap) {
+const generateMarkdown = function(filename, schema, schemaPath, outDir, dependencyMap, docs) {
   var ctx = {
     schema: schema,
     _: _,
@@ -151,7 +151,7 @@ const generateMarkdown = function(filename, schema, schemaPath, outDir, dependen
     [ 'header.ejs', {
       schema: schema,
       dependencies: flatten(dependencyMap),
-      table: headers(schema, schemaPath, filename).render() } ],
+      table: headers(schema, schemaPath, filename, docs).render() } ],
     //[ 'divider.ejs', null ],
     //[ 'topSchema.ejs', ctx ],
     [ 'examples.ejs', { examples: stringifyExamples(schema.examples), title: schema.title } ]
diff --git a/lib/schema.js b/lib/schema.js
index 0d4cd6b..a625d72 100644
--- a/lib/schema.js
+++ b/lib/schema.js
@@ -421,7 +421,7 @@ Schema.process = function(schemaMap, schemaPath, docDir, schemaDir, metaElements
         });
       }).then(object => {
         return Promise.all([
-          markdownWriter(schemaMap[schemaKey].filePath, object.mSchema, schemaPath, docDir, object.dep),
+          markdownWriter(schemaMap[schemaKey].filePath, object.mSchema, schemaPath, docDir, object.dep, docs),
           schemaWriter(schemaMap[schemaKey].filePath, object.wSchema, schemaPath, schemaDir) ]);
       });
   }).then(result => {
diff --git a/spec/lib/integrationTest.spec.js b/spec/lib/integrationTest.spec.js
index c30b0df..05a612c 100644
--- a/spec/lib/integrationTest.spec.js
+++ b/spec/lib/integrationTest.spec.js
@@ -21,7 +21,9 @@ describe('Process examples', () => {
       '-m',
       'template=reference',
       '-m',
-      'foo=bar'
+      'foo=bar',
+      '--link-abstract',
+      '../abstract.md'
     ]);
 
     ls.on('close', code => {
-- 
GitLab