File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88
99from ..dynassign import dyn
1010
11+ # TODO: suppport Attribute, Subscript in autoref
12+ # TODO: support nested autorefs
13+ # Consider:
14+ # with autoref(o):
15+ # x # --> (o.x if hasattr(o, "x") else x)
16+ # x.a # --> (o.x.a if hasattr(o, "x") else x.a)
17+ # x[s] # --> (o.x[s] if hasattr(o, "x") else x[s])
18+ # o # --> o
19+ # with autoref(p):
20+ # x # --> (p.x if hasattr(p, "x") else (o.x if hasattr(o, "x") else x))
21+ # x.a # --> (p.x.a if hasattr(p, "x") else (o.x.a if hasattr(o, "x") else x.a))
22+ # x[s] # --> (p.x[s] if hasattr(p, "x") else (o.x[s] if hasattr(o, "x") else x[s]))
23+ # o # --> (p.o if hasattr(p, "o") else o)
24+ # o.x # --> (p.o.x if hasattr(p, "o") else o.x)
25+ # o[s] # --> (p.o[s] if hasattr(p, "o") else o[s])
26+
1127def autoref (block_body , args ):
1228 assert len (args ) == 1 , "expected exactly one argument, the object to implicitly reference"
1329 assert block_body , "expected at least one statement in the 'with autoref' block"
You can’t perform that action at this time.
0 commit comments