rmultimarkdown 4.5.2.2 → 4.5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 01eacdd7bad00819a2a4d15a640a771475a33678
4
+ data.tar.gz: 84872c1f1f7979477f09f825d4cc8489c0054014
5
+ SHA512:
6
+ metadata.gz: 2e28e39be1746d5c7bf6b097786ea9a177f507d1b54ed0f77a4b386e349ffcfb8f34ed3759d7f015764587b409e4be05309e57b71ba76cfb677aeff859c5b447
7
+ data.tar.gz: 66c339a9513da6db084ceb048929a43f3324ce2bdc70ee1589ebc65fff1a6708e0fbc5e3aeb8add45311f1dbbda70eeb20caf2f6dbf3233798ce1e51c98761d1
@@ -584,7 +584,7 @@ void print_html_node(GString *out, node *n, scratch_pad *scratch) {
584
584
  lev = note_number_for_label(n->link_data->label, scratch);
585
585
  if (lev != 0) {
586
586
  #ifdef DEBUG_ON
587
- fprintf(stderr, "matching cite found\n");
587
+ fprintf(stderr, "matching cite found - %d\n",lev);
588
588
  #endif
589
589
  if (scratch->extensions & EXT_RANDOM_FOOT) {
590
590
  srand(scratch->random_seed_base + lev);
@@ -820,17 +820,21 @@ void print_html_node(GString *out, node *n, scratch_pad *scratch) {
820
820
  void print_html_endnotes(GString *out, scratch_pad *scratch) {
821
821
  int counter = 0;
822
822
  int random;
823
-
824
- scratch->used_notes = reverse_list(scratch->used_notes);
823
+ node *reversed = copy_node_tree(scratch->used_notes);
824
+
825
+ reversed = reverse_list(reversed);
826
+
825
827
  scratch->printing_notes = 1;
826
828
 
827
- node *note = scratch->used_notes;
829
+ node *note = reversed;
828
830
  #ifdef DEBUG_ON
829
831
  fprintf(stderr, "start endnotes\n");
830
832
  #endif
831
833
 
832
- if ((note == NULL) || ((note->key == KEY_COUNTER) && (note->next == NULL)))
834
+ if ((note == NULL) || ((note->key == KEY_COUNTER) && (note->next == NULL))) {
835
+ free_node_tree(reversed);
833
836
  return;
837
+ }
834
838
 
835
839
  #ifdef DEBUG_ON
836
840
  fprintf(stderr, "there are endnotes to print\n");
@@ -875,6 +879,8 @@ void print_html_endnotes(GString *out, scratch_pad *scratch) {
875
879
  pad(out,1, scratch);
876
880
  g_string_append_printf(out, "</ol>\n</div>\n");
877
881
  scratch->padded = 0;
882
+
883
+ free_node_tree(reversed);
878
884
  #ifdef DEBUG_ON
879
885
  fprintf(stderr, "finish endnotes\n");
880
886
  #endif
@@ -202,10 +202,14 @@ void print_latex_node(GString *out, node *n, scratch_pad *scratch) {
202
202
  g_string_append_printf(out, "\\def\\mytitle{");
203
203
  print_latex_node(out, n->children, scratch);
204
204
  g_string_append_printf(out, "}\n");
205
+ } else if (strcmp(n->str, "latextitle") == 0) {
206
+ g_string_append_printf(out, "\\def\\mytitle{%s}\n",n->children->str);
205
207
  } else if (strcmp(n->str, "author") == 0) {
206
208
  g_string_append_printf(out, "\\def\\myauthor{");
207
209
  print_latex_node(out, n->children, scratch);
208
210
  g_string_append_printf(out, "}\n");
211
+ } else if (strcmp(n->str, "latexauthor") == 0) {
212
+ g_string_append_printf(out, "\\def\\myauthor{%s}\n",n->children->str);
209
213
  } else if (strcmp(n->str, "date") == 0) {
210
214
  g_string_append_printf(out, "\\def\\mydate{");
211
215
  print_latex_node(out, n->children, scratch);
@@ -1043,8 +1047,10 @@ void print_latex_localized_typography(GString *out, int character, scratch_pad *
1043
1047
  /* print_latex_string - print string, escaping for LaTeX */
1044
1048
  void print_latex_string(GString *out, char *str, scratch_pad *scratch) {
1045
1049
  char *tmp;
1050
+ char *start;
1046
1051
  if (str == NULL)
1047
1052
  return;
1053
+ start = str; /* Store start of string */
1048
1054
  while (*str != '\0') {
1049
1055
  switch (*str) {
1050
1056
  case '{': case '}': case '$': case '%':
@@ -1081,7 +1087,7 @@ void print_latex_string(GString *out, char *str, scratch_pad *scratch) {
1081
1087
  case '\n':
1082
1088
  tmp = str;
1083
1089
  tmp--;
1084
- if (*tmp == ' ') {
1090
+ if ((tmp > start) && (*tmp == ' ')) {
1085
1091
  tmp--;
1086
1092
  if (*tmp == ' ') {
1087
1093
  g_string_append_printf(out, "\\\\\n");
@@ -1092,6 +1098,9 @@ void print_latex_string(GString *out, char *str, scratch_pad *scratch) {
1092
1098
  g_string_append_printf(out, "\n");
1093
1099
  }
1094
1100
  break;
1101
+ case '-':
1102
+ g_string_append_printf(out, "-{}");
1103
+ break;
1095
1104
  default:
1096
1105
  g_string_append_c(out, *str);
1097
1106
  }
@@ -142,6 +142,7 @@ void free_node(node *n) {
142
142
  free_node_tree(n->children);
143
143
  n->children = NULL;
144
144
  }
145
+ n->next = NULL;
145
146
  free(n);
146
147
  }
147
148
 
@@ -183,9 +184,14 @@ node * cons(node *new, node *list) {
183
184
  node * reverse_list(node *list) {
184
185
  node *new = NULL;
185
186
  node *next = NULL;
187
+ #ifdef DEBUG_ON
188
+ if ((list != NULL) && (list->str != NULL))
189
+ fprintf(stderr, "reverse_list: '%s'\n",list->str);
190
+ #endif
186
191
 
187
192
  while (list != NULL) {
188
193
  next = list->next;
194
+ list->next = NULL;
189
195
  new = cons(list, new);
190
196
  list = next;
191
197
  }