aboutsummaryrefslogtreecommitdiff
path: root/captain/external.f90
blob: 86efe94bc408a13128e7dba3bce94de5591233a8 (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
46
47
48
49
50
51
52
module external_handling
implicit none


contains

    function external_request_gemini(request) result(renderunit)
    use page_template
    implicit none
    
        character(*), intent(in)::request
        integer::renderunit
        character(1024)::template_file
        type(template)::page
    
        ! Open the base template
        call template_filepath("index.gmi", template_file)
        call page%init(template_file)
    
        if(trim(request) == "/" .or. trim(request) == "/index.gmi") then
        
            call page%assign('title', 'Home')
            
        else if(trim(request) == "/releases.gmi") then
        
            call page%assign('title', 'Releases')
        
        else if(trim(request) == "/jobs.gmi") then
        
            call page%assign('title', 'Jobs')
        
        else if(trim(request) == "/players.gmi") then
        
            call page%assign('title', 'Players')
        
        else if(trim(request) == "/about.gmi") then
        
            call page%assign('title', 'About')
            
        else
        
            call page%assign('title', 'Not Found')
   
        end if
        
        open(newunit=renderunit, form="formatted", status="scratch", access='stream')
        
        call page%render(renderunit)
   
    end function external_request_gemini

end module external_handling