Esempio n. 1
0
QString ListItem::getFormattedPath(int charsAllowed, bool keepName, bool userAlt){

    QString formatedStr;
    if(!m_componentList.isEmpty()){
        m_processedPieces.clear();
        m_displayLengths.clear();
        m_processedPieces = getPathPieces();
        m_displayLengths = decomposeByStrings(charsAllowed,m_processedPieces);
        QStringList l = truncByLength(m_processedPieces, m_displayLengths);
        l = positionOrder(l);
        m_processedPieces = positionOrder(m_processedPieces);
        reorderBounds();
        if(m_useDisplayPathForNextKey && userAlt){
            l = highlightKey(l, m_nextKeyIndex);
        }
        if((m_maxSplitPointIndex !=-2)) {
            Q_ASSERT(m_minSplitPointIndex !=m_componentList.count());
            l[1] = htmlFontFormat(l[1], EMPHESIS_COLOR);
        } else {
            Q_ASSERT(m_minSplitPointIndex ==m_componentList.count());
        }
        //l = stripNulls(l);
        formatedStr = stripCombine(l, keepName);
        formatedStr = htmlize(formatedStr);


    } else {
        formatedStr = htmlize( modifiedDescription() );
    }

    return formatedStr;
}
/* Format the traces of the filter execution in an HTML string.
   Filters that have been modified or deleted since the time when they've been
   applied to the message are indicated as such.
*/
QString
mail_displayer::format_filters_trace(const filter_log_list& list)
{
  if (list.isEmpty())
    return QString();

  QString r = "<font color=\"brown\">" + QObject::tr("Filtered by:") + " </font>";
  bool show_numbers=(list.count()>1);
  for (int i=0; i<list.count(); i++) {
    const filter_log_entry e = list.at(i);
    if (i>0)
      r.append("<br> &nbsp;");
    if (show_numbers)
      r.append(QString("%1. ").arg(i+1));
    QString name = e.filter_name();
    if (!name.isEmpty()) {
      r.append(QString(" [%1] ").arg(htmlize(name)));
    }
    else {
      r.append(QString(" [#%1] ").arg(e.filter_expr_id()));
      if (e.m_deleted) {
	r.append("<i>" + QObject::tr("(filter deleted)") + "</i>");
      }
    }
    if (!e.m_deleted) {
      r.append("<i>");
      r.append(e.m_modified ? QObject::tr("(filter modified)") : htmlize(e.filter_expression()));
      r.append("</i>");
    }
  }
  return r;
}
Esempio n. 3
0
/*
** TH1 command:  combobox NAME TEXT-LIST NUMLINES
**
** Generate an HTML combobox.  NAME is both the name of the
** CGI parameter and the name of a variable that contains the
** currently selected value.  TEXT-LIST is a list of possible
** values for the combobox.  NUMLINES is 1 for a true combobox.
** If NUMLINES is greater than one then the display is a listbox
** with the number of lines given.
*/
static int comboboxCmd(
  Th_Interp *interp,
  void *p, 
  int argc, 
  const char **argv, 
  int *argl
){
  if( argc!=4 ){
    return Th_WrongNumArgs(interp, "combobox NAME TEXT-LIST NUMLINES");
  }
  if( enableOutput ){
    int height;
    Blob name;
    int nValue;
    const char *zValue;
    char *z, *zH;
    int nElem;
    int *aszElem;
    char **azElem;
    int i;

    if( Th_ToInt(interp, argv[3], argl[3], &height) ) return TH_ERROR;
    Th_SplitList(interp, argv[2], argl[2], &azElem, &aszElem, &nElem);
    blob_init(&name, (char*)argv[1], argl[1]);
    zValue = Th_Fetch(blob_str(&name), &nValue);
    z = mprintf("<select name=\"%z\" size=\"%d\">", 
                 htmlize(blob_buffer(&name), blob_size(&name)), height);
    sendText(z, -1, 0);
    free(z);
    blob_reset(&name);
    for(i=0; i<nElem; i++){
      zH = htmlize((char*)azElem[i], aszElem[i]);
      if( zValue && aszElem[i]==nValue 
             && memcmp(zValue, azElem[i], nValue)==0 ){
        z = mprintf("<option value=\"%s\" selected=\"selected\">%s</option>",
                     zH, zH);
      }else{
        z = mprintf("<option value=\"%s\">%s</option>", zH, zH);
      }
      free(zH);
      sendText(z, -1, 0);
      free(z);
    }
    sendText("</select>", -1, 0);
    Th_Free(interp, azElem);
  }
  return TH_OK;
}
Esempio n. 4
0
/** Prints the main stat table.
 * @param fp file pointer to pass to fprintf()
 * @param list of patches
 * @param alllines number of all lines
 * @param list of ignores
 */
void print_table(FILE* fp, DSList *list, int alllines, DSList *ignores)
{
	DSList *lp;

	fprintf(fp, "<table bgcolor=\"%s\" border=\"0\" cellspacing=\"1\" "
		"cellpadding=\"2\" width=\"100%%\">\n", BORDER);
	fprintf(fp, "<tr bgcolor=\"%s\">\n", HEADING);
	fprintf(fp, "<td>Committer</td>\n"
		"<td># of Changes</td>"
		"<td>Lines Changed</td>"
		"<td>Lines per Change</td>"
		"<td>%% of Changed Lines</td>"
		"</tr>");
	for(lp = list; lp; lp = lp->next)
		if(!isignore_in(((patch_t*)lp->data)->author, ignores))
		{
			fprintf(fp, "<tr bgcolor=\"%s\">\n", BACKGROUND);
			fprintf(fp, "<td>%s</td>\n", htmlize(((patch_t*)lp->data)->author));
			fprintf(fp, "<td>%d</td>\n", ((patch_t*)lp->data)->changes);
			fprintf(fp, "<td>%d</td>\n", ((patch_t*)lp->data)->lines);
			fprintf(fp, "<td>%d</td>\n", ((patch_t*)lp->data)->lines/
				((patch_t*)lp->data)->changes);
			fprintf(fp, "<td>%d</td>\n", 100*((patch_t*)lp->data)->lines/
				alllines);
			fprintf(fp, "<tr>\n");
		}
	fprintf(fp, "</table>\n");
}
Esempio n. 5
0
//First support classes and functions...
QString ListItem::formattedName(bool fullHtml, int charsAllowed){
    QString formatedStr;
    if(!getCustomString(OVERRIDE_FORMATTED_NAME_KEY).isEmpty()){
        formatedStr =getCustomString(OVERRIDE_FORMATTED_NAME_KEY);
        if(charsAllowed>-1){
            formatedStr = formatedStr.right(charsAllowed);
        }
    } else if(!m_useDisplayPathForNextKey){
        formatedStr = getName();
        //int offsetNextKeys = m_nextKeyIndex;
        if(charsAllowed>-1 && formatedStr.length() > charsAllowed ){
            //offsetNextKeys -= (formatedStr.length() - charsAllowed);
            formatedStr = formatedStr.left(charsAllowed);
        }
        QStringList l;
        l.append(formatedStr);
        l = highlightKey(l, m_nextKeyIndex);
        formatedStr = (l.join(" "));
        if(UI_LISTNAME_BOLD){
            formatedStr = QString("<b>") + formatedStr + "</b>";
        }
        formatedStr = QString("<p>") + formatedStr + "</p>";

    }
    if(fullHtml){
        formatedStr = htmlize(formatedStr);
    }

    return  formatedStr;
}
QString
mail_displayer::sprint_additional_headers(const display_prefs& prefs,
					  mail_msg* msg)
{
  QString h;

  // Insert tag names
  if (prefs.m_show_tags_in_headers) {
    std::list<uint>& tags = msg->get_tags();
    QStringList tag_names = tags_repository::names_list(tags);
    if (!tag_names.isEmpty()) {
      h.append(QString("<br><font color=\"brown\">" + QObject::tr("Tags:") + " </font>"));
      for (int i=0; i<tag_names.size(); i++) {
	tag_names[i] = "<b>"+ htmlize(tag_names[i]) + "</b>";
      }

      h.append(tag_names.join(" | "));
    }
  }

  // Insert filters log if enabled
  if (prefs.m_show_filters_trace) {
    filter_log_list lli;
    if (lli.fetch(msg->get_id())) {
      QString fh = format_filters_trace(lli);
      if (!fh.isEmpty()) {
	h.append("<br>");
	h.append(fh);
      }
    }
  }

  return h;  
}
Esempio n. 7
0
/*
** Output N characters of text from zText.
*/
static void put_htmlized_text(const char **pzText, int N){
  if( N>0 ){
    char *z = htmlize(*pzText, N);
    cgi_printf("%s", z);
    free(z);
    *pzText += N;
  }
}
Esempio n. 8
0
/*
** Send text to the appropriate output:  Either to the console
** or to the CGI reply buffer.
*/
static void sendText(const char *z, int n, int encode){
  if( enableOutput && n ){
    if( n<0 ) n = strlen(z);
    if( encode ){
      z = htmlize(z, n);
      n = strlen(z);
    }
    if( g.cgiOutput ){
      cgi_append_content(z, n);
    }else{
      fwrite(z, 1, n, stdout);
      fflush(stdout);
    }
    if( encode ) free((char*)z);
  }
}
Esempio n. 9
0
/*
** TH command:      htmlize STRING
**
** Escape all characters of STRING which have special meaning in HTML.
** Return a new string result.
*/
static int htmlizeCmd(
  Th_Interp *interp, 
  void *p, 
  int argc, 
  const char **argv, 
  int *argl
){
  char *zOut;
  if( argc!=2 ){
    return Th_WrongNumArgs(interp, "htmlize STRING");
  }
  zOut = htmlize((char*)argv[1], argl[1]);
  Th_SetResult(interp, zOut, -1);
  free(zOut);
  return TH_OK;
}
Esempio n. 10
0
/*
** Output Wiki text while inserting the proper HTML control codes.
** The following formatting conventions are implemented:
**
**    *    Characters with special meaning to HTML are escaped.
**
**    *    Blank lines results in a paragraph break.
**
**    *    Paragraphs where the first line is indented by two or more
**         spaces are shown verbatim.  None of the following rules apply
**         to verbatim text.
**
**    *    Lines beginning with "*: " begin a bullet in a bullet list.
**
**    *    Lines beginning with "1: " begin an item in an enumerated list.
**
**    *    Paragraphs beginning with "_: " are indented.
**
**    *    Multiple colons can be used in *:, 1:, and _: for multiple
**         levels of indentation.
**
**    *    Text within _..._ is italic and text in *...* is bold.  
**         Text with in **...** or ***...*** bold with a larger font.
**
**    *    Wiki pages names (Words in initial caps) are enclosed in an
**         appropriate hyperlink.
**
**    *    Words that begin with "http:", "https:", "ftp:", or "mailto:"
**         are enclosed in an appropriate hyperlink.
**
**    *    Text of the form "#NNN" where NNN is a valid ticket number
**         is converted into a hyperlink to the corresponding ticket.
**
**    *    Text of the form "[NNN]" where NNN is a valid check-in number
**         becomes a hyperlink to the checkin.
**
**    *    {quote: XYZ} renders XYZ with all special meanings for XYZ escaped.
**
**    *    {link: URL TEXT} renders TEXT with a link to URL.  URL can be 
**         relative.
**
**    *    {linebreak} renders a linebreak.
**
**    *    {image: URL ALT} renders an in-line image from URL.  URL can be
**         relative or it can be the name of an attachment to zPageId.
**         {leftimage: URL ALT} and {rightimage: URL ALT} create wrap-around
**         images at the left or right margin.
**
**    *    {clear} skips down the page far enough to clear any wrap-around
**         images.
**
**    *    Text between <html>...</html> is interpreted as HTML.  A restricted
**         subset of tags are supported - things like forms and javascript are
**         intentionally excluded.  The initial <html> must occur at the
**         beginning of a paragraph.
*/
void output_wiki(
  const char *zText,          /* The text to be formatted */
  const char *zLinkSuffix,    /* Suffix added to hyperlinks to Wiki */
  const char *zPageId         /* Name of current page */
){
  int i, j, k;
  int aList[20];         /* See adjust_list_nesting for details */
  int inPRE = 0;
  int inB = 0;
  int inI = 0;
  int v;
  int wordStart = 1;     /* At the start of a word */
  int lineStart = 1;     /* At the start of a line */
  int paraStart = 1;     /* At the start of a paragraph */
  const char *zEndB;     /* Text used to end a run of bold */
  char **azAttach;       /* Attachments to zPageId */
  static int once = 1;
  static int nTicket, nCommit;
  if( once ){
    nTicket = atoi(db_short_query("SELECT max(tn) FROM ticket"));
    nCommit = atoi(db_short_query("SELECT max(cn) FROM chng"));
    once = 0;
  }

  i = 0;
  aList[0] = 0;
  azAttach = 0;
  zEndB = "";
  while( zText[i] ){
    char *z;
    int n;
    Markup sMarkup;
    int c = zText[i];

    /* Text between <html>...</html> is interpreted as HTML.
    */
    if( c=='<' && (n = is_html(&zText[i]))>0 ){
      put_htmlized_text(&zText, i);
      zText += 6;
      output_restricted_html(zText, n-13);
      zText += n - 6;
      i = 0;
      continue;
    }

    /* Markup may consist of special strings contained in curly braces.
    ** Examples:  "{linebreak}"  or "{quote: *:}"
    */
    if( c=='{' && is_markup(&zText[i], &sMarkup) ){
      /*
      ** Markup of the form "{linebreak}" forces a line break.
      */
      if( sMarkup.lenType==9 && strncmp(sMarkup.zType,"linebreak",9)==0 ){
        put_htmlized_text(&zText, i);
        zText += sMarkup.lenTotal;
        i = 0;
        cgi_printf("<br>\n");
        wordStart = lineStart = paraStart = 0;
        continue;
      }

      /*
      ** Markup of the form "{clear}" moves down past any left or right
      ** aligned images.
      */
      if( sMarkup.lenType==5 && strncmp(sMarkup.zType,"clear",5)==0 ){
        put_htmlized_text(&zText, i);
        zText += sMarkup.lenTotal;
        i = 0;
        cgi_printf("<br clear=\"both\">\n");
        wordStart = lineStart = paraStart = 0;
        continue;
      }

      /*
      ** Markup of the form "{quote: ABC}" writes out the text ABC exactly
      ** as it appears.  This can be used to escape special meanings 
      ** associated with ABC.
      */
      if( sMarkup.lenType==5 && strncmp(sMarkup.zType,"quote",5)==0 ){
        int n;
        put_htmlized_text(&zText, i);
        if( sMarkup.zKey==sMarkup.zArgs ){
          n = sMarkup.lenKey;
        }else{
          n = &sMarkup.zArgs[sMarkup.lenArgs] - sMarkup.zKey;
        }
        put_htmlized_text(&sMarkup.zKey, n);
        zText += sMarkup.lenTotal;
        i = 0;
        wordStart = lineStart = paraStart = 0;
        continue;
      }

      /*
      ** Markup of the form "{link: TO TEXT}" creates a hyperlink to TO.
      ** The hyperlink appears on the screen as TEXT.  TO can be a any URL,
      ** including a relative URL such as "chngview?cn=123".
      */
      if( sMarkup.lenType==4 && strncmp(sMarkup.zType,"link",4)==0 ){
        put_htmlized_text(&zText, i);
        cgi_printf("<a href=\"%.*s\">", sMarkup.lenKey, sMarkup.zKey);
        put_htmlized_text(&sMarkup.zArgs, sMarkup.lenArgs);
        cgi_printf("</a>");
        zText += sMarkup.lenTotal;
        i = 0;
        wordStart = lineStart = paraStart = 0;
        continue;
      }

      /*
      ** Markup of the form "{image: URL ALT}" creates an in-line image to
      ** URL with ALT as the alternate text.  URL can be relative (for example
      ** the URL of an attachment.
      **
      ** If the URL is the name of an attachment, then automatically
      ** convert it to the correct URL for that attachment.
      */
      if( (sMarkup.lenType==5 && strncmp(sMarkup.zType,"image",5)==0)
       || (sMarkup.lenType==9 && strncmp(sMarkup.zType,"leftimage",9)==0)
       || (sMarkup.lenType==10 && strncmp(sMarkup.zType,"rightimage",10)==0)
      ){
        char *zUrl = 0;
        const char *zAlign;
        char *zAlt = htmlize(sMarkup.zArgs, sMarkup.lenArgs);
        if( azAttach==0 && zPageId!=0 ){
          azAttach = (char **)
                     db_query("SELECT fname, atn FROM attachment "
                              "WHERE tn='%q'", zPageId);
        }
        if( azAttach ){
          int ix;
          for(ix=0; azAttach[ix]; ix+=2){
            if( strncmp(azAttach[ix],sMarkup.zKey,sMarkup.lenKey)==0 ){
              free(zUrl);
              zUrl = mprintf("attach_get/%s/%h",
                            azAttach[ix+1], azAttach[ix]);
              break;
            }
          }
        }
        if( zUrl==0 ){
          zUrl = htmlize(sMarkup.zKey, sMarkup.lenKey);
        }
        put_htmlized_text(&zText, i);
        switch( sMarkup.zType[0] ){
          case 'l': case 'L':   zAlign = " align=\"left\"";  break;
          case 'r': case 'R':   zAlign = " align=\"right\""; break;
          default:              zAlign = "";                 break;
        }
        cgi_printf("<img src=\"%s\" alt=\"%s\"%s>", zUrl, zAlt, zAlign);
        free(zUrl);
        free(zAlt);
        zText += sMarkup.lenTotal;
        i = 0;
        wordStart = lineStart = paraStart = 0;
        continue;
      }
    }

    if( paraStart ){
      put_htmlized_text(&zText, i);

      /* Blank lines at the beginning of a paragraph are ignored.
      */
      if( isspace(c) && (j = is_blank_line(&zText[i]))>0 ){
        zText += j;
        continue;
      }

      /* If the first line of a paragraph begins with a tab or with two
      ** or more spaces, then that paragraph is printed verbatim.
      */
      if( c=='\t' || (c==' ' && (zText[i+1]==' ' || zText[i+1]=='\t')) ){
        if( !inPRE ){
          if( inB ){ cgi_printf(zEndB); inB=0; }
          if( inI ){ cgi_printf("</i>"); inI=0; }
          adjust_list_nesting(aList, 0);
          cgi_printf("<pre>\n");
          inPRE = 1;
        }
      }
    } /* end if( paraStart ) */

    if( lineStart ){
      /* Blank lines in the middle of text cause a paragraph break
      */
      if( isspace(c) && (j = is_blank_line(&zText[i]))>0 ){
        put_htmlized_text(&zText, i);
        zText += j;
        if( inB ){ cgi_printf(zEndB); inB=0; }
        if( inI ){ cgi_printf("</i>"); inI=0; }
        if( inPRE ){ cgi_printf("</pre>\n"); inPRE = 0; }
        is_list_elem(zText, &k);
        if( abs(k)<aList[0] ) adjust_list_nesting(aList, k);
        if( zText[0]!=0 ){ cgi_printf("\n<p>"); }
        wordStart = lineStart = paraStart = 1;
        i = 0;
        continue;
      }
    } /* end if( lineStart ) */

    if( lineStart && !inPRE ){
      /* If we are not in verbatim text and a line begins with "*:", then
      ** generate a bullet.  Or if the line begins with "NNN:" where NNN
      ** is a number, generate an enumeration item.
      */
      if( (j = is_list_elem(&zText[i], &k))>0 ){
        put_htmlized_text(&zText, i);
        adjust_list_nesting(aList, k);
        if( zText[0]!='_' ) cgi_printf("<li>");
        zText += j;
        i = 0;
        wordStart = 1;
        lineStart = paraStart = 0;
        continue;
      }

      /* Four or more "-" characters on at the beginning of a line that
      ** contains no other text results in a horizontal rule.
      */
      if( (c=='-' || c=='=') && (j = is_horizontal_rule(&zText[i]))>0 ){
        put_htmlized_text(&zText, i);
        adjust_list_nesting(aList, 0);
        cgi_printf("<hr>\n");
        zText += j;
        if( *zText ) zText++;
        i = 0;
        lineStart = wordStart = 1;
        paraStart = 1;
        continue;
      }
    } /* end if( lineStart && !inPre ) */

    if( wordStart && !inPRE ){
      /* A wiki name at the beginning of a word which is not in verbatim
      ** text generates a hyperlink to that wiki page.
      ** 
      ** Special case: If the name is in CamelCase but ends with a "_", then
      ** suppress the "_" and do not generate the hyperlink.  This allows
      ** CamelCase words that are not wiki page names to appear in text.
      */
      if( g.okRdWiki && isupper(c) && (j = is_wiki_name(&zText[i]))>0 ){
        put_htmlized_text(&zText, i);
        cgi_printf("<a href=\"wiki?p=%.*s%s\">%.*s</a>",
            j, zText, zLinkSuffix, j, zText);
        zText += j;
        i = 0;
        wordStart = lineStart = paraStart = 0;
        continue;
      }

      /* A "_" at the beginning of a word puts us into an italic font.
      */
      if( c=='_' && !inB && !inI && font_terminator(&zText[i+1],c,1) ){
        put_htmlized_text(&zText, i);
        i = 0;
        zText++;
        cgi_printf("<i>");
        inI = 1;
        continue;
      }

      /* A "*" at the beginning of a word puts us into a bold font.
      */
      if( c=='*' && !inB && !inI && (j = count_stars(&zText[i]))>=1
              && j<=3 && font_terminator(&zText[i+j],c,j) ){
        const char *zBeginB = "";
        put_htmlized_text(&zText, i);
        i = 0;
        zText += j;
        switch( j ){
          case 1: zBeginB = "<b>";           zEndB = "</b>";             break;
          case 2: zBeginB = "<big><b>";      zEndB = "</b></big>";       break;
          case 3: zBeginB = "<big><big><b>"; zEndB = "</b></big></big>"; break;
        }
        cgi_printf(zBeginB);
        inB = j;
        continue;
      }


      /* Words that begin with "http:" or "https:" or "ftp:" or "mailto:"
      ** become hyperlinks.
      */
      if( (c=='h' || c=='f' || c=='m') && (j=is_url(&zText[i]))>0 ){
        put_htmlized_text(&zText, i);
        z = htmlize(zText, j);
        if( is_image(z, strlen(z)) ){
          cgi_printf("<img src=\"%s\" alt=\"%s\">", z, z);
        }else{
          cgi_printf("<a href=\"%s\">%s</a>", z, z);
        }
        free(z);
        zText += j;
        i = 0;
        wordStart = lineStart = paraStart = 0;
        continue;
      }

      /* If the user has read permission on tickets and a word is of the
      ** form "#NNN" where NNN is a sequence of digits, then generate a
      ** hyperlink to ticket number NNN.
      */
      if( c=='#' && g.okRead && (j = ndigit(&zText[i+1]))>0 
                 && is_eow(&zText[i+1+j],0)
                 && (v = atoi(&zText[i+1]))>0 && v<=nTicket ){
        put_htmlized_text(&zText, i);
        cgi_printf("<a href=\"tktview?tn=%d\">#%d</a>", v, v);
        zText += j;
        if( *zText ) zText++;
        i = 0;
        wordStart = lineStart = paraStart = 0;
        continue;
      }

      /* If the user has checkout permissions and a word is of the form
      ** "[NNN]" where NNN is a checkin number, then generate a hyperlink
      ** to check-in NNN.
      */
      if( c=='[' && g.okCheckout && (j = ndigit(&zText[i+1]))>0
                 && is_eow(&zText[i+j+2],0)
                 && (v = atoi(&zText[i+1]))>0 && v<=nCommit 
                 && zText[i+j+1]==']' ){
        put_htmlized_text(&zText, i);
        cgi_printf("<a href=\"chngview?cn=%d\">[%d]</a>", v, v);
        zText += j+1;
        if( *zText ) zText++;
        i  = 0;
        wordStart = lineStart = paraStart = 0;
        continue;
      }
    } /* end if( wordStart && !inPre ) */

    /* A "*" or a "_" at the end of a word takes us out of bold or
    ** italic mode.
    */
    if( inB && c=='*' && !isspace(zText[i-1]) && zText[i-1]!='*' &&
            (j = count_stars(&zText[i]))==inB && is_eow(&zText[i+j],0) ){
      inB = 0;
      put_htmlized_text(&zText, i);
      i = 0;
      zText += j;
      cgi_printf(zEndB);
      continue;
    }
    if( inI && c=='_' && !isspace(zText[i-1]) && is_eow(&zText[i+1],0) ){
      put_htmlized_text(&zText, i);
      i = 0;
      zText++;
      inI = 0;
      cgi_printf("</i>");
      continue;
    }
    if( wordStart ){
      wordStart = isspace(c) || c=='(' || c=='"';
    }else{
      wordStart = isspace(c);
    }
    lineStart = c=='\n';
    paraStart = 0;
    i++;
  }
  if( zText[0] ) cgi_printf("%h", zText);
  if( inB ) cgi_printf("%s\n",zEndB);
  if( inI ) cgi_printf("</i>\n");
  adjust_list_nesting(aList, 0);
  if( inPRE ) cgi_printf("</pre>\n");
}
Esempio n. 11
0
void InsetMathSymbol::htmlize(HtmlStream & os) const
{
	htmlize(os, true);
}
Esempio n. 12
0
std::string mec_state::format_as_html(std::string const& heading) const
{
    std::ostringstream oss;

    oss
        << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n"
        << "    \"http://www.w3.org/TR/html4/loose.dtd\">\n"
        << "<html>\n"
        << "<head>\n"
        << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n"
        << "<title>Let me illustrate...</title>\n"
        << "</head>\n"
        << "<body>\n"
        ;

    oss << "<p>" << htmlize(heading) << "</p>\n";

    oss
        << "<hr>\n"
        << "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n"
        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "policy year"                     << "</td>\n"
        << "<td nowrap>" << f(B0_deduced_policy_year   ) << "</td>\n"
        << "</tr>\n"
        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "contract year"                   << "</td>\n"
        << "<td nowrap>" << f(B1_deduced_contract_year ) << "</td>\n"
        << "</tr>\n"
        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "seven-pay rate"                  << "</td>\n"
        << "<td nowrap>" << f(B2_deduced_px7_rate      ) << "</td>\n"
        << "</tr>\n"
        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "nsp rate"                        << "</td>\n"
        << "<td nowrap>" << f(B3_deduced_nsp_rate      ) << "</td>\n"
        << "</tr>\n"
        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "target premium"                  << "</td>\n"
        << "<td nowrap>" << f(B4_deduced_target_premium) << "</td>\n"
        << "</tr>\n"
        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "target load"                     << "</td>\n"
        << "<td nowrap>" << f(B5_deduced_target_load   ) << "</td>\n"
        << "</tr>\n"
        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "excess load"                     << "</td>\n"
        << "<td nowrap>" << f(B6_deduced_excess_load   ) << "</td>\n"
        << "</tr>\n"
        << "</table>\n"
        ;

    oss
        << "<hr>\n"
        << "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n"

        << "<tr align=\"right\">\n"
        << "<td valign=\"bottom\" width=\"14%\">" << ""           << " </td>\n"
        << "<td valign=\"bottom\" width=\"14%\">" << "initial"    << " </td>\n"
        << "<td valign=\"bottom\" width=\"14%\">" << "incr"       << " </td>\n"
        << "<td valign=\"bottom\" width=\"14%\">" << "decr"       << " </td>\n"
        << "<td valign=\"bottom\" width=\"14%\">" << "nec_prem"   << " </td>\n"
        << "<td valign=\"bottom\" width=\"14%\">" << "MC"         << " </td>\n"
        << "<td valign=\"bottom\" width=\"14%\">" << "unnec_prem" << " </td>\n"
        << "</tr>\n"

        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "benefit"                   << "</td>\n"
        << "<td nowrap>" << f(C0_init_bft       ) << "</td>\n"
        << "<td nowrap>" << f(D0_incr_bft       ) << "</td>\n"
        << "<td nowrap>" << f(E0_decr_bft       ) << "</td>\n"
        << "<td nowrap>" << f(F0_nec_pm_bft     ) << "</td>\n"
        << "<td nowrap>" << f(G0_do_mc_bft      ) << "</td>\n"
        << "<td nowrap>" << f(H0_unnec_pm_bft   ) << "</td>\n"
        << "</tr>\n"

        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "LDB"                       << "</td>\n"
        << "<td nowrap>" << f(C1_init_ldb       ) << "</td>\n"
        << "<td nowrap>" << f(D1_incr_ldb       ) << "</td>\n"
        << "<td nowrap>" << f(E1_decr_ldb       ) << "</td>\n"
        << "<td nowrap>" << f(F1_nec_pm_ldb     ) << "</td>\n"
        << "<td nowrap>" << f(G1_do_mc_ldb      ) << "</td>\n"
        << "<td nowrap>" << f(H1_unnec_pm_ldb   ) << "</td>\n"
        << "</tr>\n"

        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "amts pd"                   << "</td>\n"
        << "<td nowrap>" << f(C2_init_amt_pd    ) << "</td>\n"
        << "<td nowrap>" << f(D2_incr_amt_pd    ) << "</td>\n"
        << "<td nowrap>" << f(E2_decr_amt_pd    ) << "</td>\n"
        << "<td nowrap>" << f(F2_nec_pm_amt_pd  ) << "</td>\n"
        << "<td nowrap>" << f(G2_do_mc_amt_pd   ) << "</td>\n"
        << "<td nowrap>" << f(H2_unnec_pm_amt_pd) << "</td>\n"
        << "</tr>\n"

        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "MC"                        << "</td>\n"
        << "<td nowrap>" << f(C3_init_is_mc     ) << "</td>\n"
        << "<td nowrap>" << f(D3_incr_is_mc     ) << "</td>\n"
        << "<td nowrap>" << f(E3_decr_is_mc     ) << "</td>\n"
        << "<td nowrap>" << f(F3_nec_pm_is_mc   ) << "</td>\n"
        << "<td nowrap>" << f(G3_do_mc_is_mc    ) << "</td>\n"
        << "<td nowrap>" << f(H3_unnec_pm_is_mc ) << "</td>\n"
        << "</tr>\n"

        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "DCV"                       << "</td>\n"
        << "<td nowrap>" << f(C4_init_dcv       ) << "</td>\n"
        << "<td nowrap>" << f(D4_incr_dcv       ) << "</td>\n"
        << "<td nowrap>" << f(E4_decr_dcv       ) << "</td>\n"
        << "<td nowrap>" << f(F4_nec_pm_dcv     ) << "</td>\n"
        << "<td nowrap>" << f(G4_do_mc_dcv      ) << "</td>\n"
        << "<td nowrap>" << f(H4_unnec_pm_dcv   ) << "</td>\n"
        << "</tr>\n"

        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "7PP"                       << "</td>\n"
        << "<td nowrap>" << f(C5_init_px7       ) << "</td>\n"
        << "<td nowrap>" << f(D5_incr_px7       ) << "</td>\n"
        << "<td nowrap>" << f(E5_decr_px7       ) << "</td>\n"
        << "<td nowrap>" << f(F5_nec_pm_px7     ) << "</td>\n"
        << "<td nowrap>" << f(G5_do_mc_px7      ) << "</td>\n"
        << "<td nowrap>" << f(H5_unnec_pm_px7   ) << "</td>\n"
        << "</tr>\n"

        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "MEC"                       << "</td>\n"
        << "<td nowrap>" << f(C6_init_mec       ) << "</td>\n"
        << "<td nowrap>" << f(D6_incr_mec       ) << "</td>\n"
        << "<td nowrap>" << f(E6_decr_mec       ) << "</td>\n"
        << "<td nowrap>" << f(F6_nec_pm_mec     ) << "</td>\n"
        << "<td nowrap>" << f(G6_do_mc_mec      ) << "</td>\n"
        << "<td nowrap>" << f(H6_unnec_pm_mec   ) << "</td>\n"
        << "</tr>\n"

        << "</table>\n"
        ;

    oss
        << "<hr>\n"
        << "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n"
        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "net 1035 amount"              << "</td>\n"
        << "<td nowrap>" << f(Q0_net_1035          ) << "</td>\n"
        << "</tr>\n"
        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "net max necessary premium"    << "</td>\n"
        << "<td nowrap>" << f(Q1_max_nec_prem_net  ) << "</td>\n"
        << "</tr>\n"
        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "gross max necessary premium"  << "</td>\n"
        << "<td nowrap>" << f(Q2_max_nec_prem_gross) << "</td>\n"
        << "</tr>\n"
        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "CV before last MC"            << "</td>\n"
        << "<td nowrap>" << f(Q3_cv_before_last_mc ) << "</td>\n"
        << "</tr>\n"
        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "cumulative seven-pay premium" << "</td>\n"
        << "<td nowrap>" << f(Q4_cum_px7           ) << "</td>\n"
        << "</tr>\n"
        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "cumulative amounts paid"      << "</td>\n"
        << "<td nowrap>" << f(Q5_cum_amt_pd        ) << "</td>\n"
        << "</tr>\n"
        << "<tr align=\"right\">\n"
        << "<td nowrap>" << "max non-MEC premium"          << "</td>\n"
        << "<td nowrap>" << f(Q6_max_non_mec_prem  ) << "</td>\n"
        << "</tr>\n"
        << "</table>\n"
        ;

    oss
        << "</body>\n"
        << "</html>\n"
        ;

    return oss.str();
}