X-Git-Url: https://projects.mako.cc/source/wikiq/blobdiff_plain/23bc9bfafc9312bd4f8bb72f22e38c087ef0b0fa..87e6add2820dd71cd79585d3ffa74f7fe46820f3:/wikiq.cpp diff --git a/wikiq.cpp b/wikiq.cpp index 57d97fa..da5e7b7 100644 --- a/wikiq.cpp +++ b/wikiq.cpp @@ -254,7 +254,9 @@ write_row(revisionData *data) vector regex_matches_adds; vector regex_matches_dels; - if (!data->last_text_tokens.empty()) { + if (data->last_text_tokens.empty()) { + additions = data->text; + } else { // do the diff dtl::Diff< string, vector > d(data->last_text_tokens, text_tokens); @@ -274,25 +276,22 @@ write_row(revisionData *data) break; } } - - if (!additions.empty()) { - //cout << "ADD: " << additions << endl; - for (vector::iterator r = data->regexes.begin(); r != data->regexes.end(); ++r) { - pcrecpp::RE& regex = *r; - regex_matches_adds.push_back(regex.PartialMatch(additions)); - } + } + + if (!additions.empty()) { + //cout << "ADD: " << additions << endl; + for (vector::iterator r = data->regexes.begin(); r != data->regexes.end(); ++r) { + pcrecpp::RE& regex = *r; + regex_matches_adds.push_back(regex.PartialMatch(additions)); } + } - if (!deletions.empty()) { - //cout << "DEL: " << deletions << endl; - for (vector::iterator r = data->regexes.begin(); r != data->regexes.end(); ++r) { - pcrecpp::RE& regex = *r; - regex_matches_dels.push_back(regex.PartialMatch(deletions)); - } + if (!deletions.empty()) { + //cout << "DEL: " << deletions << endl; + for (vector::iterator r = data->regexes.begin(); r != data->regexes.end(); ++r) { + pcrecpp::RE& regex = *r; + regex_matches_dels.push_back(regex.PartialMatch(deletions)); } - - // apply regex to the diff - } data->last_text_tokens = text_tokens; @@ -490,7 +489,7 @@ void print_usage(char* argv[]) { << endl << "options:" << endl << " -t print text and comments after each line of tab separated data" << endl - << " -n name of the following regex (e.g. -N name -r \"...\")" << endl + << " -n name of the following regex (e.g. -n name -r \"...\")" << endl << " -r regex to check against additions and deletions" << endl << endl << "Takes a wikimedia data dump XML stream on standard in, and produces" << endl