src/chxj_chtml10.c
/**
 * It is a handler who processes the IMG tag.
 *
 * @param pdoc  [i/o] The pointer to the CHTML structure at the output
 *                     destination is specified.
 * @param node   [i]   The IMG tag node is specified.
 * @return The conversion result is returned.
 */
It is a handler who processes the IMG tag.
@param pdoc  [i/o] The pointer to the CHTML structure at the output
destination is specified.
@param node   [i]   The IMG tag node is specified.
@return The conversion result is returned.
It is a handler who processes the IMG tag . @param pdoc [ i / o ] The pointer to the CHTML structure at the output destination is specified . @param node [ i ] The IMG tag node is specified . @return The conversion result is returned .
static char *
s_chtml10_start_img_tag(void *pdoc, Node *node) 
{
  chtml10_t    *chtml10;
  Doc          *doc;
  request_rec  *r;
  Attr         *attr;
#ifndef IMG_NOT_CONVERT_FILENAME
  device_table *spec;
#endif
  chtml10 = GET_CHTML10(pdoc);
#ifndef IMG_NOT_CONVERT_FILENAME
  spec    = chtml10->spec;
#endif
  doc     = chtml10->doc;
  r       = doc->r;
  W_L("<img");
  for (attr = qs_get_attr(doc,node);
       attr;
       attr = qs_get_next_attr(doc,attr)) {
    char *name  = qs_get_attr_name (doc,attr);
    char *value = qs_get_attr_value(doc,attr);
    switch(*name) {
    case 's':
    case 'S':
      if (strcasecmp(name, "src") == 0) {
#ifdef IMG_NOT_CONVERT_FILENAME
        value = chxj_encoding_parameter(r, value);
        value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
        if (value) {
          value = apr_psprintf(doc->buf.pool, 
                               "%s%c%s=true", 
                               value, 
                               (strchr(value, '?')) ? '&' : '?',
                               CHXJ_COOKIE_NOUPDATE_PARAM);
        }
        W_L(" src=\"");
        W_V(value);
        W_L("\"");
#else
        value = chxj_img_conv(r, spec, value);
        value = chxj_encoding_parameter(r, value);
        value = chxj_add_cookie_parameter(r, value, chtml10->cookie);
        if (value) {
          value = apr_psprintf(doc->buf.pool,
                               "%s%c%s=true",
                               value,
                               (strchr(value, '?')) ? '&' : '?',
                               CHXJ_COOKIE_NOUPDATE_PARAM);
        }
        W_L(" src=\"");
        W_V(value);
        W_L("\"");
#endif
      }
      break;
    case 'a':
    case 'A':
      if (strcasecmp(name, "align" ) == 0) {
        if (value) {
          if (STRCASEEQ('t','T',"top",   value) ||
              STRCASEEQ('m','M',"middle",value) ||
              STRCASEEQ('b','B',"bottom",value) ||
              STRCASEEQ('l','L',"left",  value) ||
              STRCASEEQ('r','R',"right", value)) {
            W_L(" align=\"");
            W_V(value);
            W_L("\"");
          }
          else if (STRCASEEQ('c','C',"center",  value)) {
            W_L(" align=\"");
            W_L("middle");
            W_L("\"");
          }
        }
      }
      else if (strcasecmp(name, "alt"   ) == 0) {
        if (value && value[0] != '\0') {
          W_L(" alt=\"");
          W_V(value);
          W_L("\"");
        }
      }
      break;
    case 'w':
    case 'W':
      if (strcasecmp(name, "width" ) == 0) {
        if (value && value[0] != '\0') {
          W_L(" width=\"");
          W_V(value);
          W_L("\"");
        }
      }
      break;
    case 'h':
    case 'H':
      if (strcasecmp(name, "height") == 0) {
        if (value && value[0] != '\0') {
          W_L(" height=\"");
          W_V(value);
          W_L("\"");
        }
      }
      else
      if (strcasecmp(name, "hspace") == 0) {
        if (value && value[0] != '\0') {
          W_L(" hspace=\"");
          W_V(value);
          W_L("\"");
        }
      }
      break;
    case 'v':
    case 'V':
      if (strcasecmp(name, "vspace") == 0) {
        if (value && value[0] != '\0') {
          W_L(" vspace=\"");
          W_V(value);
          W_L("\"");
        }
      }
      break;
    default:
      break;
    }
  }
  W_L(">");
  return chtml10->out;
}
static char * s_chtml10_start_img_tag ( void * pdoc , Node * node ) { chtml10_t * chtml10 ; Doc * doc ; request_rec * r ; Attr * attr ; #ifndef IMG_NOT_CONVERT_FILENAME device_table * spec ; #endif chtml10 = GET_CHTML10 ( pdoc ) ; #ifndef IMG_NOT_CONVERT_FILENAME spec = chtml10 -> spec ; #endif doc = chtml10 -> doc ; r = doc -> r ; W_L ( " " ) ; for ( attr = qs_get_attr ( doc , node ) ; attr ; attr = qs_get_next_attr ( doc , attr ) ) { char * name = qs_get_attr_name ( doc , attr ) ; char * value = qs_get_attr_value ( doc , attr ) ; switch ( * name ) { case ' ' : case ' ' : if ( strcasecmp ( name , " " ) == 0 ) { #ifdef IMG_NOT_CONVERT_FILENAME value = chxj_encoding_parameter ( r , value ) ; value = chxj_add_cookie_parameter ( r , value , chtml10 -> cookie ) ; if ( value ) { value = apr_psprintf ( doc -> buf . pool , " " , value , ( strchr ( value , ' ' ) ) ? ' ' : ' ' , CHXJ_COOKIE_NOUPDATE_PARAM ) ; } W_L ( " \" " ) ; W_V ( value ) ; W_L ( " \" " ) ; #else value = chxj_img_conv ( r , spec , value ) ; value = chxj_encoding_parameter ( r , value ) ; value = chxj_add_cookie_parameter ( r , value , chtml10 -> cookie ) ; if ( value ) { value = apr_psprintf ( doc -> buf . pool , " " , value , ( strchr ( value , ' ' ) ) ? ' ' : ' ' , CHXJ_COOKIE_NOUPDATE_PARAM ) ; } W_L ( " \" " ) ; W_V ( value ) ; W_L ( " \" " ) ; #endif } break ; case ' ' : case ' ' : if ( strcasecmp ( name , " " ) == 0 ) { if ( value ) { if ( STRCASEEQ ( ' ' , ' ' , " " , value ) || STRCASEEQ ( ' ' , ' ' , " " , value ) || STRCASEEQ ( ' ' , ' ' , " " , value ) || STRCASEEQ ( ' ' , ' ' , " " , value ) || STRCASEEQ ( ' ' , ' ' , " " , value ) ) { W_L ( " \" " ) ; W_V ( value ) ; W_L ( " \" " ) ; } else if ( STRCASEEQ ( ' ' , ' ' , " " , value ) ) { W_L ( " \" " ) ; W_L ( " " ) ; W_L ( " \" " ) ; } } } else if ( strcasecmp ( name , " " ) == 0 ) { if ( value && value [ 0 ] != ' \0 ' ) { W_L ( " \" " ) ; W_V ( value ) ; W_L ( " \" " ) ; } } break ; case ' ' : case ' ' : if ( strcasecmp ( name , " " ) == 0 ) { if ( value && value [ 0 ] != ' \0 ' ) { W_L ( " \" " ) ; W_V ( value ) ; W_L ( " \" " ) ; } } break ; case ' ' : case ' ' : if ( strcasecmp ( name , " " ) == 0 ) { if ( value && value [ 0 ] != ' \0 ' ) { W_L ( " \" " ) ; W_V ( value ) ; W_L ( " \" " ) ; } } else if ( strcasecmp ( name , " " ) == 0 ) { if ( value && value [ 0 ] != ' \0 ' ) { W_L ( " \" " ) ; W_V ( value ) ; W_L ( " \" " ) ; } } break ; case ' ' : case ' ' : if ( strcasecmp ( name , " " ) == 0 ) { if ( value && value [ 0 ] != ' \0 ' ) { W_L ( " \" " ) ; W_V ( value ) ; W_L ( " \" " ) ; } } break ; default : break ; } } W_L ( " " ) ; return chtml10 -> out ; }
It is a handler who processes the IMG tag.
It is a handler who processes the IMG tag .
/*--------------------------------------------------------------------------*/ /* Get Attributes                                                           */ /*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/ /* CHTML 1.0                                                          */ /*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/ /* CHTML 1.0                                                          */ /*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/ /* CHTML 4.0                                                          */ /*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/ /* CHTML 1.0                                                          */ /*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/ /* CHTML 1.0                                                          */ /*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/ /* CHTML 1.0                                                          */ /*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/ /* CHTML 1.0                                                          */ /*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/ /* CHTML 1.0                                                          */ /*--------------------------------------------------------------------*/