Skip to content

Commit

Permalink
Update for latest changes in cmark-gfm. Version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
KristopherGBaker committed Jun 19, 2019
1 parent dee7891 commit 9106b01
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
26 changes: 24 additions & 2 deletions Sources/libcmark_gfm/include/cmark-gfm-core-extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ extern "C" {

#include "cmark-gfm-extension_api.h"
#include "cmark-gfm-extensions_export.h"
#include "config.h"
#include "config.h" // for bool
#include <stdint.h>

CMARK_GFM_EXTENSIONS_EXPORT
Expand All @@ -16,14 +16,36 @@ void cmark_gfm_core_extensions_ensure_registered(void);
CMARK_GFM_EXTENSIONS_EXPORT
uint16_t cmark_gfm_extensions_get_table_columns(cmark_node *node);

/** Sets the number of columns for the table, returning 1 on success and 0 on error.
*/
CMARK_GFM_EXTENSIONS_EXPORT
int cmark_gfm_extensions_set_table_columns(cmark_node *node, uint16_t n_columns);

CMARK_GFM_EXTENSIONS_EXPORT
uint8_t *cmark_gfm_extensions_get_table_alignments(cmark_node *node);

/** Sets the alignments for the table, returning 1 on success and 0 on error.
*/
CMARK_GFM_EXTENSIONS_EXPORT
int cmark_gfm_extensions_set_table_alignments(cmark_node *node, uint16_t ncols, uint8_t *alignments);

CMARK_GFM_EXTENSIONS_EXPORT
int cmark_gfm_extensions_get_table_row_is_header(cmark_node *node);

/** Sets whether the node is a table header row, returning 1 on success and 0 on error.
*/
CMARK_GFM_EXTENSIONS_EXPORT
int cmark_gfm_extensions_set_table_row_is_header(cmark_node *node, int is_header);

CMARK_GFM_EXTENSIONS_EXPORT
bool cmark_gfm_extensions_get_tasklist_item_checked(cmark_node *node);
/* For backwards compatibility */
#define cmark_gfm_extensions_tasklist_is_checked cmark_gfm_extensions_get_tasklist_item_checked

/** Sets whether a tasklist item is "checked" (completed), returning 1 on success and 0 on error.
*/
CMARK_GFM_EXTENSIONS_EXPORT
bool cmark_gfm_extensions_tasklist_state_is_checked(cmark_node *node);
int cmark_gfm_extensions_set_tasklist_item_checked(cmark_node *node, bool is_checked);

#ifdef __cplusplus
}
Expand Down
19 changes: 18 additions & 1 deletion Sources/libcmark_gfm/tasklist.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,24 @@ static const char *get_type_string(cmark_syntax_extension *extension, cmark_node
return TYPE_STRING;
}

bool cmark_gfm_extensions_tasklist_state_is_checked(cmark_node *node) {

// Return 1 if state was set, 0 otherwise
int cmark_gfm_extensions_set_tasklist_item_checked(cmark_node *node, bool is_checked) {
// The node has to exist, and be an extension, and actually be the right type in order to get the value.
if (!node || !node->extension || strcmp(cmark_node_get_type_string(node), TYPE_STRING))
return 0;

if (is_checked) {
node->as.opaque = (void *)CMARK_TASKLIST_CHECKED;
return 1;
}
else {
node->as.opaque = (void *)CMARK_TASKLIST_NOCHECKED;
return 1;
}
}

bool cmark_gfm_extensions_get_tasklist_item_checked(cmark_node *node) {
if (!node || !node->extension || strcmp(cmark_node_get_type_string(node), TYPE_STRING))
return false;

Expand Down
2 changes: 1 addition & 1 deletion libcmark_gfm.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "libcmark_gfm"
s.version = "0.29.2"
s.version = "0.29.3"
s.summary = "Swift compatible framework for cmark-gfm"

s.description = <<-DESC
Expand Down

0 comments on commit 9106b01

Please sign in to comment.