Examples of AsciiMathBlockValue


Examples of fi.celia.asciimath.AsciiMathBlockValue

          String inputAsciiMathText;
         
          StringBuffer sb = new StringBuffer();
          int iCount = 0, max = arrAMBlock.length;
          AsciiMathBlockValue amValue;
         
          // collect all asciimath calculus data into one stringbuffer
          // and mark every asciimath blocks with special mark string,
          // that is possible to find these special labeled asciimath
          // positions later. At later time, generated asciimath-xml
          // blocks will replaced <asciimath> and </asciimath> blocks.
          for(int i = 0; i < max; i++)
          {
            amValue = arrAMBlock[i];
            // to much strings: class="asciimath">
            inputAsciiMathText = amValue.getAsciiMathValue();
            //inputAsciiMathText = inputAsciiMathText.substring("class=\"asciimath\">".length());
            sb.append("x_" + iCount + cnstMarkBegin + inputAsciiMathText + "x_" + iCount +cnstMarkEnd +"\n");
            iCount++;         
          }
         
View Full Code Here

Examples of fi.celia.asciimath.AsciiMathBlockValue

    NullPointerException,
    Exception
    {
      File modifiedFile = null;
      modifiedFile = new File(exeXmlFileName);
      AsciiMathBlockValue amValue;
         
      //String strMuutettuFileData = new String(muutettuFile.readBytes());
      System.out.println( "modifiedFile.lastModified()=" + modifiedFile.lastModified());
      System.out.println( "modifiedFile.size()=" + modifiedFile.length());
      //System.out.println( "strMuutettuFileData");
      //System.out.println( strMuutettuFileData);
      System.out.println();
     
      long modifiedFile_length = modifiedFile.length();
      if (modifiedFile_length == outputFileSize)
        throw new DtbookAsciiMathException("Unmodified file! The size of file is same: " +outputFileSize
            +"\nUser has not saved a generated asciimath editor file by the browser!");
     
      System.out.println( "Reading and handling just saved file....");       
      String strMuutettuFileData = readFileData(modifiedFile, charsetName);

      //strMuutettuFileData = korjaaPuuttuvaMetaTag(strMuutettuFileData);
      String strMathMlData = null; // getMathMlData(strMuutettuFileData);
     
      //stMarkBegin cnstMarkEnd
      int iCount = 0, max = arrAMBlock.length;
      StringBuffer sb = new StringBuffer();
      String inputAsciiMathText2;
      String search_start;
      String search_end;
      String strFound;
      int indBegin, indBegin_end, indEnd;
       
      // selecting/searching read modified data and collection every value
      // into back asciimath data block:
        for(int i = 0; i < max; i++)
        {
          amValue = arrAMBlock[i];
        // liika mjonoa: class="asciimath">
        // inputAsciiMathText2 = getXmlAsciiMathValue(iCount, strMuutettuFileData)
        search_start = "x_" + iCount + cnstMarkBegin;
        search_end = "x_" + iCount + cnstMarkEnd;   
        indBegin = strMuutettuFileData.indexOf(search_start);
        if (indBegin == -1)
          continue;
        indBegin_end = indBegin + search_start.length();
        strFound = strMuutettuFileData.substring(indBegin);
        indBegin = strMuutettuFileData.indexOf(search_start, indBegin_end);
        if (indBegin == -1)
          continue;
        indBegin_end = indBegin + search_start.length();
        indBegin = strMuutettuFileData.indexOf(search_start, indBegin_end);
        if (indBegin == -1)
          continue;
        indBegin_end = indBegin + search_start.length();
        indEnd = strMuutettuFileData.indexOf(search_end, indBegin);   
        if (indBegin == -1)
          continue;
        if (indEnd == -1)
          continue;
        inputAsciiMathText2 = strMuutettuFileData.substring(indBegin_end, indEnd);

        // replace html asciimath characters and words into normal characters:
       
        inputAsciiMathText2 = inputAsciiMathText2.replaceAll("&lt;", "<");
        inputAsciiMathText2 = inputAsciiMathText2.replaceAll("&#60;", "<");
        inputAsciiMathText2 = inputAsciiMathText2.replaceAll("&#x3c;", "<");
        // replace all html coded > character into normal > characer
        inputAsciiMathText2 = inputAsciiMathText2.replaceAll("&gt;", ">");
        inputAsciiMathText2 = inputAsciiMathText2.replaceAll("&#62;", ">");       
        inputAsciiMathText2 = inputAsciiMathText2.replaceAll("&#x3e;", ">");
        // replace possible &amp; into & character:
        inputAsciiMathText2 = inputAsciiMathText2.replaceAll("&amp;", "&");
        // take away unneede and unxml attribute: <m:mtd -moz-math-columnalign="left">
        inputAsciiMathText2 = inputAsciiMathText2.replaceAll("-moz-math-columnalign=\"left\"", "");         
        inputAsciiMathText2 = inputAsciiMathText2.replaceAll("<m:mtd >", "<m:mtd>");
        inputAsciiMathText2 = inputAsciiMathText2.replaceAll("<m:mspace>\\s*</m:mspace>", "<m:mspace/>");
        inputAsciiMathText2 = inputAsciiMathText2.replaceAll(
            "<(\\s*)mspace((\\s+\\S+\\s*=\\s*\\S+\\s*)+)>\\s*<(\\s*)/(\\s*)mspace(\\s*)>",
            "<mspace$2/>");
       
        /** TODO: Handle: & character in:
        <m:math xmlns:dtbook="http://www.daisy.org/z3986/2005/dtbook/" altimg="" alttext="& lt lt A lt rArr lt B lt">
        inputAsciiMathText2 = replaceETCharsInAsciiMath(inputAsciiMathText2);
        */
        amValue.setXmlValue(inputAsciiMathText2);
        amValue.setModifiedXmlValue(getModifiedXmlValue(inputAsciiMathText2));
        // collect textual data into a caller buffer:
        sb.append("" + iCount + ":\n Row: " + amValue.getRow() +" Column: " + amValue.getColumn() + "\n\n");
        sb.append("" + ":\n"+  amValue.getModifiedXmlValue() + "\n\n");
        iCount++;
      }
     
      // sb.append strMuutettuFileData
      strMathMlData = sb.toString();
View Full Code Here

Examples of fi.celia.asciimath.AsciiMathBlockValue

        return null;
      if (arrAMBlock.length == 0)
        return m_strDtbookData;
     
      int iCount = 0;
      AsciiMathBlockValue amValue;
      int max = arrAMBlock.length, start,
          end, previousEnd = 0,
          spanEndLen = "</span>".length(),
          indSearchSpan;
      StringBuffer sb = new StringBuffer();
      String strStart, strEnd, strEnd2, strEnd3;     
     
        for(int i = 0; i < max; i++)
        {
          amValue = arrAMBlock[i];
        if (amValue == null)
          continue;
        start = amValue.getIndFound();
        end   = amValue.getIndFoundEnd();
        strStart = m_strDtbookData.substring(previousEnd, start);
        sb.append(strStart);
        sb.append(amValue.getModifiedXmlValue());
        indSearchSpan = m_strDtbookData.indexOf("</span>", end);       
        previousEnd = (end +spanEndLen);
        if (indSearchSpan != -1 && previousEnd != indSearchSpan)
          previousEnd = (indSearchSpan +spanEndLen) ;
        strEnd = m_strDtbookData.substring(end);
View Full Code Here

Examples of fi.celia.asciimath.AsciiMathBlockValue

      boolean bAddBrowserStrikes)
  throws DtbookAsciiMathException, NullPointerException
  {
    boolean bCorrectStrikeErrors = true;
    boolean bCheckStrikeErrors = true;
    AsciiMathBlockValue test1 = new AsciiMathBlockValue(value,  
      0, 0, 0, 0, 0, 0, bCheckStrikeErrors, bCorrectStrikeErrors,
      bAddBrowserStrikes);
    if (test1 == null)
      throw new NullPointerException("AsciiMathBlockValue is null!");
   
    String test1_asciimathValue = test1.getAsciiMathValue();
    if (test1_asciimathValue == null)
      throw new NullPointerException("test1.getAsciiMathValue() is null!");
   
    if (!strCompare.equals(test1_asciimathValue))
    {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.