#!/usr/bin/guile \ -e main-rofi -s !# (add-to-load-path (string-append (passwd:dir (getpwuid (geteuid))) "/dev/dotfiles/lib/guile/")) (use-modules (ice-9 rdelim) (ice-9 popen) (ice-9 ftw) (ice-9 format) (ice-9 and-let-star) (utils)) (define habits-dir (expand-file "~/org/habits/")) (define (get-habit-files dir) (scandir dir (lambda (file) (string-suffix? ".dat" file)))) (define (prepare-options files) (string-join (map (lambda (f) (basename f ".dat")) files) "\n")) (define (over-shell cmd) (let* ((port (open-input-pipe cmd)) (result (read-line port))) (close-pipe port) (if (eof-object? result) #f result))) (define (rofi-capture-option options) (over-shell (format #f "echo -e ~s | rofi -dmenu" options))) (define (rofi-capture-habit-quantity habit) (over-shell (format #f "echo 1 | rofi -dmenu -p 'Add to ~a'" habit))) (define (main-rofi args) (and-let* ((habit (-> (get-habit-files habits-dir) (prepare-options) (rofi-capture-option))) (quantity (rofi-capture-habit-quantity habit)) (file-out (open-file (string-append habits-dir habit ".dat") "a"))) (format file-out "~d:~a\n" (current-time) quantity) (close-port file-out))) 2da185ef6f431588250af1d48ec5'>refslogtreecommitdiffstats
path: root/layouts/_default/search.html
blob: bcbaad44f2faf8ddcb355b0037d8149a05862ec7 (plain)
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
{{ define "main" }}
  <div class="mw7 center pa1">
    <header>
      <h2 class="baskerville f2 lh-title mv3 ph1">
        {{ .Title }}
      </h2>
    </header>

    <form action="{{ .Permalink }}">
      <input
        id="search-query"
        name="q"
        placeholder="search phrase"
        class="near-black pa2 w-100"
      />
    </form>

    <div id="search-results" class="mv2"></div>
  </div>

  <template id="search-result-template">
    <article class="pv2 bt bb b--black-10 search_summary">
      <a class="link dim near-black search_link" href="">
        <time class="fr f6 lh-copy ph4 search_time"></time>
        <h3 class="f3 baskerville mv1 lh-title search_title"></h3>
        <div class="f5 lh-copy search_snippet"></div>
      </a>
    </article>
  </template>
  <script
    src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/7.0.0/fuse.min.js"
    integrity="sha512-GrJ4P9yra6dftp5O0eaKFKS4ch1FYn1xR/VCHQIMJO1LNqcKhjkAkAETHYoE81Ffh3BjCJMWA/AZSYP521jxFA=="
    crossorigin="anonymous"
    referrerpolicy="no-referrer"
  ></script>

  {{ with resources.Get "js/search.js" | resources.Minify | fingerprint }}
    <script
      src="{{ .RelPermalink }}"
      integrity="{{ .Data.Integrity }}"
      crossorigin="anonymous"
      referrerpolicy="no-referrer"
    ></script>
  {{ end }}
{{ end }}