-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdefinitions_history.py
60 lines (54 loc) · 1.84 KB
/
definitions_history.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# For the moment we only look at these environments in the latex source files
with_proofs = ['lemma', 'proposition', 'theorem']
without_proofs = ['definition', 'example', 'exercise', 'situation', 'remark', 'remarks']
# location of the stacks-project folder associated to stacks-website/ (relative to this file)
websiteProject = "../stacks-project"
# each of these will collect the following data
# name texfile, type, latex_label, tag,
# line_nr of begin{env}, line_nr of end{env}, text of env,
# line_nr of begin{proof}, line_nr of end{proof}, text of proof
class env_with_proof:
def __init__(self, name, type, label, tag, b, e, text, bp, ep, proof):
self.name = name
self.type = type
self.label = label
self.tag = tag
self.b = b
self.e = e
self.text = text
self.bp = bp
self.ep = ep
self.proof = proof
# each of these will collect the following data
# name texfile, type, latex_label, tag,
# line_nr of begin{env}, line_nr of end{env}, text of env
class env_without_proof:
def __init__(self, name, type, label, tag, b, e, text):
self.name = name
self.type = type
self.label = label
self.tag = tag
self.b = b
self.e = e
self.text = text
# Storing history of an env
# commit and env are current (!)
# commits is a list of the commits that changed our env
# here 'change' means anything except for moving the text
# envs is the list of states of the env during those commits
class env_history:
def __init__(self, commit, env, commits, envs):
self.commit = commit
self.env = env
self.commits = commits
self.envs = envs
# overall history
# commit is current commit
# env_histories is a list of env_history objects
# commits is list of previous commits with
# commits[0] the initial one
class history:
def __init__(self, commit, env_histories, commits):
self.commit = commit
self.env_histories = env_histories
self.commits = commits