DEV Community

gus
gus

Posted on

2

GAS SSG

image

This week I wrote a Static Site Generator in C++ that takes a text file or folder structure and generates HTML files based on any text files found within. It's been 8 months since I've written any code so it was a big undertaking getting back into it, but it felt good to code in C++ again. There's a lot I could've written more efficiently, some code duplication etc. but it gets the job done and got me working with classmates to solve some problems open source style.

The SSG comes in .cpp form and should be compiled using C++17 to support the recursive file system searching feature from . It accepts command line arguments -i or --input to specify an input file or folder structure, -h or --help for info on the commands to use, and -v or --version for version information.

image

If there's a title with 2 blank lines following it, GAS will make this the title of the page. This line will also be be made an <h1> element.

image

The blocks of text are split up into <p> tags if a blank line is found between them. That's about all there is to it, you can check out the repo here and a sample HTML page generated here.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay