Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
September 18, 2022 10:57 pm GMT

palpatine - SSG Release1.0.0

What is palpatine?

palpatine is a minimal static site generator (SSG) built with CMake and written in C++17. It is a command line tool that takes a directory of raw data and generates a static website. It is designed to be fast, simple, and easy to use.
Palpatine is also my favorite villain, the most powerful Sith Lord ever from Star Wars.

How to use it?

After cloning the repository from github, you can build the project with CMake. If you don't have experience using CMake, don't worry, all you need to do is to run make prepare in the root directory of the project. This will run the prepare directive from the Makefile in the project and generate the executable file palpatine in the build/app directory. You can then run the executable file with ./palpatine to see the usage of the tool. Examine the Makefile to see what happens in the background.

Note: Currently, palpatine only supports txt file as input but soon it will support markdown.

Demonstration of how to use palpatine

# Clone this repository$ git clone https://github.com/batunpc/palpatine# Go into the repository$ cd palpatine# Build project w/ CMake and install dependencies $ make prepare# Run the script$ ./palpatine -i <input> -o <output> -s <stylesheet>

Flags

FlagDescriptionRequired / Optional
-iSpecify raw data directory or file e.g. use data directory in the codebaseRequired
-oSpecify the particular directory that you want to generate static sites to.Optional
-sIf you please, you can add custom stylesheets by specifying the css files.
By default it uses bahunya
Optional
-hThis will display all the available optionsOptional

Dependencies

The following dependencies will be installed in the external directory:

  • p-ranav/argparse - A single-file header-only C++11 library for parsing command line arguments.
  • ikalnytskyi/termcolor - A header-only C++ library for printing colored messages to a terminal.

Features

  • [x] Generate a static site from a directory of text files
  • [x] Generate a stylesheet file for the static site
  • [x] Option to change the output directory
  • [x] Option to include a custom stylesheet link
  • [x] Generate a list of all pages in a directory, with links to each page
  • [x] Parse page title from the first line of the file if given

How to use external libraries in CMake?

Here is a demonstration of how I used in palpatine GitSubModules

  • i. Use this below command convenient to add external libraries to your project as a submodule. The below library is one of the libraries I used in palpatine. You can use any library you want.
 git submodule add https://github.com/p-ranav/argparse external/argparse
  • ii. Then create cmake folder in your project. mkdir cmake (we will add CMake functions)
  • iii. Create AddGitSubmodule.cmake file in the cmake folder.
  • iv. Then add the following code to the AddGitSubmodule.cmake file:
 function(add_git_submodule dirname) find_package(Git REQUIRED) if(NOT EXISTS ${dirname}/CMakeLists.txt) execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive -- ${dirname} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} ) endif() add_subdirectory(${dirname}) endfunction()
  • v. In the root CMakeLists.txt file, add the following code to finally call the function we have written above:
 include(cmake/AddGitSubmodule.cmake) add_git_submodule(external/argparse) # add any library you want
  • vi. We can link this external library we finally have added with our executable. Navigate to your app CMakeLists.txt file and add the following code:
 target_link_libraries(${EXECUTABLE_NAME} PUBLIC argparse)

Original Link: https://dev.to/batunpc/palpatine-release10-350g

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To