Example #1
0
    def testGetCacheLocation(self):
        vSource = ["Test A", "Line 1", "Word L", "Last"]
        vTarget = [" 1", "Word"]

        vCacheLocationStart = CacheLocation(1,4)
        vCacheLocationEnd = CacheLocation(2,4)
        vResult = CacheLocation.getCacheLocation(vSource, vCacheLocationStart, vCacheLocationEnd)

        self.assertEqual(vResult, vTarget)
Example #2
0
def translateOrgToHTMLTables(pCache):
    vNewCache = pCache
    vCacheRange = OrgParser.identifyOrgTable(vNewCache, CacheLocation.getZeroCacheLocation())
    while(vCacheRange.start != None and vCacheRange.start > CacheLocation.getZeroCacheLocation()):
        vOrgTablePart = CacheLocation.getCacheLocation(vNewCache, vCacheRange.start, vCacheRange.end)
        vOrgTable = OrgParser.parse(vOrgTablePart)
        vHTMLWriter = OrgTableHTMLWriter(vOrgTable)
        vCache = vHTMLWriter.parseHTML()
        vNewCache = CacheLocation.replaceCacheLocation(vNewCache, vCacheRange.start, vCacheRange.end, vCache)

        vOriginalLines = vCacheRange.end.getLineNum() - vCacheRange.start.getLineNum()
        vNewLines = len(vCache)
        vDifference = vNewLines - vOriginalLines        

        vCacheLocationEnd = CacheLocation(vCacheRange.end.getLineNum()+vDifference, vCacheRange.end.getIndex())
        vCacheRange = OrgParser.identifyOrgTable(vNewCache, vCacheLocationEnd)


    return vNewCache