diff --git a/source/globals.h b/source/globals.h index 70bda67..e6b41b8 100644 --- a/source/globals.h +++ b/source/globals.h @@ -1,5 +1,6 @@ const static int EXIT_EARLY_SUCCESS = 400; enum { - UNKNOWN_OPTION = 1, - IO_ERROR = 2, + UNKNOWN_OPTION = 1, + IO_ERROR = 2, + UNKNOWN_SET = 3, }; diff --git a/source/main.cpp b/source/main.cpp index dd054e3..f814371 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "cli.h" #include "globals.h" @@ -25,6 +26,10 @@ char * output = NULL; char * input = NULL; const char * const csml_extension = ".csml"; +const std::map> sets = { + {"$html", {"style", "script"}}, +}; + enum class input_type_t { CSML, XML, @@ -116,7 +121,16 @@ signed main(int argc, char * * argv) { char * data = strtok(argv[n], delimiter); int i = 0; do { - ignore_list.emplace_back(data); + if (data[0] == '$') { + const auto &&set = sets.find("$html"); + [[ likely ]] if (set != sets.end()) { + ignore_list.insert(ignore_list.begin(), set->second.begin(), set->second.end()); + } else { + exit(UNKNOWN_SET); + } + } else [[ likely ]] { + ignore_list.emplace_back(data); + } ++i; } while((data = strtok(NULL, delimiter), data)); } else if (!strcmp(argv[n], "-o")) {