Skip to content

Commit b6bbb60

Browse files
authored
impl(docfx): generate files for TOC and pages (#10974)
1 parent f1b0075 commit b6bbb60

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docfx/doxygen2docfx.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,26 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#include "docfx/doxygen2toc.h"
16+
#include "docfx/doxygen_pages.h"
1517
#include "docfx/parse_arguments.h"
18+
#include <fstream>
1619
#include <iostream>
1720
#include <stdexcept>
1821

1922
int main(int argc, char* argv[]) try {
2023
auto config = docfx::ParseArguments({argv, argv + argc});
24+
pugi::xml_document doc;
25+
auto load = doc.load_file(config.input_filename.c_str());
26+
if (!load) throw std::runtime_error("Error loading XML input file");
27+
28+
std::ofstream("toc.yml") << docfx::Doxygen2Toc(config, doc);
29+
for (auto const& i : doc.select_nodes("//*[@kind='page']")) {
30+
auto const& page = i.node();
31+
auto const filename = std::string{page.attribute("id").as_string()} + ".md";
32+
std::ofstream(filename) << docfx::Page2Markdown(page);
33+
}
34+
2135
return 0;
2236
} catch (std::exception const& ex) {
2337
std::cerr << "Standard exception thrown: " << ex.what() << "\n";

0 commit comments

Comments
 (0)