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

📄 htmlutil.cpp

📁 Wxpython Implemented on Windows CE, Source code
💻 CPP
📖 第 1 页 / 共 5 页
字号:
  case ltCOPYRIGHT:
  {
    if (start)
      TexOutput(_T("©"), true);
    break;
  }
  case ltREGISTERED:
  {
    if (start)
      TexOutput(_T("®"), true);
    break;
  }
  // Arrows
  case ltLEFTARROW:
  {
    if (start) TexOutput(_T("<--"));
    break;
  }
  case ltLEFTARROW2:
  {
    if (start) TexOutput(_T("<=="));
    break;
  }
  case ltRIGHTARROW:
  {
      if (start) TexOutput(_T("-->"));
      break;
  }
  case ltRIGHTARROW2:
  {
    if (start) TexOutput(_T("==>"));
    break;
  }
  case ltLEFTRIGHTARROW:
  {
    if (start) TexOutput(_T("<-->"));
    break;
  }
  case ltLEFTRIGHTARROW2:
  {
    if (start) TexOutput(_T("<==>"));
    break;
  }
/*
  case ltSC:
  {
    break;
  }
*/
  case ltITEM:
  {
    if (!start)
    {
      wxNode *node = itemizeStack.GetFirst();
      if (node)
      {
        ItemizeStruc *struc = (ItemizeStruc *)node->GetData();
        struc->currentItem += 1;
        if (struc->listType == LATEX_DESCRIPTION)
        {
          if (descriptionItemArg)
          {
            TexOutput(_T("<DT> "));
            TraverseChildrenFromChunk(descriptionItemArg);
            TexOutput(_T("\n"));
            descriptionItemArg = NULL;
          }
          TexOutput(_T("<DD>"));
        }
        else
          TexOutput(_T("<LI>"));
      }
    }
    break;
  }
  case ltMAKETITLE:
  {
    if (start && DocumentTitle && DocumentAuthor)
    {
      // Add a special label for the contents page.
//      TexOutput(_T("<CENTER>\n"));
      TexOutput(_T("<A NAME=\"contents\">"));
      TexOutput(_T("<H2 ALIGN=CENTER>\n"));
      TraverseChildrenFromChunk(DocumentTitle);
      TexOutput(_T("</H2>"));
      TexOutput(_T("<P>"));
      TexOutput(_T("</A>\n"));
      TexOutput(_T("<P>\n\n"));
      TexOutput(_T("<H3 ALIGN=CENTER>"));
      TraverseChildrenFromChunk(DocumentAuthor);
      TexOutput(_T("</H3><P>\n\n"));
      if (DocumentDate)
      {
        TexOutput(_T("<H3 ALIGN=CENTER>"));
        TraverseChildrenFromChunk(DocumentDate);
        TexOutput(_T("</H3><P>\n\n"));
      }
//      TexOutput(_T("\n</CENTER>\n"));
      TexOutput(_T("\n<P><HR><P>\n"));

/*
      // Now do optional frame contents page
      if (htmlFrameContents && FrameContents)
      {
        SetCurrentOutput(FrameContents);

        // Add a special label for the contents page.
        TexOutput(_T("<CENTER>\n"));
        TexOutput(_T("<H3>\n"));
        TraverseChildrenFromChunk(DocumentTitle);
        TexOutput(_T("</H3>"));
        TexOutput(_T("<P>"));
        TexOutput(_T("</A>\n"));
        TexOutput(_T("<P>\n\n"));
        TexOutput(_T("<H3>"));
        TraverseChildrenFromChunk(DocumentAuthor);
        TexOutput(_T("</H3><P>\n\n"));
        if (DocumentDate)
        {
          TexOutput(_T("<H4>"));
          TraverseChildrenFromChunk(DocumentDate);
          TexOutput(_T("</H4><P>\n\n"));
        }
        TexOutput(_T("\n</CENTER>\n"));
        TexOutput(_T("<P><HR><P>\n"));

        SetCurrentOutput(Titlepage);
      }
*/
    }
    break;
  }
  case ltHELPREF:
  case ltHELPREFN:
  case ltPOPREF:
  case ltURLREF:
  {
    if (start)
    {
      helpRefFilename = NULL;
      helpRefText = NULL;
    }
    break;
  }
  case ltBIBLIOGRAPHY:
  {
    if (start)
    {
      DefaultOnMacro(macroId, no_args, start);
    }
    else
    {
      DefaultOnMacro(macroId, no_args, start);
      TexOutput(_T("</DL>\n"));
    }
    break;
  }
  case ltHRULE:
  {
    if (start)
    {
      TexOutput(_T("<HR>\n"));
    }
    break;
  }
  case ltRULE:
  {
    if (start)
    {
      TexOutput(_T("<HR>\n"));
    }
    break;
  }
  case ltTABLEOFCONTENTS:
  {
    if (start)
    {
      // NB: if this is uncommented, the table of contents
      // completely disappears. If left commented, it's in the wrong
      // place.
      //fflush(Titlepage);

      FILE *fd = wxFopen(ContentsName, _T("r"));
      if (fd)
      {
        int ch = getc(fd);
        while (ch != EOF)
        {
          wxPutc(ch, Titlepage);
          ch = getc(fd);
        }
        fclose(fd);
        fflush(Titlepage);
      }
      else
      {
        TexOutput(_T("RUN TEX2RTF AGAIN FOR CONTENTS PAGE\n"));
        OnInform(_T("Run Tex2RTF again to include contents page."));
      }
    }
    break;
  }
  case ltLANGLEBRA:
  {
    if (start)
      TexOutput(_T("&lt;"));
    break;
  }
  case ltRANGLEBRA:
  {
    if (start)
      TexOutput(_T("&gt;"));
    break;
  }
  case ltQUOTE:
  case ltQUOTATION:
  {
    if (start)
      TexOutput(_T("<BLOCKQUOTE>"));
    else
      TexOutput(_T("</BLOCKQUOTE>"));
    break;
  }
  case ltCAPTION:
  case ltCAPTIONSTAR:
  {
    if (start)
    {
      if (inTabular)
        TexOutput(_T("\n<CAPTION>"));

      wxChar figBuf[40];

      if ( inFigure )
      {
          figureNo ++;

          if (DocumentStyle != LATEX_ARTICLE)
            wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d.%d: "), FigureNameString, chapterNo, figureNo);
          else
            wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d: "), FigureNameString, figureNo);
      }
      else
      {
          tableNo ++;

          if (DocumentStyle != LATEX_ARTICLE)
            wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d.%d: "), TableNameString, chapterNo, tableNo);
          else
            wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d: "), TableNameString, tableNo);
      }

      TexOutput(figBuf);
    }
    else
    {
      if (inTabular)
        TexOutput(_T("\n</CAPTION>\n"));

      wxChar *topicName = FindTopicName(GetNextChunk());

      int n = inFigure ? figureNo : tableNo;

      AddTexRef(topicName, NULL, NULL,
           ((DocumentStyle != LATEX_ARTICLE) ? chapterNo : n),
            ((DocumentStyle != LATEX_ARTICLE) ? n : 0));
    }
    break;
  }
  case ltSS:
  {
    if (start) TexOutput(_T("&szlig;"));
    break;
  }
  case ltFIGURE:
  {
    if (start) inFigure = true;
    else inFigure = false;
    break;
  }
  case ltTABLE:
  {
    if (start) inTable = true;
    else inTable = false;
    break;
  }
  default:
    DefaultOnMacro(macroId, no_args, start);
    break;
  }
}
/*     CheckTypeRef()

       should be called at of argument which usually is
       type declaration which propably contains name of
       documented class

       examples:
               HTMLOnArgument
                       - ltFUNC,
                       - ltPARAM
                       - ltCPARAM

       checks: GetArgData() if contains Type Declaration
                               and can be referenced to some file
       prints:
               before<a href="xxx&yyy">type</a>after

       returns:
               false   - if no reference was found
               true    - if reference was found and HREF printed
*/
static bool CheckTypeRef()
{
  wxString typeDecl = GetArgData();
  if( !typeDecl.empty() ) {
    typeDecl.Replace(wxT("\\"),wxT(""));
    wxString label = typeDecl;
    label.Replace(wxT("const"),wxT(""));
    label.Replace(wxT("virtual"),wxT(""));
    label.Replace(wxT("static"),wxT(""));
    label.Replace(wxT("extern"),wxT(""));
    label = label.BeforeFirst('&');
    label = label.BeforeFirst(wxT('*'));
    label = label.BeforeFirst(wxT('\\'));
    label.Trim(true); label.Trim(false);
    wxString typeName = label;
    label.MakeLower();
    TexRef *texRef = FindReference((wxChar*)label.c_str());

    if (texRef && texRef->refFile && wxStrcmp(texRef->refFile, _T("??")) != 0) {
      int a = typeDecl.Find(typeName);
      wxString before = typeDecl.Mid( 0, a );
      wxString after = typeDecl.Mid( a+typeName.Length() );
      //wxFprintf(stderr,wxT("%s <%s> %s to ... %s#%s !!!!\n"),
       //      before.c_str(),
       //      typeName.c_str(),
       //      after.c_str(),
       //      texRef->refFile,label.c_str());
      TexOutput(before);
      TexOutput(_T("<A HREF=\""));
      TexOutput(texRef->refFile);
      TexOutput(_T("#"));
      TexOutput(label);
      TexOutput(wxT("\">"));
      TexOutput(typeName);
      TexOutput(wxT("</A>"));
      TexOutput(after);
      return true;
    } else {
      //wxFprintf(stderr,wxT("'%s' from (%s) -> label %s NOT FOUND\n"),
       //      typeName.c_str(),
       //      typeDecl.c_str(),
       //      label.c_str());
      return false;
    }
  }
  return false;
}
// Called on start/end of argument examination
bool HTMLOnArgument(int macroId, int arg_no, bool start)
{
  switch (macroId)
  {
  case ltCHAPTER:
  case ltCHAPTERSTAR:
  case ltCHAPTERHEADING:
  case ltSECTION:
  case ltSECTIONSTAR:
  case ltSECTIONHEADING:
  case ltSUBSECTION:
  case ltSUBSECTIONSTAR:
  case ltSUBSUBSECTION:
  case ltSUBSUBSECTIONSTAR:
  case ltGLOSS:
  case ltMEMBERSECTION:
  case ltFUNCTIONSECTION:
  {
    if (!start && (arg_no == 1))
      currentSection = GetArgChunk();
    return false;
  }
  case ltFUNC:
  {
    if (start && (arg_no == 1)) {
      TexOutput(_T("<B>"));
      if( CheckTypeRef() ) {
       TexOutput(_T("</B> "));
       return false;
      }
    }

    if (!start && (arg_no == 1))
      TexOutput(_T("</B> "));

    if (start && (arg_no == 2))
    {
      if (!suppressNameDecoration) TexOutput(_T("<B>"));
      currentMember = GetArgChunk();
    }
    if (!start && (arg_no == 2))
    {
      if (!suppressNameDecoration) TexOutput(_T("</B>"));
    }

    if (start && (arg_no == 3))
      TexOutput(_T("("));
    if (!start && (arg_no == 3))
     TexOutput(_T(")"));
   break;
  }
  case ltCLIPSFUNC:
  {
    if (start && (arg_no == 1))
      TexOutput(_T("<B>"));
    if (!start && (arg_no == 1))
      TexOutput(_T("</B> "));

    if (start && (arg_no == 2))
    {
      if (!suppressNameDecoration) TexOutput(_T("( "));
      currentMember = GetArgChunk();
    }
    if (!start && (arg_no == 2))
    {
    }

    if (!start && (arg_no == 3))
     TexOutput(_T(")"));
    break;
  }
  case ltPFUNC:
  {
    if (!start && (arg_no == 1))
      TexOutput(_T(" "));

    if (start && (arg_no == 2))
      TexOutput(_T("(*"));
    if (!start && (arg_no == 2))
      TexOutput(_T(")"));

    if (start && (arg_no == 2))
      currentMember = GetArgChunk();

    if (start && (arg_no == 3))
      TexOutput(_T("("));
    if (!start && (arg_no == 3))
      TexOutput(_T(")"));
    break;
  }
  case ltPARAM:
  case ltCPARAM:
  {
    const wxChar* pend = macroId == ltCPARAM ?
       _T("</B> ") : _T("</B>");
    if( arg_no == 1) {
      if( start ) {
       TexOutput(_T("<B>"));
       if( CheckTypeRef() ) {
         TexOutput(pend);
         return false;
       }
      } else {
       TexOutput(pend);
      }
    }
    if (start && (arg_no == 2))
    {
      TexOutput(_T("<I>"));
    }
    if (!start && (arg_no == 2))
    {
      TexOutput(_T("</I>"));
    }
    break;
  }
  case ltMEMBER:
  {
    if (!start && (arg_no == 1))
      TexOutput(_T(" "));

    if (start && (arg_no == 2))
      currentMember = GetArgChunk();
    break;
  }
  case ltREF:
  {
    if (start)
    {
      wxChar *sec = NULL;

      wxChar *refName = GetArgData();
      if (refName)
      {
        TexRef *texRef = FindReference(refName);
        if (texRef)
        {
          sec = texRef->sectionNumber;
        }
      }
      if (sec)
      {
        TexOutput(sec);

⌨️ 快捷键说明

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