From 0357a8f6aa87351ca3f1c726c9cbfe20eb796363 Mon Sep 17 00:00:00 2001
From: Lars Trieloff <trieloff@adobe.com>
Date: Wed, 13 Dec 2017 17:54:48 +0000
Subject: [PATCH] #14 use better name for frontmatter

---
 examples/docs/abstract.schema.md             | 28 +---------------
 examples/docs/definitions.schema.md          | 24 +-------------
 examples/docs/example.schema.md              | 34 +-------------------
 examples/docs/simple.schema.md               | 22 +------------
 examples/docs/subdir/subdir.schema.md        | 23 +------------
 lib/markdownWriter.js                        |  9 ++++--
 templates/md/divider.ejs                     |  2 +-
 templates/md/{header.ejs => frontmatter.ejs} |  0
 8 files changed, 12 insertions(+), 130 deletions(-)
 rename templates/md/{header.ejs => frontmatter.ejs} (100%)

diff --git a/examples/docs/abstract.schema.md b/examples/docs/abstract.schema.md
index b58d18a..c7cd242 100644
--- a/examples/docs/abstract.schema.md
+++ b/examples/docs/abstract.schema.md
@@ -6,30 +6,4 @@ foo: bar
 ---
 
 
- ---
----
-template : reference
-foo : bar
----
-
-  
-# Abstract
-  
-*  **Type:** object
-  
-This is an abstract schema. It has `definitions`, but does not declare any properties
-
-
-
-##  first
-### Properties
-###  foo  
-*  **Type:** string
-  
- A unique identifier given to every addressable thing.
-##  second
-### Properties
-###  bar  
-*  **Type:** string
-  
- A unique identifier given to every addressable thing.
+---
\ No newline at end of file
diff --git a/examples/docs/definitions.schema.md b/examples/docs/definitions.schema.md
index 6fa18af..c7cd242 100644
--- a/examples/docs/definitions.schema.md
+++ b/examples/docs/definitions.schema.md
@@ -6,26 +6,4 @@ foo: bar
 ---
 
 
- ---
----
-template : reference
-foo : bar
----
-
-  
-# Definitions
-  
-*  **Type:** object
-  
-This is an example of using a `definitions` object within a schema.
-It is imported using `allOf` and `$ref`.
-
-## Properties
-
-###  id    
-* **Required**  
-*  **Type:** string  
-*  **Format:** uri
-  
- A unique identifier given to every addressable thing.
-
+---
\ No newline at end of file
diff --git a/examples/docs/example.schema.md b/examples/docs/example.schema.md
index 0a04b72..c7cd242 100644
--- a/examples/docs/example.schema.md
+++ b/examples/docs/example.schema.md
@@ -6,36 +6,4 @@ foo: bar
 ---
 
 
- ---
----
-template : reference
-foo : bar
----
-
-  
-# Example
-  
-*  **Type:** object
-  
-This is an example schema with examples. Too many examples? There can never be too many examples!
-  
-**Examples:**
-```json
-{
-    "foo": "bar",
-    "bar": "baz"
-}
-```
-
-
-## Properties
-
-###  foo  
-*  **Type:** string
-  
- A simple string.
-###  bar  
-*  **Type:** string
-  
- A simple string.
-
+---
\ No newline at end of file
diff --git a/examples/docs/simple.schema.md b/examples/docs/simple.schema.md
index a00a364..c7cd242 100644
--- a/examples/docs/simple.schema.md
+++ b/examples/docs/simple.schema.md
@@ -6,24 +6,4 @@ foo: bar
 ---
 
 
- ---
----
-template : reference
-foo : bar
----
-
-  
-# Simple
-  
-*  **Type:** object
-  
-This is a *very* simple example of a JSON schema. There is only one property.
-
-## Properties
-
-###  id  
-*  **Type:** string  
-*  **Format:** uri
-  
- A unique identifier given to every addressable thing.
-
+---
\ No newline at end of file
diff --git a/examples/docs/subdir/subdir.schema.md b/examples/docs/subdir/subdir.schema.md
index 53f9692..c7cd242 100644
--- a/examples/docs/subdir/subdir.schema.md
+++ b/examples/docs/subdir/subdir.schema.md
@@ -6,25 +6,4 @@ foo: bar
 ---
 
 
- ---
----
-template : reference
-foo : bar
----
-
-  
-# Subdir
-  
-*  **Type:** object
-  
-A schema in a sub directory
-
-
-
-##  content
-### Properties
-###  id  
-*  **Type:** string  
-*  **Format:** uri
-  
- A unique identifier given to every addressable thing.
+---
\ No newline at end of file
diff --git a/lib/markdownWriter.js b/lib/markdownWriter.js
index 4ae8ed9..54af0d8 100644
--- a/lib/markdownWriter.js
+++ b/lib/markdownWriter.js
@@ -40,10 +40,13 @@ const generateMarkdown = function(filename, schema, schemaPath, outDir, dependen
 
   console.log(schema.metaElements);
 
+  // this structure allows us to have separate templates for each element. Instead of having
+  // one huge template, each block can be built individually
   const multi = [
-    [ 'header.ejs', { meta: schema.metaElements } ],
-    [ 'divider.ejs', null ],
-    [ 'topSchema.ejs', ctx ]
+    [ 'frontmatter.ejs', { meta: schema.metaElements } ],
+    //[ 'divider.ejs', null ],
+    //[ 'topSchema.ejs', ctx ],
+    [ 'divider.ejs', null ]
   ].map(([ template, context ]) => {
     return [
       path.join(__dirname, '../templates/md/' + template),
diff --git a/templates/md/divider.ejs b/templates/md/divider.ejs
index 5f6729f..9d24bb8 100644
--- a/templates/md/divider.ejs
+++ b/templates/md/divider.ejs
@@ -4,4 +4,4 @@
  * you may not use this file except in compliance with the License. You may obtain a copy
  * of the License at http://www.apache.org/licenses/LICENSE-2.0
  */ %>
- ---
\ No newline at end of file
+---
\ No newline at end of file
diff --git a/templates/md/header.ejs b/templates/md/frontmatter.ejs
similarity index 100%
rename from templates/md/header.ejs
rename to templates/md/frontmatter.ejs
-- 
GitLab