mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-21 20:50:07 +00:00
output* -> write*
This commit is contained in:
parent
4044528230
commit
25b70bb1e1
@ -212,7 +212,7 @@ void HTMLRenderer::startPage(int pageNum, GfxState *state, XRef * xref)
|
||||
<< "\" data-page-no=\"" << pageNum
|
||||
<< "\" data-page-url=\"";
|
||||
|
||||
outputAttribute(f_pages.fs, cur_page_filename);
|
||||
writeAttribute(f_pages.fs, cur_page_filename);
|
||||
f_pages.fs << "\">";
|
||||
}
|
||||
|
||||
@ -555,7 +555,7 @@ void HTMLRenderer::embed_file(ostream & out, const string & path, const string &
|
||||
else
|
||||
{
|
||||
out << entry.prefix_external;
|
||||
outputAttribute(out, fn);
|
||||
writeAttribute(out, fn);
|
||||
out << entry.suffix_external << endl;
|
||||
|
||||
if(copy)
|
||||
|
@ -195,7 +195,7 @@ void HTMLRenderer::processLink(AnnotLink * al)
|
||||
if(!dest_str.empty())
|
||||
{
|
||||
(*f_curpage) << "<a class=\"" << CSS::LINK_CN << "\" href=\"";
|
||||
outputAttribute((*f_curpage), dest_str);
|
||||
writeAttribute((*f_curpage), dest_str);
|
||||
(*f_curpage) << "\"";
|
||||
|
||||
if(!dest_detail_str.empty())
|
||||
|
@ -37,7 +37,7 @@ void HTMLRenderer::process_outline_items(GooList * items)
|
||||
|
||||
// we don't care dest is empty or not.
|
||||
f_outline.fs << "<li>" << "<a class=\"" << CSS::LINK_CN << "\" href=\"";
|
||||
outputAttribute(f_outline.fs, dest);
|
||||
writeAttribute(f_outline.fs, dest);
|
||||
f_outline.fs << "\"";
|
||||
|
||||
if(!detail.empty())
|
||||
@ -45,7 +45,7 @@ void HTMLRenderer::process_outline_items(GooList * items)
|
||||
|
||||
f_outline.fs << ">";
|
||||
|
||||
outputUnicodes(f_outline.fs, item->getTitle(), item->getTitleLength());
|
||||
writeUnicodes(f_outline.fs, item->getTitle(), item->getTitleLength());
|
||||
|
||||
f_outline.fs << "</a>";
|
||||
|
||||
|
@ -179,7 +179,7 @@ void HTMLTextLine::dump_text(ostream & out)
|
||||
if(abs(target - space_off) <= param.h_eps)
|
||||
{
|
||||
Unicode u = ' ';
|
||||
outputUnicodes(out, &u, 1);
|
||||
writeUnicodes(out, &u, 1);
|
||||
actual_offset = space_off;
|
||||
done = true;
|
||||
}
|
||||
@ -213,7 +213,7 @@ void HTMLTextLine::dump_text(ostream & out)
|
||||
size_t next_text_idx = text_idx2;
|
||||
if((cur_offset_iter != offsets.end()) && (cur_offset_iter->start_idx) < next_text_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;
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
@ -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";
|
||||
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;
|
||||
if(!dont_escape)
|
||||
@ -123,13 +123,13 @@ void outputURL(ostream & out, const string & s)
|
||||
else
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -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)
|
||||
{
|
||||
|
@ -18,23 +18,23 @@ namespace pdf2htmlEX {
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
//void outputURL(std::ostream & out, const std::string & s);
|
||||
//void writeURL(std::ostream & out, const std::string & s);
|
||||
|
||||
/*
|
||||
* JSON escaping
|
||||
*/
|
||||
void outputJSON(std::ostream & out, const std::string & s);
|
||||
void writeJSON(std::ostream & out, const std::string & s);
|
||||
|
||||
/*
|
||||
* HTML tag attribute escaping
|
||||
*/
|
||||
void outputAttribute(std::ostream & out, const std::string & s);
|
||||
void writeAttribute(std::ostream & out, const std::string & s);
|
||||
|
||||
} // namespace pdf2htmlEX
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user