AcePerl

 view release on metacpan or  search on metacpan

acelib/helpsubs.c  view on Meta::CPAN

    {
      printf ("Warning : <B> tag not closed by </B> !!\n") ;
    }
  
  node->left = leftnode ;
  node->right = 0 ;

  *resultnode = node ;

  return TRUE ;
} /* parseBold */
/************************************************************/

static BOOL parseStrong (char **cp, HtmlNode **resultnode, STORE_HANDLE handle)
{
  HtmlNode *node, *leftnode ;

  *cp += 8 ;			/* skip <STRONG> */

  skipSpaces (cp) ;

  node = makeNode (HTML_STRONG_STYLE, handle) ;

  if (!(parseSection (cp, &leftnode, handle)))
    {
      printf ("Warning : strong text not valid !!\n") ;
    }

  skipSpaces (cp) ;

  if (strncasecmp (*cp, "</STRONG>", 9) == 0)
    {
      *cp += 9 ;
    }
  else
    {
      printf ("Warning : <STRONG> tag not closed by </STRONG> !!\n") ;
    }
  
  node->left = leftnode ;
  node->right = 0 ;

  *resultnode = node ;

  return TRUE ;
} /* parseStrong */
/************************************************************/

static BOOL parseItalic (char **cp, HtmlNode **resultnode, STORE_HANDLE handle)
{
  HtmlNode *node, *leftnode ;

  *cp += 3 ;			/* skip <I> */

  skipSpaces (cp) ;

  node = makeNode (HTML_ITALIC_STYLE, handle) ;

  if (!(parseSection (cp, &leftnode, handle)))
    {
      printf ("Warning : bold text not valid !!\n") ;
    }

  skipSpaces (cp) ;

  if (strncasecmp (*cp, "</I>", 3) == 0)
    {
      *cp += 4 ;
    }
  else
    {
      printf ("Warning : <I> tag not closed by </I> !!\n") ;
    }
  
  node->left = leftnode ;
  node->right = 0 ;

  *resultnode = node ;

  return TRUE ;
} /* parseItalic */
/************************************************************/

static BOOL parseText (char **cp, HtmlNode **resultnode, STORE_HANDLE handle)
{
  HtmlNode *node ;
  int len ;
  char *start ;

  start = *cp ;

  while (**cp)
    {
      /* read until beginning of new TAG */
      if (strncasecmp (*cp, "<", 1) == 0)
	break ;
      ++(*cp) ;
    }
  
  if (*cp == start)
    {
      /* an unknown tag had been reached, the text read until that
	 will be of length zero, because parseSection() couldn't
	 recognise it, and passed the text here, where it reads
	 until it finds a '<', which it'll find imediately,
	 so the length will be zero */

      while (**cp)
	{
	  /* read until beginning of new TAG */
	  if (strncasecmp (*cp, ">", 1) == 0)
	    break ;
	  ++(*cp) ;
	}
      ++(*cp) ;
      
      node = makeNode (HTML_UNKNOWN, handle) ;

      /* copy unknown tag into node->text */
      len = (*cp-start) ;
      node->text = (char*)halloc ((len+1) * sizeof(char), handle);



( run in 1.700 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )