Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions include/otdgen/DocCodeBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ class DocCodeBlock

public:

enum class Type
{
None,
Cpp,
};

enum class LineType
{
Normal,
Expand All @@ -52,7 +46,7 @@ class DocCodeBlock
DocCodeBlock & operator = (const DocCodeBlock & rhs) = default;
DocCodeBlock & operator = (DocCodeBlock && rhs) = default;

Type type;
std::string type;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please specify the naming standard used here as a comment

std::list <std::pair <std::string, LineType>>
lines;

Expand Down
15 changes: 4 additions & 11 deletions src/GeneratorGitHubMarkDown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,17 +357,10 @@ Name : process

void GeneratorGitHubMarkDown::process (std::string & output, std::vector <std::string> & /* cur */, const DocCodeBlock & codeblock)
{
switch (codeblock.type)
{
case DocCodeBlock::Type::None:
output += "```\n";
break;

case DocCodeBlock::Type::Cpp:
output += "```c++\n";
break;
}

output += "```";
output += codeblock.type;
output += "\n";

for (auto && line : codeblock.lines)
{
output += line.first + "\n";
Expand Down
14 changes: 6 additions & 8 deletions src/GeneratorPlainText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,17 +322,15 @@ void GeneratorPlainText::process (std::string & output, std::vector <std::strin

output += std::string (repetitions, '*');

switch (codeblock.type)
{
case DocCodeBlock::Type::None:
output += " code (unspecified language): \n";
break;
output += " code";

case DocCodeBlock::Type::Cpp:
output += " code (c++): \n";
break;
if (!codeblock.type.empty())
{
output += " (" + codeblock.type + ")";
}

output += ":\n";

for (auto && line : codeblock.lines)
{
output += line.first + "\n";
Expand Down
7 changes: 2 additions & 5 deletions src/StructuralAnalyser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,16 +518,13 @@ void StructuralAnalyser::process (const ExpressionCodeBlock & codeblock)
_blocks_ptr->_content.end (), std::make_shared <DocCodeBlock> ()
));

block.type = DocCodeBlock::Type::None;
block.type = "";

auto it = codeblock.options.find ("language");

if (it != codeblock.options.end ())
{
if (it->second == "c++")
{
block.type = DocCodeBlock::Type::Cpp;
}
block.type = it->second;
}

for (auto && line : codeblock.lines)
Expand Down