(P)) {
    // Get the string and determining its maximum substring.
    const std::string& Msg = P.getString();
    unsigned max_token = 0;
    unsigned cnt = 0;
    unsigned len = Msg.size();
    for (std::string::const_iterator I=Msg.begin(), E=Msg.end(); I!=E; ++I)
      switch (*I) {
        default:
          ++cnt;
          continue;
        case ' ':
        case '\t':
        case '\n':
          if (cnt > max_token) max_token = cnt;
          cnt = 0;
      }
    if (cnt > max_token)
      max_token = cnt;
    // Determine the approximate size of the message bubble in em.
    unsigned em;
    const unsigned max_line = 120;
    if (max_token >= max_line)
      em = max_token / 2;
    else {
      unsigned characters = max_line;
      unsigned lines = len / max_line;
      if (lines > 0) {
        for (; characters > max_token; --characters)
          if (len / characters > lines) {
            ++characters;
            break;
          }
      }
      em = characters / 2;
    }
    if (em < max_line/2)
      os << "; max-width:" << em << "em";
  }
  else
    os << "; max-width:100em";
  os << "\">";
  if (max > 1) {
    os << "
| ";
    os << " " << num << "";
    os << " | ";
  }
  if (const PathDiagnosticMacroPiece *MP =
        dyn_cast(&P)) {
    os << "Within the expansion of the macro '";
    // Get the name of the macro by relexing it.
    {
      FullSourceLoc L = MP->getLocation().asLocation().getInstantiationLoc();
      assert(L.isFileID());
      std::pair BufferInfo = L.getBufferData();
      const char* MacroName = L.getDecomposedLoc().second + BufferInfo.first;
      Lexer rawLexer(L, PP.getLangOptions(), BufferInfo.first,
                     MacroName, BufferInfo.second);
      Token TheTok;
      rawLexer.LexFromRawLexer(TheTok);
      for (unsigned i = 0, n = TheTok.getLength(); i < n; ++i)
        os << MacroName[i];
    }
    os << "':\n";
    if (max > 1)
      os << " | 
";
    // Within a macro piece.  Write out each event.
    ProcessMacroPiece(os, *MP, 0);
  }
  else {
    os << html::EscapeText(P.getString());
    if (max > 1)
      os << "