]> granicus.if.org Git - multimarkdown/commitdiff
ADDED: Add function to extract transclusion manifest
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Fri, 18 Aug 2017 21:56:25 +0000 (17:56 -0400)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Fri, 18 Aug 2017 21:56:25 +0000 (17:56 -0400)
Sources/libMultiMarkdown/include/libMultiMarkdown.h
Sources/libMultiMarkdown/mmd.c

index 6ee276b1e9ef5bb95690112e2785ef970832bedd..7763f27f5c15c8dbf47cd735dc24934a4dd824b8 100644 (file)
@@ -123,6 +123,12 @@ char * mmd_string_metavalue_for_key(char * source, const char * key);
 char * mmd_string_update_metavalue_for_key(const char * source, const char * key, const char * value);
 
 
+/// Grab list of all transcluded files, but we need to know directory to search,
+/// as well as the path to the file
+/// Returned stack needs to be freed
+struct stack * mmd_string_transclusion_manifest(const char * source, const char * search_path, const char * source_path);
+
+
 
 
 /*
@@ -163,6 +169,12 @@ char * mmd_d_string_metavalue_for_key(DString * source, const char * key);
 void mmd_d_string_update_metavalue_for_key(DString * source, const char * key, const char * value);
 
 
+/// Grab list of all transcluded files, but we need to know directory to search,
+/// as well as the path to the file
+/// Returned stack needs to be freed
+struct stack * mmd_d_string_transclusion_manifest(DString * source, const char * search_path, const char * source_path);
+
+
 
 
 /*
@@ -248,6 +260,12 @@ char * mmd_engine_metavalue_for_key(mmd_engine * e, const char * key);
 void mmd_engine_update_metavalue_for_key(mmd_engine * e, const char * key, const char * value);
 
 
+/// Grab list of all transcluded files, but we need to know directory to search,
+/// as well as the path to the file
+/// Returned stack needs to be freed
+struct stack * mmd_engine_transclusion_manifest(mmd_engine * e, const char * search_path, const char * source_path);
+
+
 
 
 /*
index e0e3ee15db1804cdcda3e69c682d9d1e5dcc04d2..bc0c0cd40b860f282cdf9e1859f4e560e4b76249 100644 (file)
@@ -2402,6 +2402,56 @@ char * mmd_engine_metavalue_for_key(mmd_engine * e, const char * key) {
 }
 
 
+/// Grab list of all transcluded files, but we need to know directory to search,
+/// as well as the path to the file
+/// Returned stack needs to be freed
+stack * mmd_string_transclusion_manifest(const char * source, const char * search_path, const char * source_path) {
+       stack * result;
+
+       mmd_engine * e = mmd_engine_create_with_string(source, 0);
+       
+       result = mmd_engine_transclusion_manifest(e, search_path, source_path);
+
+       mmd_engine_free(e, true);
+
+       return result;
+}
+
+
+/// Grab list of all transcluded files, but we need to know directory to search,
+/// as well as the path to the file
+/// Returned stack needs to be freed
+stack * mmd_d_string_transclusion_manifest(DString * source, const char * search_path, const char * source_path) {
+       stack * result;
+
+       mmd_engine * e = mmd_engine_create_with_dstring(source, 0);
+       
+       result = mmd_engine_transclusion_manifest(e, search_path, source_path);
+
+       mmd_engine_free(e, false);
+
+       return result;
+}
+
+
+/// Grab list of all transcluded files, but we need to know directory to search,
+/// as well as the path to the file
+/// Returned stack needs to be freed
+stack * mmd_engine_transclusion_manifest(mmd_engine * e, const char * search_path, const char * source_path) {
+       // Create empty manifest stack
+       stack * manifest = stack_new(0);
+
+       // Copy source text for temporary buffer
+       DString * buffer = d_string_new(e->dstr->str);
+
+       mmd_transclude_source(buffer, search_path, source_path, FORMAT_HTML, NULL, manifest);
+
+       d_string_free(buffer, true);
+
+       return manifest;
+}
+
+
 /// Insert/replace metadata in string, returning new string
 char * mmd_string_update_metavalue_for_key(const char * source, const char * key, const char * value) {
        mmd_engine * e = mmd_engine_create_with_string(source, 0);