[BACK]Return to html.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/html.c between version 1.13 and 1.16

version 1.13, 2008/12/06 21:10:31 version 1.16, 2008/12/08 16:29:57
Line 55  static void  html_free(void *);
Line 55  static void  html_free(void *);
 static  ssize_t         html_endtag(struct md_mbuf *, void *,  static  ssize_t         html_endtag(struct md_mbuf *, void *,
                                 const struct md_args *,                                  const struct md_args *,
                                 enum md_ns, int);                                  enum md_ns, int);
   static  ssize_t         html_beginstring(struct md_mbuf *,
                                   const struct md_args *,
                                   const char *, size_t);
   static  ssize_t         html_beginhttp(struct md_mbuf *,
                                   const struct md_args *,
                                   const char *, size_t);
   static  ssize_t         html_endstring(struct md_mbuf *,
                                   const struct md_args *,
                                   const char *, size_t);
   static  ssize_t         html_endhttp(struct md_mbuf *,
                                   const struct md_args *,
                                   const char *, size_t);
 static  ssize_t         html_begintag(struct md_mbuf *, void *,  static  ssize_t         html_begintag(struct md_mbuf *, void *,
                                 const struct md_args *,                                  const struct md_args *,
                                 enum md_ns, int,                                  enum md_ns, int,
Line 63  static int  html_begin(struct md_mbuf *,
Line 75  static int  html_begin(struct md_mbuf *,
                                 const struct md_args *,                                  const struct md_args *,
                                 const struct tm *,                                  const struct tm *,
                                 const char *, const char *,                                  const char *, const char *,
                                 const char *, const char *);                                  enum roffmsec, const char *);
 static  int             html_printargs(struct md_mbuf *, int,  static  int             html_printargs(struct md_mbuf *, int,
                                 const char *, const int *,                                  const char *, const int *,
                                 const char **, size_t *);                                  const char **, size_t *);
Line 127  html_It_headtagname(struct md_mbuf *mbuf, struct htmlq
Line 139  html_It_headtagname(struct md_mbuf *mbuf, struct htmlq
         for (i = 0; ROFF_ARGMAX != n->argc[i] &&          for (i = 0; ROFF_ARGMAX != n->argc[i] &&
                         i < ROFF_MAXLINEARG; i++) {                          i < ROFF_MAXLINEARG; i++) {
                 switch (n->argc[i]) {                  switch (n->argc[i]) {
                   case (ROFF_Ohang):
                           return(ml_nputs(mbuf, "div", 3, res));
                 case (ROFF_Tag):                  case (ROFF_Tag):
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case (ROFF_Column):                  case (ROFF_Column):
Line 136  html_It_headtagname(struct md_mbuf *mbuf, struct htmlq
Line 150  html_It_headtagname(struct md_mbuf *mbuf, struct htmlq
                 }                  }
         }          }
   
         assert(i != ROFF_MAXLINEARG);          return(0);
         abort();  
         /* NOTREACHED */  
   
         return(1);  
 }  }
   
   
Line 190  html_It_bodytagname(struct md_mbuf *mbuf, struct htmlq
Line 200  html_It_bodytagname(struct md_mbuf *mbuf, struct htmlq
         }          }
   
         assert(i != ROFF_MAXLINEARG);          assert(i != ROFF_MAXLINEARG);
         abort();          return(0);
         /* NOTREACHED */  
   
         return(1);  
 }  }
   
   
Line 235  html_Bl_bodytagname(struct md_mbuf *mbuf, struct htmlq
Line 242  html_Bl_bodytagname(struct md_mbuf *mbuf, struct htmlq
         }          }
   
         assert(i != ROFF_MAXLINEARG);          assert(i != ROFF_MAXLINEARG);
         abort();          return(0);
         /* NOTREACHED */  
 }  }
   
   
Line 286  html_It_blocktagname(struct md_mbuf *mbuf, struct html
Line 292  html_It_blocktagname(struct md_mbuf *mbuf, struct html
         }          }
   
         assert(i != ROFF_MAXLINEARG);          assert(i != ROFF_MAXLINEARG);
         abort();          return(0);
         /* NOTREACHED */  
 }  }
   
   
Line 349  out:
Line 354  out:
 static int  static int
 html_begin(struct md_mbuf *mbuf, const struct md_args *args,  html_begin(struct md_mbuf *mbuf, const struct md_args *args,
                 const struct tm *tm, const char *os,                  const struct tm *tm, const char *os,
                 const char *title, const char *section,                  const char *title, enum roffmsec section,
                 const char *vol)                  const char *vol)
 {  {
         const char      *preamble, *css, *trail;          const char      *preamble, *css, *trail;
Line 377  html_begin(struct md_mbuf *mbuf, const struct md_args 
Line 382  html_begin(struct md_mbuf *mbuf, const struct md_args 
         res = 0;          res = 0;
   
         (void)snprintf(buf, sizeof(buf) - 1,          (void)snprintf(buf, sizeof(buf) - 1,
                         preamble, title, section);                          preamble, title, ml_section(section));
   
         if ( ! ml_puts(mbuf, buf, &res))          if ( ! ml_puts(mbuf, buf, &res))
                 return(0);                  return(0);
Line 739  html_free(void *p)
Line 744  html_free(void *p)
 }  }
   
   
   static ssize_t
   html_beginhttp(struct md_mbuf *mbuf,
                   const struct md_args *args,
                   const char *buf, size_t sz)
   {
           size_t           res;
   
           res = 0;
   
           if ( ! ml_puts(mbuf, "<a href=\"", &res))
                   return(-1);
           if (1 != ml_nputstring(mbuf, buf, sz, &res))
                   return(-1);
           if ( ! ml_puts(mbuf, "\">", &res))
                   return(-1);
   
           return((ssize_t)res);
   }
   
   
   static ssize_t
   html_endhttp(struct md_mbuf *mbuf,
                   const struct md_args *args,
                   const char *buf, size_t sz)
   {
           size_t           res;
   
           res = 0;
   
           if ( ! ml_puts(mbuf, "</a>", &res))
                   return(-1);
   
           return((ssize_t)res);
   }
   
   
   /* ARGSUSED */
   static ssize_t
   html_beginstring(struct md_mbuf *mbuf,
                   const struct md_args *args,
                   const char *buf, size_t sz)
   {
   
           if (0 == strncmp(buf, "http://", 7))
                   return(html_beginhttp(mbuf, args, buf, sz));
   
           return(0);
   }
   
   
   /* ARGSUSED */
   static ssize_t
   html_endstring(struct md_mbuf *mbuf,
                   const struct md_args *args,
                   const char *buf, size_t sz)
   {
   
           if (0 == strncmp(buf, "http://", 7))
                   return(html_endhttp(mbuf, args, buf, sz));
   
           return(0);
   }
   
   
 int  int
 md_line_html(void *data, char *buf)  md_line_html(void *data, char *buf)
 {  {
Line 767  md_init_html(const struct md_args *args,
Line 836  md_init_html(const struct md_args *args,
         cbs.ml_endtag = html_endtag;          cbs.ml_endtag = html_endtag;
         cbs.ml_begin = html_begin;          cbs.ml_begin = html_begin;
         cbs.ml_end = html_end;          cbs.ml_end = html_end;
           cbs.ml_beginstring = html_beginstring;
           cbs.ml_endstring = html_endstring;
   
         return(mlg_alloc(args, rbuf, mbuf, &cbs));          return(mlg_alloc(args, rbuf, mbuf, &cbs));
 }  }
   

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.16

CVSweb