mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
66 lines
1.9 KiB
C++
66 lines
1.9 KiB
C++
#include "../gumbo-parser/src/gumbo.h"
|
|
#include "../katana-parser/src/katana.h"
|
|
|
|
#include "../../../../DesktopEditor/common/File.h"
|
|
|
|
#include "CGetData.h"
|
|
|
|
#include <fstream>
|
|
#include <iostream>
|
|
#include <stdlib.h>
|
|
#include <string>
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
// const char* filename = "C:/Users/kiril/Desktop/OnlyOffice/core/EpubFile/test/part1.xhtml";
|
|
|
|
// std::ifstream in(filename, std::ios::in | std::ios::binary);
|
|
// if (!in)
|
|
// {
|
|
// std::cout << "File " << filename << " not found!\n";
|
|
// exit(EXIT_FAILURE);
|
|
// }
|
|
|
|
// {
|
|
// std::string contents;
|
|
// in.seekg(0, std::ios::end);
|
|
// contents.resize(in.tellg());
|
|
// in.seekg(0, std::ios::beg);
|
|
// in.read(&contents[0], contents.size());
|
|
// in.close();
|
|
|
|
// GumboOptions options = kGumboDefaultOptions;
|
|
|
|
// GumboOutput* output = gumbo_parse_with_options(&options, contents.data(), contents.length());
|
|
// std::string indent_chars = " ";
|
|
// std::cout << prettyprint(output->document, 0, indent_chars) << std::endl;
|
|
// gumbo_destroy_output(&kGumboDefaultOptions, output);
|
|
// return 0;
|
|
// }
|
|
std::wstring sFilePath = NSFile::GetProcessDirectory() + L"../../../../cssFiles/demo-page.css";
|
|
|
|
CCssCalculator oCSS;
|
|
oCSS.AddStyles(sFilePath);
|
|
oCSS.AddStyle("h1 {color : red;}"
|
|
".Author{"
|
|
"color: green;"
|
|
"text-decoration: underline;"
|
|
"border-radius: 4.5px;}");
|
|
|
|
// oCSS.Print();
|
|
std::wcout << oCSS.GetEncoding() << std::endl;
|
|
|
|
std::vector<std::string> arSelectors;
|
|
arSelectors.push_back("#forkongithub");
|
|
|
|
std::map<std::wstring, std::wstring> mDecl;
|
|
|
|
mDecl = oCSS.GetCompiledStyleW(arSelectors, Cantimeter);
|
|
|
|
for (auto iter = mDecl.begin(); iter != mDecl.end(); iter++)
|
|
{
|
|
std::wcout << iter->first << " : " << iter->second << std::endl;
|
|
}
|
|
}
|