1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 04:50:09 +00:00

output* -> write*

This commit is contained in:
Lu Wang 2013-10-18 16:31:59 +08:00
parent 4044528230
commit 25b70bb1e1
6 changed files with 17 additions and 17 deletions

View File

@ -212,7 +212,7 @@ void HTMLRenderer::startPage(int pageNum, GfxState *state, XRef * xref)
<< "\" data-page-no=\"" << pageNum << "\" data-page-no=\"" << pageNum
<< "\" data-page-url=\""; << "\" data-page-url=\"";
outputAttribute(f_pages.fs, cur_page_filename); writeAttribute(f_pages.fs, cur_page_filename);
f_pages.fs << "\">"; f_pages.fs << "\">";
} }
@ -555,7 +555,7 @@ void HTMLRenderer::embed_file(ostream & out, const string & path, const string &
else else
{ {
out << entry.prefix_external; out << entry.prefix_external;
outputAttribute(out, fn); writeAttribute(out, fn);
out << entry.suffix_external << endl; out << entry.suffix_external << endl;
if(copy) if(copy)

View File

@ -195,7 +195,7 @@ void HTMLRenderer::processLink(AnnotLink * al)
if(!dest_str.empty()) if(!dest_str.empty())
{ {
(*f_curpage) << "<a class=\"" << CSS::LINK_CN << "\" href=\""; (*f_curpage) << "<a class=\"" << CSS::LINK_CN << "\" href=\"";
outputAttribute((*f_curpage), dest_str); writeAttribute((*f_curpage), dest_str);
(*f_curpage) << "\""; (*f_curpage) << "\"";
if(!dest_detail_str.empty()) if(!dest_detail_str.empty())

View File

@ -37,7 +37,7 @@ void HTMLRenderer::process_outline_items(GooList * items)
// we don't care dest is empty or not. // we don't care dest is empty or not.
f_outline.fs << "<li>" << "<a class=\"" << CSS::LINK_CN << "\" href=\""; f_outline.fs << "<li>" << "<a class=\"" << CSS::LINK_CN << "\" href=\"";
outputAttribute(f_outline.fs, dest); writeAttribute(f_outline.fs, dest);
f_outline.fs << "\""; f_outline.fs << "\"";
if(!detail.empty()) if(!detail.empty())
@ -45,7 +45,7 @@ void HTMLRenderer::process_outline_items(GooList * items)
f_outline.fs << ">"; f_outline.fs << ">";
outputUnicodes(f_outline.fs, item->getTitle(), item->getTitleLength()); writeUnicodes(f_outline.fs, item->getTitle(), item->getTitleLength());
f_outline.fs << "</a>"; f_outline.fs << "</a>";

View File

@ -179,7 +179,7 @@ void HTMLTextLine::dump_text(ostream & out)
if(abs(target - space_off) <= param.h_eps) if(abs(target - space_off) <= param.h_eps)
{ {
Unicode u = ' '; Unicode u = ' ';
outputUnicodes(out, &u, 1); writeUnicodes(out, &u, 1);
actual_offset = space_off; actual_offset = space_off;
done = true; done = true;
} }
@ -213,7 +213,7 @@ void HTMLTextLine::dump_text(ostream & out)
size_t next_text_idx = text_idx2; size_t next_text_idx = text_idx2;
if((cur_offset_iter != offsets.end()) && (cur_offset_iter->start_idx) < next_text_idx) if((cur_offset_iter != offsets.end()) && (cur_offset_iter->start_idx) < next_text_idx)
next_text_idx = cur_offset_iter->start_idx; next_text_idx = cur_offset_iter->start_idx;
outputUnicodes(out, (&text.front()) + cur_text_idx, next_text_idx - cur_text_idx); writeUnicodes(out, (&text.front()) + cur_text_idx, next_text_idx - cur_text_idx);
cur_text_idx = next_text_idx; cur_text_idx = next_text_idx;
} }
} }

View File

@ -55,7 +55,7 @@ static int mapUTF8(Unicode u, char *buf, int bufSize)
} }
} }
void outputUnicodes(ostream & out, const Unicode * u, int uLen) void writeUnicodes(ostream & out, const Unicode * u, int uLen)
{ {
for(int i = 0; i < uLen; ++i) for(int i = 0; i < uLen; ++i)
{ {
@ -87,13 +87,13 @@ void outputUnicodes(ostream & out, const Unicode * u, int uLen)
} }
/* /*
static void outputHEX(ostream & out, char c) static void writeHEX(ostream & out, char c)
{ {
static const char * hexchars = "0123456789abcdef"; static const char * hexchars = "0123456789abcdef";
out << hexchars[(c>>4)&0xf] << hexchars[c&0xf]; out << hexchars[(c>>4)&0xf] << hexchars[c&0xf];
} }
void outputURL(ostream & out, const string & s) void writeURL(ostream & out, const string & s)
{ {
static char * dont_escape = nullptr; static char * dont_escape = nullptr;
if(!dont_escape) if(!dont_escape)
@ -123,13 +123,13 @@ void outputURL(ostream & out, const string & s)
else else
{ {
out << '%'; out << '%';
outputHEX(out, c); writeHEX(out, c);
} }
} }
} }
*/ */
void outputJSON(ostream & out, const string & s) void writeJSON(ostream & out, const string & s)
{ {
for(auto iter = s.begin(); iter != s.end(); ++iter) for(auto iter = s.begin(); iter != s.end(); ++iter)
{ {
@ -149,7 +149,7 @@ void outputJSON(ostream & out, const string & s)
} }
} }
void outputAttribute(std::ostream & out, const std::string & s) void writeAttribute(std::ostream & out, const std::string & s)
{ {
for (auto iter = s.begin(); iter != s.end(); ++iter) for (auto iter = s.begin(); iter != s.end(); ++iter)
{ {

View File

@ -18,23 +18,23 @@ namespace pdf2htmlEX {
/* /*
* Escape necessary characters, and map Unicode to UTF-8 * Escape necessary characters, and map Unicode to UTF-8
*/ */
void outputUnicodes(std::ostream & out, const Unicode * u, int uLen); void writeUnicodes(std::ostream & out, const Unicode * u, int uLen);
/* /*
* URL escaping * URL escaping
*/ */
//void outputURL(std::ostream & out, const std::string & s); //void writeURL(std::ostream & out, const std::string & s);
/* /*
* JSON escaping * JSON escaping
*/ */
void outputJSON(std::ostream & out, const std::string & s); void writeJSON(std::ostream & out, const std::string & s);
/* /*
* HTML tag attribute escaping * HTML tag attribute escaping
*/ */
void outputAttribute(std::ostream & out, const std::string & s); void writeAttribute(std::ostream & out, const std::string & s);
} // namespace pdf2htmlEX } // namespace pdf2htmlEX