-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTMLize.cpp
More file actions
47 lines (37 loc) · 1023 Bytes
/
HTMLize.cpp
File metadata and controls
47 lines (37 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "Print.h"
#include <stdlib.h>
#include <iostream>
using std::cerr;
using std::ifstream;
using std::ofstream;
using std::set;
const int MAX = 256;
set<string> readKeys(const char* file);
// Convert a "source" file into an HTML page with syntax highlighting
int main(int argc, const char** argv){
Configuration configure;
string configpath = getenv("HOME");
configpath += "/.bedit";
configure.load(configpath.c_str());
set<string> keywords = readKeys(configure.keywordFile().c_str());
set<string> localKeywords = readKeys(configure.localKeywordFile().c_str());
for(int i = 1; i < argc; i++){
string out = argv[i];
out += ".html";
TextModel in(argv[i]);
htmlModel(in, out.c_str(), keywords, localKeywords);
cerr << argv[i] << " --> " << out << "\n";
}
return 0;
}
set<string> readKeys(const char* file){
set<string> keywords;
ifstream in(file);
if(in){
string w;
while(in >> w)
keywords.insert(w);
}
in.close();
return keywords;
}