lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LYNX-DEV lynx patch


From: Helen
Subject: LYNX-DEV lynx patch
Date: Thu, 26 Feb 1998 13:29:03 +0200 (IST)

Hello lynxers,

here is my very own lynx2-7-2 patch ! It replaces the [LINK], [INLINE] and
[IMAGE] comments (for images without ALT) with filenames of these images.
I find it extremely useful, because now I can see immediately what images
are just decorations (button.gif, line.gif) and what images are important.
(of course, it is guessing, but usually it is very easy to guess).

It uses a variable (verbose_img) which is permanently set to 1,
but it should be easy to put it into configuration file and toggle between
old and new behaviour, if someone will want to implement this option as
the part of the future distribution. (I hope that it will be accepted !)

It must be applied in src directory, and changes the file HTML.c.

Helen


*** HTML.c      Wed Nov 26 04:29:36 1997
--- /cc/vis/helen/lynx2-7-2/src/HTML.c  Tue Feb 24 16:26:47 1998
***************
*** 88,93 ****
--- 88,95 ----
  PRIVATE void change_paragraph_style PARAMS((HTStructured * me,
                                            HTStyle * style));
  
+ PRIVATE char * MakeNewTitle(CONST char ** value);
+ 
  /*            Flattening the style structure
  **            ------------------------------
  **
***************
*** 465,470 ****
--- 467,474 ----
  {
      char *alt_string = NULL;
      char *id_string = NULL;
+     char *newtitle = NULL;
+     int verbose_img = 1;
      char *href = NULL;
      char *map_href = NULL;
      char *title = NULL;
***************
*** 2535,2548 ****
  
        } else if (me->inA == TRUE && dest) {
            StrAllocCopy(alt_string, (title ?
!                                     title : "[LINK]"));
  
        } else {
!           if (pseudo_inline_alts || clickable_images)
                StrAllocCopy(alt_string, (title ? title :
                          ((present &&
                            present[HTML_IMG_ISOBJECT]) ?
!                                            "(OBJECT)" : "[INLINE]")));
            else
                StrAllocCopy(alt_string, (title ?
                                          title : ""));
--- 2539,2555 ----
  
        } else if (me->inA == TRUE && dest) {
            StrAllocCopy(alt_string, (title ?
!                                     title : (verbose_img)?
!                                       
(newtitle=MakeNewTitle(value)):"[LINK]"));            
  
        } else {
!           if (pseudo_inline_alts || clickable_images){  /* HELEN */
                StrAllocCopy(alt_string, (title ? title :
                          ((present &&
                            present[HTML_IMG_ISOBJECT]) ?
!                                            "(OBJECT)" : (verbose_img)?
!                            (newtitle=MakeNewTitle(value)):"[INLINE]")));
!           }
            else
                StrAllocCopy(alt_string, (title ?
                                          title : ""));
***************
*** 2666,2672 ****
                             ((present &&
                               present[HTML_IMG_ISOBJECT]) ?
                   ((map_href || dest_ismap) ?
!                                  "(IMAGE)" : "(OBJECT)") : "[IMAGE]"));
                if (id_string && !map_href) {
                    if (ID_A = HTAnchor_findChildAndLink(
                                  me->node_anchor,      /* Parent */
--- 2673,2680 ----
                             ((present &&
                               present[HTML_IMG_ISOBJECT]) ?
                   ((map_href || dest_ismap) ?
!                                  "(IMAGE)" : "(OBJECT)") : (verbose_img)?
!                               (newtitle=MakeNewTitle(value)):"[IMAGE]"));
                if (id_string && !map_href) {
                    if (ID_A = HTAnchor_findChildAndLink(
                                  me->node_anchor,      /* Parent */
***************
*** 2720,2726 ****
                StrAllocCopy(alt_string,
                             ((present &&
                               present[HTML_IMG_ISOBJECT]) ?
!                                                 "(IMAGE)" : "[IMAGE]"));
            } else {
                HTML_put_character(me, ' ');  /* space char may be ignored */
                me->in_word = NO;
--- 2728,2735 ----
                StrAllocCopy(alt_string,
                             ((present &&
                               present[HTML_IMG_ISOBJECT]) ?
!                                                 "(IMAGE)" : (verbose_img)?
!                               (newtitle=MakeNewTitle(value)): "[IMAGE]"));
            } else {
                HTML_put_character(me, ' ');  /* space char may be ignored */
                me->in_word = NO;
***************
*** 2843,2848 ****
--- 2852,2858 ----
        FREE(alt_string);
        FREE(id_string);
        FREE(title);
+       FREE(newtitle);
        dest = NULL;
        dest_ismap = FALSE;
        break;
***************
*** 4206,4212 ****
                    HText_beginAnchor(me->text, me->inUnderline, me->CurrentA);
                    if (me->inBoldH == FALSE)
                        HText_appendCharacter(me->text, LY_BOLD_START_CHAR);
!                   HTML_put_string(me, "[IMAGE]");
                    if (me->inBoldH == FALSE)
                        HText_appendCharacter(me->text, LY_BOLD_END_CHAR);
                    HText_endAnchor(me->text, 0);
--- 4216,4222 ----
                    HText_beginAnchor(me->text, me->inUnderline, me->CurrentA);
                    if (me->inBoldH == FALSE)
                        HText_appendCharacter(me->text, LY_BOLD_START_CHAR);
!                   HTML_put_string(me, 
(verbose_img)?(newtitle=MakeNewTitle(value)):"[IMAGE]");
                    if (me->inBoldH == FALSE)
                        HText_appendCharacter(me->text, LY_BOLD_END_CHAR);
                    HText_endAnchor(me->text, 0);
***************
*** 6738,6740 ****
--- 6748,6768 ----
      HTAlert(message);         /* @@@@@@@@@@@@@@@@@@@ */
      return -number;
  } 
+ 
+ 
+ PRIVATE char * MakeNewTitle(CONST char ** value)
+ {
+   char *ptr;
+   char *newtitle=NULL;
+ 
+   StrAllocCopy(newtitle,"[");
+   ptr=strrchr(value[HTML_IMG_SRC],'/');
+   if(!ptr){
+     StrAllocCat(newtitle,value[HTML_IMG_SRC]);
+   }
+   else{
+     StrAllocCat(newtitle,ptr+1);
+   }
+   StrAllocCat(newtitle,"]");
+   return newtitle;
+ }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]