<commit_before><%!
  import os.path
  import sys

  import hlib
  import hruntime
%>

<%namespace file="hlib_ui.mako" import="*" />
<%namespace file="lib.mako" import="*" />

<%inherit file="hlib_page.mako" />

<%def name="script(path)">
  <script src="/static/script/${path}.js"></script>
</%def>

<%def name="page_header()">
  <meta charset="utf-8" />

  ${parent.page_favicon(path_prefix = '/static/images/favicon', tile_background = '#36932A')}

  <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame -->
  <!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> -->
  <!-- Mobile viewport optimized: h5bp.com/viewport -->
  <meta name="viewport" content="width=device-width">
  <!-- Enable responsive design -->
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <!-- remove or comment this line if you want to use the local fonts -->
  <!-- <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css' /> -->

  <!-- Stylesheets -->
  <link rel="stylesheet" type="text/css" href="/static/metro/css/bootstrap.css">
  <link rel="stylesheet" type="text/css" href="/static/metro/css/bootstrap-responsive.css">
  <link rel="stylesheet" type="text/css" href="/static/metro/css/bootmetro.css">
  <link rel="stylesheet" type="text/css" href="/static/metro/css/bootmetro-tiles.css">
  <link rel="stylesheet" type="text/css" href="/static/metro/css/bootmetro-charms.css">
  <link rel="stylesheet" type="text/css" href="/static/metro/css/metro-ui-light.css">
  <link rel="stylesheet" type="text/css" href="/static/metro/css/icomoon.css">
  <link rel="stylesheet" type="text/css" href="/static/metro/css/datepicker.css">

  <script src="/static/metro/scripts/modernizr-2.6.1.min.js"></script>

  <link rel="stylesheet" href="/static/css/settlers.css" type="text/css" />

  <!-- Scripts -->
  <script src="https://www.google.com/jsapi?key=<KEY>" type="text/javascript"></script>

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.js" type="text/javascript"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/jquery-ui.min.js" type="text/javascript"></script>

  <script type="text/javascript" src="/static/script/jquery.form.js"></script>
  <script type="text/javascript" src="/static/script/jquery.timers.js"></script>
  <script type="text/javascript" src="/static/script/jquery.sound.js"></script>
  <script type="text/javascript" src="/static/script/stacktrace.js"></script>

  <script type="text/javascript" src="/static/script/doT.min.js"></script>
  <script type="text/javascript" src="/static/script/strftime.js"></script>

  <script type="text/javascript" src="/static/script/hlib.js"></script>
  <script type="text/javascript" src="/static/script/settlers.js"></script>

  <meta name="google-site-verification" content="<KEY>" />

  % if self.uri.startswith('games/'):
    <%
      kind = self.uri.split('/')[1].split('.')[0]
    %>

    <link rel="stylesheet" href="/static/css/pages/game.css" type="text/css" />
    <link rel="stylesheet" href="/static/css/games/${kind}/${kind}.css" type="text/css" />
    <link rel="stylesheet" href="/static/css/games/${kind}/${kind}-board.css" type="text/css" />

    <script type="text/javascript" src="/static/script/pages/game.js"></script>
    <script type="text/javascript" src="/static/script/games/${kind}/${kind}.js"></script>
    <script type="text/javascript" src="/static/script/games/${kind}/${kind}-board.js"></script>
  % endif

  <%
    current_page_name = next.name.split(':')[1].split('.')[0]

    page_script_file = os.path.join(hruntime.app.config['dir'], 'static', 'script', 'pages', current_page_name + '.js')
    page_style_file = os.path.join(hruntime.app.config['dir'], 'static', 'css', 'pages', current_page_name + '.css')
  %>

  % if os.path.exists(page_style_file):
    <link rel="stylesheet" href="/static/css/pages/${current_page_name}.css" type="text/css" />
  % endif

  % if os.path.exists(page_script_file):
    <script type="text/javascript" src="/static/script/pages/${current_page_name}.js"></script>
  % endif

  <script src="/i18n?lang=${hruntime.i18n.name}" type="text/javascript"></script>

  ${parent.page_header()}

  <script type="text/javascript">
    window.settlers = window.settlers || {};

    window.settlers.title = "${hlib.unescape(_(hruntime.app.config['label']))}";<commit_msg>Append file' mtime to each static file (script, style) that can change<commit_after><%!
  import os
  import os.path
  import sys

  import hlib
  import hruntime

  import lib.datalayer

  def check_static_file_cache(path):
    while path[0] == '/':
      path = path[1:]

    path = os.path.join(hruntime.app.config['dir'], path)
    cache_key = 'scripts.' + path

    cached_stamp = hruntime.cache.get(lib.datalayer.SystemUser(), cache_key)

    try:
      stat = os.stat(path)
    except OSError:
      print >> sys.stderr, 'Missing file: "%s"' % path
      version_stamp = -1
    else:
      version_stamp = int(stat.st_mtime)

    if not cached_stamp:
      hruntime.cache.set(lib.datalayer.SystemUser(), cache_key, version_stamp)
      return version_stamp

    if cached_stamp < version_stamp:
      hruntime.cache.set(lib.datalayer.SystemUser(), cache_key, version_stamp)
      return version_stamp

    return cached_stamp

  def version_stamp(path):
    stamp_postfix = check_static_file_cache(path)
    return ('?_version_stamp=' + str(stamp_postfix)) if stamp_postfix else ''

%>

<%namespace file="hlib_ui.mako" import="*" />
<%namespace file="lib.mako" import="*" />

<%inherit file="hlib_page.mako" />

<%def name="script(path)">
  <script type="text/javascript" src="${path}${version_stamp(path)}"></script>
</%def>

<%def name="style(path)">
  <link rel="stylesheet" href="${path}${version_stamp(path)}" type="text/css" />
</%def>

<%def name="page_header()">
  <meta charset="utf-8" />

  ${parent.page_favicon(path_prefix = '/static/images/favicon', tile_background = '#36932A')}

  <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame -->
  <!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> -->
  <!-- Mobile viewport optimized: h5bp.com/viewport -->
  <meta name="viewport" content="width=device-width">
  <!-- Enable responsive design -->
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <!-- remove or comment this line if you want to use the local fonts -->
  <!-- <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css' /> -->

  <!-- Stylesheets -->
  <link rel="stylesheet" type="text/css" href="/static/metro/css/bootstrap.css">
  <link rel="stylesheet" type="text/css" href="/static/metro/css/bootstrap-responsive.css">
  <link rel="stylesheet" type="text/css" href="/static/metro/css/bootmetro.css">
  <link rel="stylesheet" type="text/css" href="/static/metro/css/bootmetro-tiles.css">
  <link rel="stylesheet" type="text/css" href="/static/metro/css/bootmetro-charms.css">
  <link rel="stylesheet" type="text/css" href="/static/metro/css/metro-ui-light.css">
  <link rel="stylesheet" type="text/css" href="/static/metro/css/icomoon.css">
  <link rel="stylesheet" type="text/css" href="/static/metro/css/datepicker.css">

  <script src="/static/metro/scripts/modernizr-2.6.1.min.js"></script>

  ${style('/static/css/settlers.css')}

  <!-- Scripts -->
  <script src="https://www.google.com/jsapi?key=<KEY>" type="text/javascript"></script>

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.js" type="text/javascript"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/jquery-ui.min.js" type="text/javascript"></script>

  <script type="text/javascript" src="/static/script/jquery.form.js"></script>
  <script type="text/javascript" src="/static/script/jquery.timers.js"></script>
  <script type="text/javascript" src="/static/script/jquery.sound.js"></script>
  <script type="text/javascript" src="/static/script/stacktrace.js"></script>

  <script type="text/javascript" src="/static/script/doT.min.js"></script>
  <script type="text/javascript" src="/static/script/strftime.js"></script>

  ${script('/static/script/hlib.js')}
  ${script('/static/script/settlers.js')}

  <meta name="google-site-verification" content="<KEY>" />

  % if self.uri.startswith('games/'):
    <%
      kind = self.uri.split('/')[1].split('.')[0]
    %>

    ${style('/static/css/pages/game.css')}
    ${style('/static/css/games/' + kind + '/' + kind + '.css')}
    ${style('/static/css/games/' + kind + '/' + kind + '-board.css')}

    ${script('/static/script/pages/game.js')}
    ${script('/static/script/games/' + kind + '/' + kind + '.js')}
    ${script('/static/script/games/' + kind + '/' + kind + '-board.js')}
  % endif

  <%
    current_page_name = next.name.split(':')[1].split('.')[0]

    page_script_file = os.path.join(hruntime.app.config['dir'], 'static', 'script', 'pages', current_page_name + '.js')
    page_style_file = os.path.join(hruntime.app.config['dir'], 'static', 'css', 'pages', current_page_name + '.css')
  %>

  % if os.path.exists(page_style_file):
    ${style('/static/css/pages/' + current_page_name + '.css')}
  % endif

  % if os.path.exists(page_script_file):
    ${script('/static/script/pages/' + current_page_name + '.js')}
  % endif

  <script src="/i18n?lang=${hruntime.i18n.name}" type="text/javascript"></script>

  ${parent.page_header()}

  <script type="text/javascript">
    window.settlers = window.settlers || {};

    window.settlers.title = "${hlib.unescape(_(hruntime.app.config['label']))}";
{'fraction_non_alphanumeric': 0.2107361963190184, 'fraction_numerical': 0.01196319018404908, 'mean_word_length': 4.3919514884233735, 'pattern_counts': {'":': 0, '<': 140, '<?xml version=': 0, '>': 141, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4297908', 'n_tokens_mistral': 3509, 'n_tokens_neox': 3323, 'n_words': 502}