ctucx.git: nimstagit

[nimlang] incomplete reimplementation of stagit

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 
61 
62 #? stdtmpl | standard
#proc templateCommitPage(templateContext: TemplateContext, commit: CommitSummary, parents: seq[string], diffStats: GitDiffStats, patches: seq[Patch]): string =
#  result = ""
<!DOCTYPE html>
<html>
    <head>
        <title>$templateContext.repoName - $templateContext.siteTitle</title>

        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="$templateContext.description">
        <meta name="generator" content="https://cgit.ctu.cx/nimstagit">

        <link href="/style.css" rel="stylesheet" />
    </head>
    <body>
        <header>
            <h1><a href="/">$templateContext.siteTitle</a>: $templateContext.repoName</h1>
            <p>$templateContext.description</p>
        </header>
        <nav>
            <a href="/$templateContext.repoUrl">summary</a>
            <a href="/$templateContext.repoUrl/log" class="active">log</a>
            <a href="/$templateContext.repoUrl/tree">tree</a>
            <a href="/$templateContext.repoUrl/refs">refs</a>
        </nav>
        <main>
        <div class="event-list">
            <div class="event">
                <a class="right" href="/$templateContext.repoUrl/log/{$commit.id}.html">$commit.when</a>
                commit: $commit.id<br>
                #for parent in parents:
                parent: <a href="/$templateContext.repoUrl/log/${parent}.html">$parent</a><br>
                #end for
                author: $commit.authorName<br>
                committer: $commit.committerName<br><br>
                <pre>$commit.message</pre>
            </div>
            <div class="event">
<pre>$diffStats.filesChanged files changed, <span class="insertion">$diffStats.insertions</span> insertions, <span class="deletion">$diffStats.deletions</span> deletions

#for patch in patches:
$patch.status <a href="/$templateContext.repoUrl/tree/${patch.oldFileUrl}.html">$patch.oldFile</a>
#end for
</pre>
            </div>
            #for patch in patches:
            <div class="event">
<pre>$patch.status $patch.oldFile => $patch.newFile
#for hunk in patch.hunks:
$hunk.header
#for line in hunk.lines: result.add("<span class=\"" & line.type & "\">" & line.prefix & line.content & "</span>")
#end for
#end for
</pre>
            </div>
            #end for
        </div>
        </main>
        <footer><p>Generated on $templateContext.generated</p></footer>
    </body>
</html>