From df133721e178440d9cdf87c942a216a1c2cedba0 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 23 Apr 2013 11:01:18 -0600 Subject: kconfig2html: Improve expand/collapse TOC + misc bug-fixes --- nuttx/tools/kconfig2html.c | 92 +++++++++++++++++++++++++++++++++++---------- nuttx/tools/mkconfigvars.sh | 3 +- 2 files changed, 75 insertions(+), 20 deletions(-) (limited to 'nuttx/tools') diff --git a/nuttx/tools/kconfig2html.c b/nuttx/tools/kconfig2html.c index de749cb7d..e29fd4788 100644 --- a/nuttx/tools/kconfig2html.c +++ b/nuttx/tools/kconfig2html.c @@ -52,6 +52,8 @@ * Pre-processor Definitions ****************************************************************************/ +#undef USE_JQUERY + #define LINE_SIZE 1024 #define SCRATCH_SIZE 2048 #define MAX_DEPENDENCIES 100 @@ -902,6 +904,15 @@ static char *get_token(void) /* Search for the trailing quotation mark */ pend = findchar(pbegin + 1, '"'); + + /* Did we find the trailing quotation mark */ + + if (pend) + { + /* Yes.. skip over it */ + + pend++; + } } else { @@ -950,22 +961,43 @@ static char *get_html_string(void) pbegin = strchr(g_lnptr, '"'); if (pbegin) { - /* Skip over the quote */ + /* We found the leading quote. Skip over the leading quote */ pbegin++; + } + else + { + /* The string is unquoted. The beginning of the string is here, + * skipping over any leading whitespace. + */ - /* Search for the trailing quotation mark */ + pbegin = skip_space(g_lnptr); + } - pend = findchar(pbegin, '"'); - if (pend) - { - /* Replace the final quote with a NUL */ + /* Search for the trailing quotation mark. If there is none, then + * the string goes to the end of the line. + */ - *pend = '\0'; - } + pend = findchar(pbegin, '"'); + if (pend) + { + /* Replace the final quote with a NUL. g_lnptr is set to to + * the next valid character after the terminating quote. + */ + + *pend = '\0'; + g_lnptr = pend + 1; + } + else + { + /* Use the rest of the line. g_lnptr is set to point at the + * terminating NUL. + */ + + pend = pbegin + strlen(pbegin); + g_lnptr = pend; } - g_lnptr = pend + 1; return htmlize_text(pbegin); } @@ -1561,6 +1593,7 @@ static inline char *process_config(FILE *stream, const char *configname, /* Process each line in the configuration */ help = false; + token = NULL; while ((ptr = kconfig_line(stream)) != NULL) { @@ -1734,7 +1767,7 @@ static inline char *process_config(FILE *stream, const char *configname, } } - /* Is this an internal configuration varaible with no description? + /* Is this an internal configuration varaible with no description? * If so, send the output to the appendix file. */ @@ -2108,30 +2141,34 @@ static inline char *process_menu(FILE *stream, const char *kconfigdir) paranum = get_paranum(); if (menu.m_name) { - output("
  • %s Menu: %s
  • \n", - g_menu_number, paranum, menu.m_name); + output("
  • %s Menu: %s
  • \n", + g_menu_number, g_menu_number, paranum, menu.m_name); body("\n

    %s Menu: %s

    \n", g_menu_number, paranum, menu.m_name); } else { - output("
  • %s Menu
  • \n", - g_menu_number, paranum); + output("
  • %s Menu
  • \n", + g_menu_number, g_menu_number, paranum); body("\n

    %s Menu

    \n", g_menu_number, paranum); } - g_menu_number++; - /* Output logic to toggle the contents below the menu in the table of * contents. */ - output("Expand\n", - g_toggle_number); +#ifdef USE_JQUERY + output("Expand\n", + g_menu_number, g_toggle_number, g_toggle_number); +#else + output("Expand\n", + g_menu_number, g_toggle_number); +#endif output("