From f3933e841554e35a608dd381893d2b83b6dab4bd Mon Sep 17 00:00:00 2001 From: Lars Trieloff <trieloff@adobe.com> Date: Wed, 13 Dec 2017 17:58:47 +0000 Subject: [PATCH] #14 added title of schema --- examples/docs/abstract.schema.md | 3 +-- examples/docs/definitions.schema.md | 3 +-- examples/docs/example.schema.md | 3 +-- examples/docs/simple.schema.md | 3 +-- examples/docs/subdir/subdir.schema.md | 3 +-- lib/markdownWriter.js | 5 +++-- templates/md/header.ejs | 7 +++++++ 7 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 templates/md/header.ejs diff --git a/examples/docs/abstract.schema.md b/examples/docs/abstract.schema.md index c7cd242..d43412e 100644 --- a/examples/docs/abstract.schema.md +++ b/examples/docs/abstract.schema.md @@ -1,9 +1,8 @@ - --- template: reference foo: bar --- - +# Abstract --- \ No newline at end of file diff --git a/examples/docs/definitions.schema.md b/examples/docs/definitions.schema.md index c7cd242..5001818 100644 --- a/examples/docs/definitions.schema.md +++ b/examples/docs/definitions.schema.md @@ -1,9 +1,8 @@ - --- template: reference foo: bar --- - +# Definitions --- \ No newline at end of file diff --git a/examples/docs/example.schema.md b/examples/docs/example.schema.md index c7cd242..c25446a 100644 --- a/examples/docs/example.schema.md +++ b/examples/docs/example.schema.md @@ -1,9 +1,8 @@ - --- template: reference foo: bar --- - +# Example --- \ No newline at end of file diff --git a/examples/docs/simple.schema.md b/examples/docs/simple.schema.md index c7cd242..61036aa 100644 --- a/examples/docs/simple.schema.md +++ b/examples/docs/simple.schema.md @@ -1,9 +1,8 @@ - --- template: reference foo: bar --- - +# Simple --- \ No newline at end of file diff --git a/examples/docs/subdir/subdir.schema.md b/examples/docs/subdir/subdir.schema.md index c7cd242..0f2cb03 100644 --- a/examples/docs/subdir/subdir.schema.md +++ b/examples/docs/subdir/subdir.schema.md @@ -1,9 +1,8 @@ - --- template: reference foo: bar --- - +# Subdir --- \ No newline at end of file diff --git a/lib/markdownWriter.js b/lib/markdownWriter.js index 54af0d8..5dc91d6 100644 --- a/lib/markdownWriter.js +++ b/lib/markdownWriter.js @@ -19,7 +19,7 @@ function render([ template, context ]) { } function build(total, fragment) { - return total + '\n' + fragment.replace(/\n\n/g, '\n'); + return total + fragment.replace(/\n\n/g, '\n'); } function assoc(obj, key, value) { @@ -38,12 +38,13 @@ const generateMarkdown = function(filename, schema, schemaPath, outDir, dependen dependencyMap:dependencyMap }; - console.log(schema.metaElements); + console.log(schema); // 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 = [ [ 'frontmatter.ejs', { meta: schema.metaElements } ], + [ 'header.ejs', { title: schema.title } ], //[ 'divider.ejs', null ], //[ 'topSchema.ejs', ctx ], [ 'divider.ejs', null ] diff --git a/templates/md/header.ejs b/templates/md/header.ejs new file mode 100644 index 0000000..837be32 --- /dev/null +++ b/templates/md/header.ejs @@ -0,0 +1,7 @@ +<% /** + * Copyright 2017 Adobe Systems Incorporated. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * 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 + */ %> +# <%=title %> \ No newline at end of file -- GitLab