realized the -i system is terrible; csml -> html is reliable
This commit is contained in:
@ -25,7 +25,6 @@ const char * const help_message =
|
||||
" -x : the input is to be force interpeted as XML/HTML\n"
|
||||
" -s <string> : colon separeted list of option sets\n"
|
||||
" -S <string> : colon separeted list of special asymetric tags starters\n"
|
||||
" -i <string> : colon separeted list of tags which contents should be ignored\n"
|
||||
" -o <file> : specify output file name for the NEXT input file\n"
|
||||
" -q <char> : use <char> for quoting (default: \"'\")\n"
|
||||
" -v : print version and quit\n"
|
||||
@ -113,9 +112,6 @@ signed parse_round2_arguments(int argc, char * * argv) {
|
||||
} else if (!strcmp(argv[n], "-q")) {
|
||||
++n;
|
||||
quote = argv[n][0];
|
||||
} else if (!strcmp(argv[n], "-i")) {
|
||||
++n;
|
||||
parse_colon_list(argv[n], ignore_list);
|
||||
} else if (!strcmp(argv[n], "-s")) {
|
||||
++n;
|
||||
const int err = parse_sets(argv[n]);
|
||||
@ -183,8 +179,6 @@ signed parse_sets(char * const list) {
|
||||
int i = 0;
|
||||
do {
|
||||
if (!strcmp(data, "html")) {
|
||||
ignore_list.emplace_back("style");
|
||||
ignore_list.emplace_back("script");
|
||||
asymmetric_special_list.emplace_back("?");
|
||||
} else if (!strcmp(data, "xml")) {
|
||||
asymmetric_special_list.emplace_back("?");
|
||||
|
@ -104,10 +104,7 @@ unicode [\300-\364]
|
||||
\{ {
|
||||
push_tag();
|
||||
ECHOS(("<" + csml_tag_stack.top() + ">").c_str());
|
||||
if (do_ignore(csml_tag_stack.top())) {
|
||||
buffer = std::string("");
|
||||
BEGIN IGNORE_COUNT_START;
|
||||
}
|
||||
BEGIN IGNORE_COUNT_START;
|
||||
}
|
||||
\} {
|
||||
ECHO_CANDIDATE;
|
||||
@ -224,8 +221,13 @@ unicode [\300-\364]
|
||||
++ignore_count;
|
||||
}
|
||||
.|\n {
|
||||
BUFFER(yytext);
|
||||
BEGIN IGNORE;
|
||||
if (ignore_count == 1) {
|
||||
yyless(0);
|
||||
BEGIN BODY;
|
||||
} else {
|
||||
BUFFER(yytext);
|
||||
BEGIN IGNORE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,22 +20,13 @@ DECLARE_LEXER(xml);
|
||||
#define ECHOC(c) fputc(c, yyout)
|
||||
#define BUFFER(s) buffer += s
|
||||
|
||||
extern std::vector<std::string> ignore_list;
|
||||
extern std::vector<std::string> asymmetric_special_list;
|
||||
|
||||
extern bool is_asymmetric;
|
||||
|
||||
inline
|
||||
bool do_ignore(const std::string ¤t_tag) {
|
||||
return std::find(ignore_list.begin(),
|
||||
ignore_list.end(),
|
||||
current_tag)
|
||||
!= ignore_list.end();
|
||||
}
|
||||
|
||||
extern char quote;
|
||||
|
||||
/* number of '{' / '}'s to be placed around the current ignored block
|
||||
/* number of '{' & '}'s to be placed around the current ignored block
|
||||
*/
|
||||
extern int ignore_count;
|
||||
|
||||
|
14
source/xml.l
14
source/xml.l
@ -143,12 +143,7 @@ identifier [A-z][A-z0-9]*
|
||||
\> {
|
||||
xml_tag_stack_push();
|
||||
ECHOS(" {");
|
||||
if (do_ignore(current_tag)) {
|
||||
buffer = std::string("");
|
||||
BEGIN IGNORE;
|
||||
} else {
|
||||
BEGIN INITIAL;
|
||||
}
|
||||
BEGIN IGNORE;
|
||||
}
|
||||
\/\> {
|
||||
ECHOC(';');
|
||||
@ -176,12 +171,7 @@ identifier [A-z][A-z0-9]*
|
||||
\> {
|
||||
xml_tag_stack_push();
|
||||
ECHOS(") {");
|
||||
if (do_ignore(current_tag)) {
|
||||
buffer = std::string("");
|
||||
BEGIN IGNORE;
|
||||
} else {
|
||||
BEGIN INITIAL;
|
||||
}
|
||||
BEGIN IGNORE;
|
||||
}
|
||||
\/\> {
|
||||
ECHOS(");");
|
||||
|
Reference in New Issue
Block a user