mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 04:50:09 +00:00
add json encoding
This commit is contained in:
parent
57a687ccf8
commit
de26cf056e
@ -457,7 +457,7 @@ void HTMLRenderer::post_process(void)
|
|||||||
if(iter != page_filenames.begin())
|
if(iter != page_filenames.begin())
|
||||||
output << ",";
|
output << ",";
|
||||||
output << "'";
|
output << "'";
|
||||||
outputURL(output, *iter);
|
outputJSON(output, *iter);
|
||||||
output << "'";
|
output << "'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,4 +127,23 @@ void outputURL(ostream & out, const string & s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void outputJSON(ostream & out, const string & s)
|
||||||
|
{
|
||||||
|
for(auto iter = s.begin(); iter != s.end(); ++iter)
|
||||||
|
{
|
||||||
|
switch (*iter)
|
||||||
|
{
|
||||||
|
case '\\': out << "\\\\"; break;
|
||||||
|
case '"': out << "\\\""; break;
|
||||||
|
case '/': out << "\\/"; break;
|
||||||
|
case '\b': out << "\\b"; break;
|
||||||
|
case '\f': out << "\\f"; break;
|
||||||
|
case '\n': out << "\\n"; break;
|
||||||
|
case '\r': out << "\\r"; break;
|
||||||
|
case '\t': out << "\\t"; break;
|
||||||
|
default: out << *iter; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} //namespace pdf2htmlEX
|
} //namespace pdf2htmlEX
|
||||||
|
@ -25,6 +25,11 @@ void outputUnicodes(std::ostream & out, const Unicode * u, int uLen);
|
|||||||
* URL encoding
|
* URL encoding
|
||||||
*/
|
*/
|
||||||
void outputURL(std::ostream & out, const std::string & s);
|
void outputURL(std::ostream & out, const std::string & s);
|
||||||
|
/*
|
||||||
|
* JSON encoding
|
||||||
|
*/
|
||||||
|
|
||||||
|
void outputJSON(std::ostream & out, const std::string & s);
|
||||||
|
|
||||||
} // namespace pdf2htmlEX
|
} // namespace pdf2htmlEX
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user