diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-doc-markdown-writer.cpp | 13 | ||||
| -rw-r--r-- | source/slang/slang.cpp | 28 |
2 files changed, 21 insertions, 20 deletions
diff --git a/source/slang/slang-doc-markdown-writer.cpp b/source/slang/slang-doc-markdown-writer.cpp index 5105b0b26..c2bc05dbb 100644 --- a/source/slang/slang-doc-markdown-writer.cpp +++ b/source/slang/slang-doc-markdown-writer.cpp @@ -830,6 +830,8 @@ void DocMarkdownWriter::writeCallableOverridable(const DocMarkup::Entry& entry, _appendAsBullets(_getUniqueParams(genericDecls), '`'); // And parameters _appendAsBullets(_getUniqueParams(paramDecls), '`'); + + out << toSlice("\n"); } } } @@ -1034,8 +1036,9 @@ void DocMarkdownWriter::writeAggType(const DocMarkup::Entry& entry, AggTypeDeclB if (params.getCount()) { - out << "## Generic Parameters\n\n"; + out << toSlice("## Generic Parameters\n\n"); _appendAsBullets(_getAsNameAndTextList(params), '`'); + out << toSlice("\n"); } } @@ -1044,9 +1047,9 @@ void DocMarkdownWriter::writeAggType(const DocMarkup::Entry& entry, AggTypeDeclB _getDeclsOfType<VarDecl>(aggTypeDecl, fields); if (fields.getCount()) { - out << "## Fields\n\n"; - + out << toSlice("## Fields\n\n"); _appendAsBullets(_getAsNameAndTextList(fields), '`'); + out << toSlice("\n"); } } @@ -1072,6 +1075,7 @@ void DocMarkdownWriter::writeAggType(const DocMarkup::Entry& entry, AggTypeDeclB out << "## Methods\n\n"; _appendAsBullets(_getAsStringList(uniqueMethods), '`'); + out << toSlice("\n"); } } } @@ -1081,7 +1085,8 @@ void DocMarkdownWriter::writePreamble(const DocMarkup::Entry& entry) SLANG_UNUSED(entry); auto& out = m_builder; - out << toSlice("\n"); + //out << toSlice("\n"); + out.appendRepeatedChar('-', 80); out << toSlice("\n"); } diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index ae3a1f419..93d7be310 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -1843,26 +1843,22 @@ SlangResult FrontEndCompileRequest::executeActionsInner() // cause any problems with scoping ASTBuilder* astBuilder = getLinkage()->getASTBuilder(); - for (TranslationUnitRequest* translationUnit : translationUnits) - { - RefPtr<DocMarkup> markup(new DocMarkup); - DocMarkupExtractor::extract(translationUnit->getModuleDecl(), getSourceManager(), getSink(), markup); + ISlangWriter* writer = getSink()->writer; - // Hmm.. we can have multiple sourcefiles. So fir now we just pick the first, so as to come up with - // a reasonable name - SourceFile* sourceFile = translationUnit->getSourceFiles()[0]; - - // Extract to a file - const String& path = sourceFile->getPathInfo().foundPath; - if (path.getLength()) + // Write output to the diagnostic writer + if (writer) + { + for (TranslationUnitRequest* translationUnit : translationUnits) { - String fileName = Path::getFileNameWithoutExt(path); - fileName.append(".md"); + RefPtr<DocMarkup> markup(new DocMarkup); + DocMarkupExtractor::extract(translationUnit->getModuleDecl(), getSourceManager(), getSink(), markup); - DocMarkdownWriter writer(markup, astBuilder); - writer.writeAll(); + // Convert to markdown + DocMarkdownWriter markdownWriter(markup, astBuilder); + markdownWriter.writeAll(); - File::writeAllText(fileName, writer.getOutput()); + UnownedStringSlice docText = markdownWriter.getOutput().getUnownedSlice(); + writer->write(docText.begin(), docText.getLength()); } } } |
