lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev [PATCH 2.8.3.dev6] fixes for psrc mode


From: Vlad Harchev
Subject: lynx-dev [PATCH 2.8.3.dev6] fixes for psrc mode
Date: Fri, 13 Aug 1999 01:45:25 +0500 (SAMST)

 
* Corrected displaying of SGML_LITTERAL content.
* Now LY_SOFT_NEWLINE are used in psrc mode to denote wrapped lines (as in
  plain source mode).

 Best regards,
  -Vlad

diff -ru lynx2-8-3dev6/WWW/Library/Implementation/SGML.c 
lynx2-8-3dev6-fixed/WWW/Library/Implementation/SGML.c
--- lynx2-8-3dev6/WWW/Library/Implementation/SGML.c     Sat Jul 31 04:38:09 1999
+++ lynx2-8-3dev6-fixed/WWW/Library/Implementation/SGML.c       Fri Aug 13 
01:39:12 1999
@@ -189,7 +189,7 @@
     char *                     url;
     char *                     csi;
     int                                csi_index;
-} ;
+};
 
 #ifdef USE_PSRC
 static BOOL seen_letter_in_junk_tag;
@@ -1700,6 +1700,12 @@
                        context->element_stack->tag->contents == SGML_LITTERAL)
                                         ?
                              S_litteral : S_tag;
+#ifdef USE_PSRC
+           if (psrc_view) /*there is nothing useful in the element_stack*/
+               if (context->current_tag && 
+                       context->current_tag->contents == SGML_LITTERAL)
+                   context->state = S_litteral;
+#endif
 #define PASS8859SPECL context->T.pass_160_173_raw
        /*
        **  Convert 160 (nbsp) to Lynx special character if
@@ -1901,12 +1907,45 @@
        HTChunkPutc(string, c);
        if (TOUPPER(c) != ((string->size == 1) ?
                                           '/' :
+#ifdef USE_PSRC
+                       psrc_view ? context->current_tag->name[string->size-2]:
+#endif                                    
                        context->element_stack->tag->name[string->size-2])) {
            int i;
 
            /*
            **  If complete match, end litteral.
            */
+#ifdef USE_PSRC
+           if (psrc_view) {
+               if ((c == '>') && context->current_tag && 
!context->current_tag->name[string->size-2]) {
+                   PSRCSTART(abracket);PUTC('<');PUTC('/');PSRCSTOP(abracket);
+                   PSRCSTART(tag);
+                   strcpy(string->data,context->current_tag->name);            
    
+                   if (tagname_transform != 1) {
+                       if (tagname_transform == 0)
+                           LYLowerCase(string->data);
+                       else
+                           LYUpperCase(string->data);
+                   }
+                   PUTS(string->data);
+                   PSRCSTOP(tag);
+                   PSRCSTART(abracket);PUTC('>');PSRCSTOP(abracket);           
    
+
+                   context->current_tag = NULL;                    
+                   string->size = 0;
+                   context->current_attribute_number = INVALID;
+                   context->state = S_text;
+                   break;              
+               }
+               PUTC('<'); 
+               for (i = 0; i < string->size-1; i++)  /* recover, except last c 
*/
+                   PUTC(string->data[i]);                              
+               string->size = 0;
+               context->state = S_text;
+               goto top1;              /* to recover last c */             
+           } else
+#endif     
            if ((c == '>') &&
                (!context->element_stack->tag->name[string->size-2])) {
                end_element(context, context->element_stack->tag);
@@ -4058,6 +4097,7 @@
 #ifdef USE_PSRC
     if (psrc_view) {
        psrc_view = FALSE;
+       mark_htext_as_source = TRUE;
        SGML_string(context,
                    "<HTML><HEAD><TITLE>source</TITLE></HEAD><BODY><PRE>");
        psrc_view = TRUE;
diff -ru lynx2-8-3dev6/src/GridText.c lynx2-8-3dev6-fixed/src/GridText.c
--- lynx2-8-3dev6/src/GridText.c        Wed Aug 11 19:07:41 1999
+++ lynx2-8-3dev6-fixed/src/GridText.c  Thu Aug 12 08:19:48 1999
@@ -144,6 +144,7 @@
 PUBLIC int LYsb_end = -1;
 #endif
 
+
 #if defined(USE_COLOR_STYLE)
 #define MAX_STYLES_ON_LINE 64
 
@@ -647,7 +648,13 @@
     else
        self->source = NO;
 #else
-    self->source=( LYpsrc ? psrc_view : HTOutputFormat == WWW_SOURCE);
+    /*  mark_htext_as_source == TRUE if we are parsing html file (and 
psrc_view is
+           set temporary to false at creation time)
+       psrc_view == TRUE if source of the text produced by some lynx module 
+           (like ftp browsers) is requested). - VH    
+    */
+    self->source=( LYpsrc ? mark_htext_as_source || psrc_view : HTOutputFormat 
== WWW_SOURCE);
+    mark_htext_as_source = FALSE;
 #endif
     HTAnchor_setDocument(anchor, (HyperDoc *)self);
     HTFormNumber = 0;  /* no forms started yet */
diff -ru lynx2-8-3dev6/src/LYMainLoop.c lynx2-8-3dev6-fixed/src/LYMainLoop.c
--- lynx2-8-3dev6/src/LYMainLoop.c      Thu Aug 12 08:03:11 1999
+++ lynx2-8-3dev6-fixed/src/LYMainLoop.c        Thu Aug 12 08:04:18 1999
@@ -1285,13 +1285,6 @@
                     *  to Newline, so we get a redraw.
                     */
                    curdoc.line = -1;
-#ifdef USE_PSRC
-                   if (psrc_view)
-                       HTMark_asSource(); /* this flag is not set, since when
-                       displaying source, psrc_view is temporary unset when
-                       writing the HTML header - and HTMainText is created
-                       at that time.*/
-#endif
                    break;
                }  /* end switch */
 
diff -ru lynx2-8-3dev6/src/LYPrettySrc.c lynx2-8-3dev6-fixed/src/LYPrettySrc.c
--- lynx2-8-3dev6/src/LYPrettySrc.c     Thu May 20 17:48:10 1999
+++ lynx2-8-3dev6-fixed/src/LYPrettySrc.c       Thu Aug 12 08:19:57 1999
@@ -16,7 +16,7 @@
 PUBLIC BOOL sgml_in_psrc_was_initialized;
 PUBLIC BOOL psrc_nested_call;
 PUBLIC BOOL psrc_first_tag;
-
+PUBLIC BOOL mark_htext_as_source=FALSE;
   /* tagspecs from lynx.cfg are read here. After .lss file is read (is with lss
      support), the style cache and markup are created before entering the
      mainloop. */
diff -ru lynx2-8-3dev6/src/LYPrettySrc.h lynx2-8-3dev6-fixed/src/LYPrettySrc.h
--- lynx2-8-3dev6/src/LYPrettySrc.h     Thu May  6 05:33:59 1999
+++ lynx2-8-3dev6-fixed/src/LYPrettySrc.h       Thu Aug 12 08:19:30 1999
@@ -21,6 +21,8 @@
 extern BOOL psrc_first_tag; /* this is also used in HTML.c to trigger the 
  1st tag to preform special. */
 
+extern BOOL mark_htext_as_source;
+
 /* here is a list of lexem codes. */
 typedef enum _HTlexem {
   HTL_comm=0,


reply via email to

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