aboutsummaryrefslogtreecommitdiff
path: root/captain/external.f90
blob: aa65e71fb8cec632699625b788a52cf013c61061 (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
53
54
55
56
57
module external_handling
implicit none


contains

    function external_request_gemini(request) result(disk_filename)
    use page_template
    use config, only: template_filepath
    use logging, only: write_log
    implicit none
    
        character(*), intent(in)::request
        character(len=:), pointer::disk_filename
        integer::renderunit
        character(1024)::template_file
        type(template)::page
        character(16)::log_tmp
    
        ! Open the base template
        call template_filepath("index.gmi", template_file)
        
        call page%init(trim(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

        call page%render()
   
        disk_filename => page%output_filename
    
    end function external_request_gemini

end module external_handling