mirror of
https://github.com/NohamR/Bibmath2Tex.git
synced 2026-05-24 19:58:43 +00:00
quick changes
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -132,9 +132,11 @@ node_modules/
|
|||||||
*.out
|
*.out
|
||||||
*.log
|
*.log
|
||||||
*.toc
|
*.toc
|
||||||
|
*.fdb_latexmk
|
||||||
|
*.fls
|
||||||
|
|
||||||
exercices/
|
exercices/
|
||||||
ficall (1).pdf
|
ficall (1).pdf
|
||||||
ficall.tex
|
ficall.tex
|
||||||
fic00097.pdf
|
fic00097.pdf
|
||||||
/exemples
|
/exemples
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -4,7 +4,7 @@ OUTDIR=output
|
|||||||
|
|
||||||
all:
|
all:
|
||||||
@mkdir -p $(OUTDIR)
|
@mkdir -p $(OUTDIR)
|
||||||
$(TEX) -output-directory=$(OUTDIR) $(SRC) -interaction=batchmode
|
$(TEX) -output-directory=$(OUTDIR) $(SRC)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(OUTDIR)/*.aux $(OUTDIR)/*.log $(OUTDIR)/*.pdf
|
rm -rf $(OUTDIR)/*.aux $(OUTDIR)/*.log $(OUTDIR)/*.pdf
|
||||||
|
|||||||
18
grab.py
18
grab.py
@@ -72,28 +72,28 @@ class LatexFile:
|
|||||||
self.content += f"\\noindent\\textbf{{Chapitre:}} \\href{{{chapitre.url}}}{{{chapitre.title}}}\n"
|
self.content += f"\\noindent\\textbf{{Chapitre:}} \\href{{{chapitre.url}}}{{{chapitre.title}}}\n"
|
||||||
|
|
||||||
def add_exercise(self, exercise):
|
def add_exercise(self, exercise):
|
||||||
self.content += f"""\\exercice{{{exercise.number}, name, date, {exercise.stars}, {exercise.title}}}\n"""
|
self.content += f"""\\exercice{{{exercise.id}, name, date, {exercise.stars}, {exercise.title}}}\n"""
|
||||||
self.content += f"""\\enonce{{{exercise.number}}}{{}}\n"""
|
self.content += f"""\\enonce{{{exercise.id}}}{{}}\n"""
|
||||||
self.content += f"{exercise.enonce}\n"
|
self.content += f"{exercise.enonce}\n"
|
||||||
self.content += f"""\\finenonce{{{exercise.number}}}\n"""
|
self.content += f"""\\finenonce{{{exercise.id}}}\n"""
|
||||||
self.content += f"""\\finexercice\n"""
|
self.content += f"""\\finexercice\n"""
|
||||||
self.content += "\n"
|
self.content += "\n"
|
||||||
|
|
||||||
def add_indication(self, exercise):
|
def add_indication(self, exercise):
|
||||||
self.content += f"""\\indication{{{exercise.number}}}\n"""
|
self.content += f"""\\indication{{{exercise.id}}}\n"""
|
||||||
self.content += f"{exercise.indication}\n"
|
self.content += f"{exercise.indication}\n"
|
||||||
self.content += f"""\\finindication\n"""
|
self.content += f"""\\finindication\n"""
|
||||||
self.content += "\n"
|
self.content += "\n"
|
||||||
|
|
||||||
def add_answer(self, exercise):
|
def add_answer(self, exercise):
|
||||||
self.content += f"""\\correction{{{exercise.number}}}\n"""
|
self.content += f"""\\correction{{{exercise.id}}}\n"""
|
||||||
self.content += f"{exercise.answer}\n"
|
self.content += f"{exercise.answer}\n"
|
||||||
self.content += f"""\\fincorrection\n"""
|
self.content += f"""\\fincorrection\n"""
|
||||||
self.content += "\n"
|
self.content += "\n"
|
||||||
|
|
||||||
def sanitize(self):
|
def sanitize(self):
|
||||||
# return ''.join(c for c in self.content if ord(c) < 128)
|
# return self.content.encode('utf-8', 'ignore').decode('utf-8')
|
||||||
return self.content.encode('utf-8', 'ignore').decode('utf-8')
|
return self.content
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
with open(self.filename, 'w') as f:
|
with open(self.filename, 'w') as f:
|
||||||
@@ -149,7 +149,7 @@ def fetch_chapitre(quoi):
|
|||||||
}
|
}
|
||||||
response = requests.get('https://bibmath.net/ressources/index.php', headers=headers, params=params)
|
response = requests.get('https://bibmath.net/ressources/index.php', headers=headers, params=params)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
soup = BeautifulSoup(response.text, 'html.parser')
|
soup = BeautifulSoup(response.text, 'lxml')
|
||||||
article = soup.find('article', id='contenugauche')
|
article = soup.find('article', id='contenugauche')
|
||||||
|
|
||||||
if article:
|
if article:
|
||||||
@@ -176,6 +176,8 @@ def fetch_chapitre(quoi):
|
|||||||
stars_count = len(exo_title_div.find_all('img'))
|
stars_count = len(exo_title_div.find_all('img'))
|
||||||
|
|
||||||
enonce = element.find('div', class_='enonce').find('div', class_='inner').get_text(strip=True)
|
enonce = element.find('div', class_='enonce').find('div', class_='inner').get_text(strip=True)
|
||||||
|
if ".Existe-t" in enonce:
|
||||||
|
print(element)
|
||||||
indication_div = element.find('div', class_='indication')
|
indication_div = element.find('div', class_='indication')
|
||||||
indication = (
|
indication = (
|
||||||
indication_div.find('div', class_='inner').get_text(strip=True)
|
indication_div.find('div', class_='inner').get_text(strip=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user