mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 13:00:08 +00:00
clear map file on error; trim spaces in manifest
This commit is contained in:
parent
ff36ae6942
commit
c1104cb00f
@ -346,12 +346,13 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
|
||||
|
||||
|
||||
{
|
||||
string map_filename;
|
||||
ofstream map_outf;
|
||||
if(param.debug)
|
||||
{
|
||||
string fn = (char*)str_fmt("%s/f%llx.map", param.tmp_dir.c_str(), info.id);
|
||||
tmp_files.add(fn);
|
||||
map_outf.open(fn);
|
||||
map_filename = (char*)str_fmt("%s/f%llx.map", param.tmp_dir.c_str(), info.id);
|
||||
tmp_files.add(map_filename);
|
||||
map_outf.open(map_filename);
|
||||
}
|
||||
|
||||
unordered_set<int> codeset;
|
||||
@ -427,7 +428,8 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
|
||||
cur_code = -1;
|
||||
if(param.debug)
|
||||
{
|
||||
map_outf.seekp(0);
|
||||
map_outf.close();
|
||||
map_outf.open(map_filename);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -396,9 +396,23 @@ void HTMLRenderer::post_process(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
if(line.empty()
|
||||
|| (line.find_first_not_of(' ') == string::npos)
|
||||
|| line[0] == '#')
|
||||
// trim space at both sides
|
||||
{
|
||||
static const char * whitespaces = " \t\n\v\f\r";
|
||||
auto idx1 = line.find_first_not_of(whitespaces);
|
||||
if(idx1 == string::npos)
|
||||
{
|
||||
line.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto idx2 = line.find_last_not_of(whitespaces);
|
||||
assert(idx2 >= idx1);
|
||||
line = line.substr(idx1, idx2 - idx1 + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if(line.empty() || line[0] == '#')
|
||||
continue;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user