Prepare layout for pull, push, forward links.
This commit is contained in:
parent
28cf7b5e83
commit
9fb9670091
3 changed files with 101 additions and 9 deletions
20
app/db.py
20
app/db.py
|
@ -112,10 +112,16 @@ class Subnode:
|
||||||
return 100-fuzz.ratio(self.wikilink, other.wikilink)
|
return 100-fuzz.ratio(self.wikilink, other.wikilink)
|
||||||
|
|
||||||
def go(self):
|
def go(self):
|
||||||
# returns a set of go links contained in this node
|
"""
|
||||||
|
returns a set of go links contained in this subnode
|
||||||
|
go links are blocks of the form:
|
||||||
|
- [[go]] protocol://example.org/url
|
||||||
|
protocol defaults to https.
|
||||||
|
"""
|
||||||
golinks = subnode_to_actions(self, 'go')
|
golinks = subnode_to_actions(self, 'go')
|
||||||
sanitized_golinks = []
|
sanitized_golinks = []
|
||||||
for golink in golinks:
|
for golink in golinks:
|
||||||
|
# should probably instead check for contains: //
|
||||||
if golink.startswith('http'):
|
if golink.startswith('http'):
|
||||||
sanitized_golinks.append(golink)
|
sanitized_golinks.append(golink)
|
||||||
else:
|
else:
|
||||||
|
@ -123,6 +129,18 @@ class Subnode:
|
||||||
sanitized_golinks.append('https://' + golink)
|
sanitized_golinks.append('https://' + golink)
|
||||||
return sanitized_golinks
|
return sanitized_golinks
|
||||||
|
|
||||||
|
def pull(self):
|
||||||
|
"""
|
||||||
|
returns a set of pull links contained in this subnode
|
||||||
|
pull links are blocks of the form:
|
||||||
|
- [[pull]] [[node]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
# TODO: test.
|
||||||
|
pull_links = subnode_to_actions(self, 'pull')
|
||||||
|
entities = content_to_outlinks(pull_links)
|
||||||
|
return entities
|
||||||
|
|
||||||
|
|
||||||
def subnode_to_actions(subnode, action):
|
def subnode_to_actions(subnode, action):
|
||||||
# hack hack.
|
# hack hack.
|
||||||
|
|
|
@ -68,10 +68,26 @@ h2 { font-size: 1.2em; }
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.backlinks {
|
.links {
|
||||||
display: inline-block;
|
width: 100%;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
|
display: flex;
|
||||||
|
background: #161616;
|
||||||
|
color: #cfcfcf;
|
||||||
|
padding: 0.5em;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.backlinks {
|
||||||
/*background: #1f1f2f; */
|
/*background: #1f1f2f; */
|
||||||
|
float: left;
|
||||||
|
width: 20%;
|
||||||
|
|
||||||
|
.pushlinks {
|
||||||
|
/*background: #1f1f2f; */
|
||||||
|
width: 20%;
|
||||||
background: #161616;
|
background: #161616;
|
||||||
color: #cfcfcf;
|
color: #cfcfcf;
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
|
@ -79,7 +95,22 @@ h2 { font-size: 1.2em; }
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.backlinks-header {
|
.pulllinks, .forwardlinks {
|
||||||
|
/*background: #1f1f2f; */
|
||||||
|
background: #161616;
|
||||||
|
width: 20%;
|
||||||
|
color: #cfcfcf;
|
||||||
|
padding: 0.5em;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.backlinks-header, .pushlinks-header, .pulllinks-header, .forwardlinks-header {
|
||||||
|
font-style: italic;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.links-header {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,12 +38,55 @@ Try listing <a href="/nodes">nodes</a> or perhaps <a href="/search">search</a>.
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="backlinks">
|
<div class="links">
|
||||||
<span class="backlinks-header"><strong>Backlinks</strong></span><br />
|
<span class="links-header"><strong>Links:</strong></span>
|
||||||
{% for subnode in backlinks %}
|
{% if backlinks %}
|
||||||
<a href="{{subnode.url}}">{{subnode.wikilink}}</a> by <a href="/@{{subnode.user}}">@{{subnode.user}}</a><br />
|
<div class="backlinks">
|
||||||
{% endfor %}
|
<span class="backlinks-header"><strong>back</strong></span><br />
|
||||||
|
{% for subnode in backlinks %}
|
||||||
|
<a href="{{subnode.url}}">{{subnode.wikilink}}</a> by <a href="/@{{subnode.user}}">@{{subnode.user}}</a><br />
|
||||||
|
{% endfor %}
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if pushlinks %}
|
||||||
|
<div class="pushlinks">
|
||||||
|
<span class="pushlinks-header"><strong>push</strong></span><br />
|
||||||
|
{% for subnode in pushlinks %}
|
||||||
|
<a href="{{subnode.url}}">{{subnode.wikilink}}</a> by <a href="/@{{subnode.user}}">@{{subnode.user}}</a><br />
|
||||||
|
{% endfor %}
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if pulllinks %}
|
||||||
|
<div class="pulllinks">
|
||||||
|
<span class="pulllinks-header"><strong>pull</strong></span><br />
|
||||||
|
{% for subnode in pulllinks %}
|
||||||
|
<a href="{{subnode.url}}">{{subnode.wikilink}}</a> by <a href="/@{{subnode.user}}">@{{subnode.user}}</a><br />
|
||||||
|
{% endfor %}
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if forwardlinks %}
|
||||||
|
<div class="forwardlinks">
|
||||||
|
<span class="forwardlinks-header"><strong>forward</strong></span><br />
|
||||||
|
{% for subnode in forwardlinks %}
|
||||||
|
<a href="{{subnode.url}}">{{subnode.wikilink}}</a> by <a href="/@{{subnode.user}}">@{{subnode.user}}</a><br />
|
||||||
|
{% endfor %}
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue