10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-07-22 18:57:38 +02:00

Use the new extractMath function of bdd0982b92 for doubleColumn and doubleTBE handler

This commit is contained in:
Mickaël Véril 2020-08-03 17:08:20 +02:00
parent 3f52913a19
commit 6ca8c57086
2 changed files with 6 additions and 15 deletions

View File

@ -1,7 +1,7 @@
from ..formatHandlerBase import formatHandlerBase
from ..formatName import formatName
from ...data import dataFileBase,DataType,method,excitationValue,datafileSelector,AbsDataFile,getSubtablesRange,state
from ...LaTeX import newCommand
from ...LaTeX import newCommand,extractMath
import re
from TexSoup import TexSoup
import numpy as np
@ -19,13 +19,9 @@ class doubleColumnHandler(formatHandlerBase):
for rangeTrans in subtablestrans:
mytrans=moltable[rangeTrans,:]
mytransdesc=mytrans[0:2,1]
for i in range(2):
try:
mathsoup=TexSoup(mytransdesc[i])
except:
print(f"Error when parsing latex state: {str(mytransdesc[i])}")
exit(-1)
newCommand.runAll(mathsoup,self.commands)
for i in range(2):
mathsoup=extractMath(mytransdesc[i],Soup=True,commands=self.commands)
mytransdesc[i]=str(mathsoup)
for colindex in range(3,np.size(table,1)):
col=mytrans[:,colindex]

View File

@ -2,7 +2,7 @@ from ..formatHandlerBase import formatHandlerBase
from ..formatName import formatName
from ...data import dataFileBase,DataType,method,excitationValue,datafileSelector,getSubtablesRange,AbsDataFile,state
from ...utils import getValFromCell, checkFloat
from ...LaTeX import newCommand
from ...LaTeX import newCommand,extractMath
from TexSoup import TexSoup
import re
@formatName("doubleTBE")
@ -15,12 +15,7 @@ class doubleTBEHandler(formatHandlerBase):
data.molecule=str(table[rangeMol[0],0])
data.method=method("TBE","CBS")
for mytrans in table[rangeMol]:
try:
mathsoup=TexSoup(mytrans[1])
except:
print(f"Error when parsing latex state: {str(mytransdesc[i])}")
exit(-1)
newCommand.runAll(mathsoup,self.commands)
mathsoup=extractMath(mytrans[1],Soup=True,commands=self.commands)
mytransdesc=str(mathsoup)
infin=mytransdesc.split(r"\rightarrow")
for i,item in enumerate(infin):