-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* URL pipeline experiment start * padding * more thoughts on pipeline editor * docs pipeline upgrade * missing parameters for docs job * try running unit tests * debug pipeline * pipeline config buttons * what about this? * submodule updates * - config: save and load vector of steps - save pipeline as it's changing * loading pipeline
- Loading branch information
Showing
86 changed files
with
559 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include "replacer.h" | ||
#include "str.h" | ||
|
||
using namespace std; | ||
|
||
namespace bt::pipeline { | ||
|
||
replacer::replacer(replacer_kind kind, const std::string& find, const std::string& replace) : | ||
url_pipeline_step{url_pipeline_step_type::find_replace}, | ||
kind{kind}, find{find}, replace{replace} { | ||
} | ||
|
||
replacer::replacer(const std::string& rule) : url_pipeline_step(url_pipeline_step_type::find_replace) { | ||
// parse rules - each string contains 3 parts separated by a pipe | ||
// kind|match|replace | ||
|
||
auto parts = str::split_pipe(rule); | ||
//if(parts.size() != 3) { | ||
// continue; | ||
//} | ||
|
||
if(parts[0] == "rgx") { | ||
kind = replacer_kind::regex; | ||
} else { | ||
kind = replacer_kind::find_replace; | ||
} | ||
|
||
if(parts.size() == 3) { | ||
find = parts[1]; | ||
replace = parts[2]; | ||
} | ||
} | ||
|
||
void replacer::process(url_payload& up) { | ||
string url = up.match_url.empty() ? up.url : up.match_url; | ||
|
||
if(kind == replacer_kind::find_replace) { | ||
size_t idx = url.find(find); | ||
if(idx != string::npos) { | ||
str::replace_all(url, find, replace); | ||
up.match_url = up.open_url = url; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
#include <string> | ||
#include <vector> | ||
#include "../url_pipeline_step.h" | ||
|
||
namespace bt::pipeline { | ||
|
||
enum class replacer_kind { | ||
find_replace, | ||
regex | ||
}; | ||
|
||
class replacer : public url_pipeline_step { | ||
public: | ||
|
||
replacer_kind kind{replacer_kind::find_replace}; | ||
std::string find; | ||
std::string replace; | ||
|
||
replacer(replacer_kind kind, const std::string& find, const std::string& replace); | ||
replacer(const std::string& rule); | ||
|
||
|
||
// Inherited via url_pipeline_step | ||
void process(url_payload& up) override; | ||
|
||
private: | ||
}; | ||
} |
Oops, something went wrong.