Преглед на файлове

make table more readable by shrinking some columns horizontally

Sean Barrett преди 10 години
родител
ревизия
c1ad6b09de
променени са 3 файла, в които са добавени 16 реда и са изтрити 6 реда
  1. 2 2
      README.md
  2. 2 2
      tools/README.list
  3. 12 2
      tools/make_readme.c

+ 2 - 2
README.md

@@ -17,8 +17,8 @@ library    | lastest version | category | Lines Of Code | description
 **stb_dxt.h** | 1.04 | 3D graphics | 624 | Fabian "ryg" Giesen's real-time DXT compressor
 **stb_perlin.h** | 0.2 | 3D graphics | 175 | revised Perlin noise (3D input, 1D output)
 **stb_easy_font.h** | 0.5 | 3D graphics | 220 | quick-and-dirty easy-to-deploy bitmap font for printing frame rate, etc
-**stb_tilemap_editor.h** | 0.30 | game development | 4097 | embeddable tilemap editor
-**stb_herringbone_wang_tile.h** | 0.6 | game development | 1217 | herringbone Wang tile map generator
+**stb_tilemap_editor.h** | 0.30 | game dev | 4097 | embeddable tilemap editor
+**stb_herringbone_wa...** | 0.6 | game dev | 1217 | herringbone Wang tile map generator
 **stb_c_lexer.h** | 0.06 | parsing | 809 | simplify writing parsers for C-like languages
 **stb_divide.h** | 0.91 | math | 373 | more useful 32-bit modulus e.g. "euclidean divide"
 **stb.h** | 2.24 | misc | 14086 | helper functions for C, mostly redundant in C++; basically author's personal stuff

+ 2 - 2
tools/README.list

@@ -10,8 +10,8 @@ stb_voxel_render.h          | 3D graphics      | Minecraft-esque voxel rendering
 stb_dxt.h                   | 3D graphics      | Fabian "ryg" Giesen's real-time DXT compressor
 stb_perlin.h                | 3D graphics      | revised Perlin noise (3D input, 1D output)
 stb_easy_font.h             | 3D graphics      | quick-and-dirty easy-to-deploy bitmap font for printing frame rate, etc
-stb_tilemap_editor.h        | game development | embeddable tilemap editor
-stb_herringbone_wang_tile.h | game development | herringbone Wang tile map generator
+stb_tilemap_editor.h        | game dev         | embeddable tilemap editor
+stb_herringbone_wang_tile.h | game dev         | herringbone Wang tile map generator
 stb_c_lexer.h               | parsing          | simplify writing parsers for C-like languages
 stb_divide.h                | math             | more useful 32-bit modulus e.g. "euclidean divide"
 stb.h                       | misc             | helper functions for C, mostly redundant in C++; basically author's personal stuff

+ 12 - 2
tools/make_readme.c

@@ -17,7 +17,7 @@ int main(int argc, char  **argv)
       char **tokens = stb_tokens_stripwhite(list[i], "|", &num);  // stb_tokens -- tokenize string into malloced array of strings
       int num_lines;
       char **lines = stb_stringfile(stb_sprintf("../%s", tokens[0]), &num_lines);
-      char *s1, *s2;
+      char *s1, *s2,*s3;
       s1 = strchr(lines[0], '-');
       if (!s1) stb_fatal("Couldn't find '-' before version number in %s", tokens[0]); // stb_fatal -- print error message & exit
       s2 = strchr(s1+2, '-');
@@ -26,7 +26,17 @@ int main(int argc, char  **argv)
       s1 += 1;
       s1 = stb_trimwhite(s1);                  // stb_trimwhite -- advance pointer to after whitespace & delete trailing whitespace
       if (*s1 == 'v') ++s1;
-      fprintf(f, "**%s** | %s", tokens[0], s1);
+      s3 = tokens[0];
+      stb_trimwhite(s3);
+      if (strlen(s3) < 21) {
+         fprintf(f, "**%s** | %s", tokens[0], s1);
+      } else {
+         char buffer[256];
+         strncpy(buffer, s3, 18);
+         buffer[18] = 0;   
+         strcat(buffer, "...");
+         fprintf(f, "**%s** | %s", buffer, s1);
+      }
       s1 = stb_trimwhite(tokens[1]);           // stb_trimwhite -- advance pointer to after whitespace & delete trailing whitespace
       s2 = stb_dupreplace(s1, " ", "&nbsp;");  // stb_dupreplace -- search & replace string and malloc result
       fprintf(f, " | %s", s2);