Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
6
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
C
colt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nala Ginrut
colt
Commits
df5a5ad0
Verified
Commit
df5a5ad0
authored
Sep 18, 2019
by
Nala Ginrut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tag query
parent
d039ee1d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
app/controllers/tags.scm
app/controllers/tags.scm
+2
-6
app/models/posts.scm
app/models/posts.scm
+8
-3
No files found.
app/controllers/tags.scm
View file @
df5a5ad0
...
...
@@ -21,14 +21,10 @@
(
use-modules
(
app
models
posts
)
(
colt
git
)
(
colt
config
)
(
srfi
srfi-1
))
(
define
(
filter-posts-by-tag
tag
posts
)
(
filter
(
lambda
(
p
)
(
member
tag
(
string-split
(
post-tags
p
)
#
\
,
)))
posts
))
(
colt
config
))
(
define
(
gen-content
tag
)
(
let
((
posts
(
filter-posts-by-tag
tag
(
get-all-posts
)
)))
(
let
((
posts
(
get-posts-by-tag
tag
)))
(
tpl->html
`
(
div
(
@
(
class
"blog-post-content"
))
(
h2
"Articles contains tag: "
...
...
app/models/posts.scm
View file @
df5a5ad0
...
...
@@ -30,6 +30,7 @@
update-index-posts-cache
get-one-article
get-all-posts
get-posts-by-tag
count-tags
get-ordered-tags-list
get-intro-page
...
...
@@ -102,8 +103,8 @@
(
lambda
(
o
)
(
for-each
(
lambda
(
t
)
(
let
((
cnt
(
hash-ref
*all-tags*
t
0
)))
(
hash-set!
*all-tags*
t
(
1+
cnt
))))
(
let
((
pl
(
hash-ref
*all-tags*
t
'
()
)))
(
hash-set!
*all-tags*
t
(
cons
(
get-post
o
)
pl
))))
(
tags-string->list
(
post-tags
(
get-post
o
)))))
all
)))
(
return
*all-post-objs*
)))))
...
...
@@ -111,11 +112,15 @@
(
define*
(
get-all-posts
#
:key
(
latest-top?
#t
)
(
refresh?
#f
))
(
map
get-post
(
get-all-post-objs
#
:latest-top?
latest-top?
#
:refresh?
refresh?
)))
(
define
(
get-posts-by-tag
tag
)
(
hash-ref
*all-tags*
(
uri-decode
tag
)
'
()))
(
define
(
count-tags
)
(
hash-count
(
const
#t
)
*all-tags*
))
(
define
(
get-ordered-tags-list
)
(
sort
(
hash-map->list
cons
*all-tags*
)
(
lambda
(
x
y
)
(
<=
(
cdr
x
)
(
cdr
y
)))
))
(
sort
(
hash-map->list
cons
*all-tags*
)
(
lambda
(
x
y
)
(
<=
(
length
x
)
(
length
y
)))))
(
define
(
get-intro-page
)
(
when
(
null?
*intro*
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment