nodes(collection->list, collection->list+collection->length);
497 | sort(nodes.begin(), nodes.end(), node_sort);
498 | try{
499 | for(myhtml_tree_node_t* node : nodes){
500 | mode_handlers[state["mode"]](node);
501 | }
502 | }catch(bad_function_call&){
503 | cerr << "invalid mode '" << state["mode"] << "'" << endl;
504 | exit(EXIT_FAILURE);
505 | }
506 | }
507 |
508 | // destroy modest datastructures
509 | myhtml_collection_destroy(collection);
510 | mycss_selectors_list_destroy(mycss_entry_selectors(css_entry), selectors_list, true);
511 | modest_finder_destroy(finder, true);
512 | mycss_destroy(css_entry->mycss, true);
513 | mycss_entry_destroy(css_entry, true);
514 | myhtml_destroy(html_tree->myhtml);
515 | myhtml_tree_destroy(html_tree);
516 | }
517 |
--------------------------------------------------------------------------------
/meson.build:
--------------------------------------------------------------------------------
1 | project('hq', 'cpp', default_options: ['cpp_std=c++17'])
2 | modest = dependency('modest')
3 | fmt = dependency('fmt')
4 | executable('hq', 'main.cpp',
5 | dependencies: [modest, fmt]
6 | )
7 |
--------------------------------------------------------------------------------
/test.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | This paragraph
7 | contains a lot of lines
8 | in the source code,
9 | but the browser
10 | ignores it.
11 |
12 |
13 |
14 | This paragraph
15 | contains a lot of spaces
16 | in the source code,
17 | but the browser
18 | ignores it.
19 |
20 |
21 |
22 | This paragraph is all in one line and should be rendered the same as the others.
23 |
24 |
25 |
26 | This paragraph contains phrasing content, which is used to mark up text at the intra-paragraph level.
27 |
28 |
29 |
30 | This paragraph contains a line break,
which should split this text into two lines and collapse the leading space of the second line.
31 |
32 |
33 |
34 | This is a link to example.com
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------