⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 htmlutil.cpp

📁 Wxpython Implemented on Windows CE, Source code
💻 CPP
📖 第 1 页 / 共 5 页
字号:
      }
      else
      {
        if (macroId != ltSUBSUBSECTIONSTAR)
          subsubsectionNo ++;

        startedSections = true;

        wxChar *topicName = FindTopicName(GetNextChunk());

        if ( !combineSubSections )
        {
            SetCurrentOutput(NULL);
            ReopenFile(&Subsubsections, &SubsubsectionsName, topicName);
            AddTexRef(topicName, SubsubsectionsName, SubsubsectionNameString);
            SetCurrentSubsubsectionName(topicName, SubsubsectionsName);
            if (htmlWorkshopFiles) HTMLWorkshopAddToContents(3, topicName, SubsubsectionsName);

            SetCurrentOutput(Subsubsections);
            HTMLHead();
            TexOutput(_T("<title>"));
            OutputCurrentSection();
            TexOutput(_T("</title></head>\n"));
            OutputBodyStart();

            wxFprintf(Subsubsections, _T("<A NAME=\"%s\"></A>"), topicName);

            AddBrowseButtons(CurrentSubsectionName, CurrentSubsectionFile, // Up
                         lastTopic, lastFileName,  // Last topic
                         topicName, SubsubsectionsName); // This topic

            SetCurrentOutputs(Subsections, Subsubsections);
            if(PrimaryAnchorOfTheFile(SubsubsectionsName, topicName))
              wxFprintf(Subsections, _T("\n<A HREF=\"%s\"><B>"), ConvertCase(SubsubsectionsName));
            else
              wxFprintf(Subsections, _T("\n<A HREF=\"%s#%s\"><B>"), ConvertCase(SubsubsectionsName), topicName);

            wxFprintf(Subsubsections, _T("\n<H3>"));
            OutputCurrentSection();
            wxFprintf(Subsections, _T("</B></A><BR>\n"));
            wxFprintf(Subsubsections, _T("</H3>\n"));
        }
        else
        {
            AddTexRef(topicName, SectionsName, SubsubsectionNameString);
            SetCurrentSubsectionName(topicName, SectionsName);
            wxFprintf(Sections, _T("\n<HR>\n"));

            // We're putting everything into the section file
            wxFprintf(Sections, _T("<A NAME=\"%s\"></A>"), topicName);
            wxFprintf(Sections, _T("\n<H3>"));
            OutputCurrentSection();
            wxFprintf(Sections, _T("</H3>\n"));
/* TODO: where do we put subsubsection contents entry - indented, with subsection entries?
            SetCurrentOutput(SectionContentsFD);
            wxFprintf(SectionContentsFD, "<A HREF=\"#%s\">", topicName);
            OutputCurrentSection();
            TexOutput(_T("</A><BR>"));
*/
            if (htmlWorkshopFiles) HTMLWorkshopAddToContents(2, topicName, SectionsName);
            SetCurrentOutput(Sections);
        }

        // Add this section title to the list of keywords
        if (htmlIndex)
        {
          OutputCurrentSectionToString(wxTex2RTFBuffer);
          AddKeyWordForTopic(topicName, wxTex2RTFBuffer, currentFileName);
        }
      }
    }
    break;
  }
  case ltFUNC:
  case ltPFUNC:
  {
    if ( !combineSubSections )
        SetCurrentOutput(Subsections);
    else
        SetCurrentOutput(Sections);
    if (start)
    {
    }
    else
    {
    }
    break;
  }
  case ltCLIPSFUNC:
  {
    if ( !combineSubSections )
        SetCurrentOutput(Subsections);
    else
        SetCurrentOutput(Sections);
    if (start)
    {
    }
    else
    {
    }
    break;
  }
  case ltMEMBER:
  {
    if ( !combineSubSections )
        SetCurrentOutput(Subsections);
    else
        SetCurrentOutput(Sections);
    if (start)
    {
    }
    else
    {
    }
    break;
  }
  case ltVOID:
//    if (start)
//      TexOutput(_T("<B>void</B>"));
    break;
  case ltHARDY:
    if (start)
      TexOutput(_T("HARDY"));
    break;
  case ltWXCLIPS:
    if (start)
      TexOutput(_T("wxCLIPS"));
    break;
  case ltAMPERSAND:
    if (start)
      TexOutput(_T("&amp;"));
    break;
  case ltSPECIALAMPERSAND:
  {
    if (start)
    {
      if (inTabular)
      {
        // End cell, start cell

        TexOutput(_T("</FONT></TD>"));

        // Start new row and cell, setting alignment for the first cell.
        if (currentColumn < noColumns)
          currentColumn ++;

        wxChar buf[100];
        if (TableData[currentColumn].justification == 'c')
          wxSnprintf(buf, sizeof(buf), _T("\n<TD ALIGN=CENTER>"));
        else if (TableData[currentColumn].justification == 'r')
          wxSnprintf(buf, sizeof(buf), _T("\n<TD ALIGN=RIGHT>"));
        else if (TableData[currentColumn].absWidth)
        {
          // Convert from points * 20 into pixels.
          int points = TableData[currentColumn].width / 20;

          // Say the display is 100 DPI (dots/pixels per inch).
          // There are 72 pts to the inch. So 1pt = 1/72 inch, or 100 * 1/72 dots.
          int pixels = (int)(points * 100.0 / 72.0);
          wxSnprintf(buf, sizeof(buf), _T("<TD ALIGN=CENTER WIDTH=%d>"), pixels);
        }
        else
          wxSnprintf(buf, sizeof(buf), _T("\n<TD ALIGN=LEFT>"));
        TexOutput(buf);
        OutputFont();
      }
      else
        TexOutput(_T("&amp;"));
    }
    break;
  }
  case ltBACKSLASHCHAR:
  {
    if (start)
    {
      if (inTabular)
      {
        // End row. In fact, tables without use of \row or \ruledrow isn't supported for
        // HTML: the syntax is too different (e.g. how do we know where to put the first </TH>
        // if we've ended the last row?). So normally you wouldn't use \\ to end a row.
        TexOutput(_T("</TR>\n"));
      }
      else
        TexOutput(_T("<BR>\n"));
    }
    break;
  }
  case ltROW:
  case ltRULEDROW:
  {
    if (start)
    {
      currentColumn = 0;

      // Start new row and cell, setting alignment for the first cell.
      wxChar buf[100];
      if (TableData[currentColumn].justification == 'c')
        wxSnprintf(buf, sizeof(buf), _T("<TR>\n<TD ALIGN=CENTER>"));
      else if (TableData[currentColumn].justification == 'r')
        wxSnprintf(buf, sizeof(buf), _T("<TR>\n<TD ALIGN=RIGHT>"));
      else if (TableData[currentColumn].absWidth)
      {
        // Convert from points * 20 into pixels.
        int points = TableData[currentColumn].width / 20;

        // Say the display is 100 DPI (dots/pixels per inch).
        // There are 72 pts to the inch. So 1pt = 1/72 inch, or 100 * 1/72 dots.
        int pixels = (int)(points * 100.0 / 72.0);
        wxSnprintf(buf, sizeof(buf), _T("<TR>\n<TD ALIGN=CENTER WIDTH=%d>"), pixels);
      }
      else
        wxSnprintf(buf, sizeof(buf), _T("<TR>\n<TD ALIGN=LEFT>"));
      TexOutput(buf);
      OutputFont();
    }
    else
    {
      // End cell and row
      // Start new row and cell
      TexOutput(_T("</FONT></TD>\n</TR>\n"));
    }
    break;
  }
  // HTML-only: break until the end of the picture (both margins are clear).
  case ltBRCLEAR:
  {
    if (start)
      TexOutput(_T("<BR CLEAR=ALL>"));
    break;
  }
  case ltRTFSP:  // Explicit space, RTF only
    break;
  case ltSPECIALTILDE:
  {
    if (start)
    {
      #if (1) // if(inVerbatim)
        TexOutput(_T("~"));
      #else
        TexOutput(_T(" "));
      #endif
    }
    break;
  }
  case ltINDENTED :
  {
    if ( start )
        TexOutput(_T("<UL><UL>\n"));
    else
        TexOutput(_T("</UL></UL>\n"));
    break;
  }
  case ltITEMIZE:
  case ltENUMERATE:
  case ltDESCRIPTION:
//  case ltTWOCOLLIST:
  {
    if (start)
    {
      indentLevel ++;

      int listType;
      if (macroId == ltENUMERATE)
        listType = LATEX_ENUMERATE;
      else if (macroId == ltITEMIZE)
        listType = LATEX_ITEMIZE;
      else
        listType = LATEX_DESCRIPTION;

      itemizeStack.Insert(new ItemizeStruc(listType));
      switch (listType)
      {
        case LATEX_ITEMIZE:
          TexOutput(_T("<UL>\n"));
          break;
        case LATEX_ENUMERATE:
          TexOutput(_T("<OL>\n"));
          break;
        case LATEX_DESCRIPTION:
        default:
          TexOutput(_T("<DL>\n"));
          break;
      }
    }
    else
    {
      indentLevel --;
      if (itemizeStack.GetFirst())
      {
        ItemizeStruc *struc = (ItemizeStruc *)itemizeStack.GetFirst()->GetData();
        switch (struc->listType)
        {
          case LATEX_ITEMIZE:
            TexOutput(_T("</UL>\n"));
            break;
          case LATEX_ENUMERATE:
            TexOutput(_T("</OL>\n"));
            break;
          case LATEX_DESCRIPTION:
          default:
            TexOutput(_T("</DL>\n"));
            break;
        }

        delete struc;
        delete itemizeStack.GetFirst();
      }
    }
    break;
  }
  case ltTWOCOLLIST :
  {
    if ( start )
        TexOutput(_T("\n<TABLE>\n"));
    else {
        TexOutput(_T("\n</TABLE>\n"));
    // DHS
        TwoColWidthA = -1;
        TwoColWidthB = -1;
    }
    break;
  }
  case ltPAR:
  {
    if (start)
      TexOutput(_T("<P>\n"));
    break;
  }
/* For footnotes we need to output the text at the bottom of the page and
 * insert a reference to it. Is it worth the trouble...
  case ltFOOTNOTE:
  case ltFOOTNOTEPOPUP:
  {
    if (start)
    {
      TexOutput(_T("<FN>"));
    }
    else TexOutput(_T("</FN>"));
    break;
  }
*/
  case ltVERB:
  {
    if (start)
      TexOutput(_T("<TT>"));
    else TexOutput(_T("</TT>"));
    break;
  }
  case ltVERBATIM:
  {
    if (start)
    {
      wxChar buf[100];
      wxSnprintf(buf, sizeof(buf), _T("<PRE>\n"));
      TexOutput(buf);
    }
    else TexOutput(_T("</PRE>\n"));
    break;
  }
  case ltCENTERLINE:
  case ltCENTER:
  {
    if (start)
    {
      TexOutput(_T("<CENTER>"));
    }
    else TexOutput(_T("</CENTER>"));
    break;
  }
  case ltFLUSHLEFT:
  {
/*
    if (start)
    {
      TexOutput(_T("{\\ql "));
    }
    else TexOutput(_T("}\\par\\pard\n"));
*/
    break;
  }
  case ltFLUSHRIGHT:
  {
/*
    if (start)
    {
      TexOutput(_T("{\\qr "));
    }
    else TexOutput(_T("}\\par\\pard\n"));
*/
    break;
  }
  case ltSMALL:
  {
    if (start)
    {
      // Netscape extension
      TexOutput(_T("<FONT SIZE=2>"));
    }
    else TexOutput(_T("</FONT>"));
    break;
  }
  case ltTINY:
  {
    if (start)
    {
      // Netscape extension
      TexOutput(_T("<FONT SIZE=1>"));
    }
    else TexOutput(_T("</FONT>"));
    break;
  }
  case ltNORMALSIZE:
  {
    if (start)
    {
      // Netscape extension
      TexOutput(_T("<FONT SIZE=3>"));
    }
    else TexOutput(_T("</FONT>"));
    break;
  }
  case ltlarge:
  {
    if (start)
    {
      // Netscape extension
      TexOutput(_T("<FONT SIZE=4>"));
    }
    else TexOutput(_T("</FONT>"));
    break;
  }
  case ltLarge:
  {
    if (start)
    {
      // Netscape extension
      TexOutput(_T("<FONT SIZE=5>"));
    }
    else TexOutput(_T("</FONT>"));
    break;
  }
  case ltLARGE:
  {
    if (start)
    {
      // Netscape extension
      TexOutput(_T("<FONT SIZE=6>"));
    }
    else TexOutput(_T("</FONT>"));
    break;
  }
  case ltBFSERIES:
  case ltTEXTBF:
  case ltBF:
  {
    if (start)
    {
      TexOutput(_T("<B>"));
    }
    else TexOutput(_T("</B>"));
    break;
  }
  case ltITSHAPE:
  case ltTEXTIT:
  case ltIT:
  {
    if (start)
    {
      TexOutput(_T("<I>"));
    }
    else TexOutput(_T("</I>"));
    break;
  }
  case ltEMPH:
  case ltEM:
  {
    if (start)
    {
      TexOutput(_T("<EM>"));
    }
    else TexOutput(_T("</EM>"));
    break;
  }
  case ltUNDERLINE:
  {
    if (start)
    {
      TexOutput(_T("<UL>"));
    }
    else TexOutput(_T("</UL>"));
    break;
  }
  case ltTTFAMILY:
  case ltTEXTTT:
  case ltTT:
  {
    if (start)
    {
      TexOutput(_T("<TT>"));
    }
    else TexOutput(_T("</TT>"));
    break;
  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -