Make these definitions less ugly

How can I make these definitions less ugly?
const char* table = "";
const char* tr = " ";
const char* td = " ";
const char* end_td = " \n";
const char* end_tr = " \n";
const char* end_table = "\n";

Attached: ugly.png (440x141, 9K)

>Ctards in charge of security

By eliding all whitespace from your strings. Don't mix semantics and formatting.

The only time these tags will be written to a file is with indentation.
Are you suggesting I do this?
fout

#define "

Cont'd or better yet, setw(2)?

start_table
start_tr
start_td

the end_* declaration makes me search for the start

Dont use C for this task at all.

It's C++, and y?

wtf man,,,

Dont build HTML crap inside of C/++
You're just asking for a headache
If youre going to use a pre existing well sanitized library with a clean API

Why do you need blank space ?

C is my favorite language but even I acknowledge that using it to construct HTML (at least in the very manual way you're clearly following) is retarded.

Why are you using C for this at all? Some retarded uni course isn't making you do this is it?

what the fuck are you doing

make a tag name enum, then make a function to create the html tag (encase in ) and add tabs / spaces algorithmically

or ignore this nerd and do it anyway since it depends on what you're trying to do, i'm not gonna use some gay API if it's something relatively simple. you could argue "if it's something simple why use C or C++ for it" but that's like telling a guitarist they should play a song on a piano even if they're more familiar with a guitar and would probably perform it better as a result of that, yknow. c++ is my primary language and if you aren't retarded you'll have the knowledge to beat it into working however you need it to like a true alpha

be a MANNNNN, but alright yeah what you're doing is weird but still don't go out and use a language you're less familiar with or something for a project like this if you're short on time or whatever, but if this is for your job or something though then yeah wtf are you doing

write a program that spits out generated markdown and pass it to html formatter
if you want to do everything yourself, write formatter module yourself
your solution may work for simple stuff, but will produce garbage for something slightly more complicated

what is wrong with you?

write it so you can do this
class table;
class tr;
class td;
std::cout

spaces for alignment, tabs for indentation

std::string Indent( int _spaces ); // emit a string of _spaces spaces

template< typename Output >
class scopedEmitter
{
public:

scopedEmitter( int _indent, std::string const & _tag, Output * _out )
: m_output( _out )
, m_tag( _tag )
, m_indent( _indent )
{
m_out.print( Indent( m_indent ) + "" );
}

~scopedEmitter()
{
m_out.print( Indent( m_indent ) + "" );
}

private:

Output * m_output;
std::string m_tag;
int m_indent;
};

// then

scopedEmitter Table( int _spaces = 0 )
{
return scopedEmitter( _spaces, "table", ::GetOutput() );
}

scopedEmitter TableRow( int _spaces = 2 )
{
return scopedEmitter( _spaces, "tr", ::GetOutput() );
}

scopedEmitter TableData( int _spaces = 4 )
{
return scopedEmitter( _spaces, "td", ::GetOutput() );
}


void createTable()
{
auto tableTag = Table();
for ( int tableRows = 0; tableRows < tableRowsMax; ++tableRows )
{
auto tableRow = TableRow();
for( int tableDatas = 0; tableDatas < tableDatasMax; ++tableDatas )
{
auto tableData = TableData();
// print whatever
// exiting scope prints table dataClose();
}
// exiting scope emits table row close tag
}

// exit scope, prints close tag
}


I hope you get the idea. Also - customize it to nicely print formatted tables, if you so choose.

what do you think is wrong with me

don't even bother formatting anything and instead automatically indent the tags after you've generated what you wanna generate, using strings for this is kinda stupid btw and also

put them in a different class then import that class.

>enterprise sepples

This is actually more like telling a wanker to use his dragon dildo to build a car. His main skills may be with the dragon dildo but it's not the right tool for the job.

You're using c++ to generate html, and on top of that your assigning each tag to it's own variable. It's like writing out an unrolled loop by hand when a for statement could save you a thousand lines of code. There's literally something wrong with you if you think this is a sane approach.