gummy.utils.templates module

This program file is only for documents. You can see the same contents by looking at Github .

gummy.utils.templates.base_html()

Return TEMPLATES_DIR/base.html

Returns

Where this file is.

Return type

str

The contents of the file are as follows:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="twitter:card" content="summary" />
    <meta name="twitter:site" content="@cabernet_rock" />
    <meta property="og:url" content="https://github.com/iwasakishuto/Translation-Gummy" />
    <meta property="og:title" content="Translation-Gummy" />
    <meta property="og:description" content="Translation Gummy is a magical gadget which enables user to be able to speak and understand other languages." />
    <meta property="og:image" content="https://github.com/iwasakishuto/Translation-Gummy/blob/master/image/header.png?raw=true" />
    <meta name="slack-app-id" content="A017FQB5GV9">
    <title>{{ title }}</title>
    {% include 'style.html' %}
  </head>
  <body>
    <span class="title"> {{ title }} </span>
    {% block content %}
    {% endblock %}
  </body>
</html>
gummy.utils.templates.header_html()

Return TEMPLATES_DIR/header.html

Returns

Where this file is.

Return type

str

The contents of the file are as follows:

<!DOCTYPE html>
<html>
  <head>
    <script>
    function subst() {
        var vars = {};
        var query_strings_from_url = document.location.search.substring(1).split('&');
        for (var query_string in query_strings_from_url) {
            if (query_strings_from_url.hasOwnProperty(query_string)) {
                var temp_var = query_strings_from_url[query_string].split('=', 2);
                vars[temp_var[0]] = decodeURI(temp_var[1]);
            }
        }
        var css_selector_classes = ['page', 'frompage', 'topage', 'webpage', 'section', 'subsection', 'date', 'isodate', 'time', 'title', 'doctitle', 'sitepage', 'sitepages'];
        for (var css_class in css_selector_classes) {
            if (css_selector_classes.hasOwnProperty(css_class)) {
                var element = document.getElementsByClassName(css_selector_classes[css_class]);
                for (var j = 0; j < element.length; ++j) {
                    element[j].textContent = vars[css_selector_classes[css_class]];
                }
            }
        }
    }
    </script>
    <link href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" rel="stylesheet" />
  </head>
  <body style="border:0; margin: 0;" onload="subst()">
    <table style="border-bottom: 1px solid black; width: 100%; vertical-align: middle;">
      <tr>
        <td style="text-align:left">
          Powered by
          <i class="fab fa-github"></i><a href="https://github.com/iwasakishuto/Translation-Gummy">https://github.com/iwasakishuto/Translation-Gummy</a>
          <i class="fab fa-twitter"></i><a href="https://twitter.com/cabernet_rock">https://twitter.com/cabernet_rock</a>
        </td>
        <td style="text-align:right">
          Page <span class="page"></span> of <span class="topage"></span>
        </td>
      </tr>
    </table>
  </body>
</html>
gummy.utils.templates.paper_html()

Return TEMPLATES_DIR/paper.html

Returns

Where this file is.

Return type

str

The contents of the file are as follows:

{% extends 'base.html' %}
{% block content %}
{%- for content in contents %}
  {%- if 'head' in content %}
    <h2 class="head">{{ content.head | title }}</h2>
  {%- endif %}
  {%- if 'subhead' in content %}
    <h3 class="subhead">{{ content.subhead | title }}</h3>
  {%- endif %}
  {%- if 'raw' in content %}
    <table>
      <tbody>
        <tr>
          <td class="raw">
            {%- for raw in content.raw -%}
            <span class="{{ loop.cycle('odd', 'even') }}"><sup>[{{ loop.index }}]</sup>{{ raw }}</span>
            {%- endfor -%}
          </td>
          <td class="translated">
            {%- for translated in content.translated -%}
            <span class="{{ loop.cycle('odd', 'even') }}"><sup>[{{ loop.index }}]</sup>{{ translated }}</span>
            {%- endfor -%}
          </td>
        </tr>
      </tbody>
    </table>
  {%- endif %}
  {%- if 'img' in content %}
    <p class="img_center">{{ content.img }}</p>
  {%- endif %}
{%- endfor %}
{% endblock %}
gummy.utils.templates.style_html()

Return TEMPLATES_DIR/style.html

Returns

Where this file is.

Return type

str

The contents of the file are as follows:

<style>
  body {
    font-family: "Times New Roman", "Helvetica Neue", Meiryo, monospace, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, IPAexMincho, "Open Sans", "Helvetica Neue", sans-serif, serif;
    margin: 0;
  }
  span.title {
    text-align: center;
    font-size: 2.5em;
    font-weight: bold;
  }
  h2.head {
    border-bottom: 2px solid #d5d5d5;
    font-size: 1.5em;
    margin: 0.75em 0;
  }
  h3.subhead {
    font-size: 1.1em;
    margin: 0.75em 0;
    position: relative;
    padding: 0 1em;
    display: inline-block;
    top:0;
  }
  h3.subhead:before, h3.subhead:after {
    position: absolute;
    top: 0;
    content:'';
    width: 8px;
    height: 100%;
    display: inline-block;
  }
  h3.subhead:before {
    border-top: solid 1px #d5d5d5;
    border-left: solid 1px #d5d5d5;
    border-bottom: solid 1px #d5d5d5;
    left: 0;
  }
  h3.subhead:after {
    content: '';
    border-top: solid 1px #d5d5d5;
    border-right: solid 1px #d5d5d5;
    border-bottom: solid 1px #d5d5d5;
    right: 0;
  }
  table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
  }
  thead {
    font-size: 1.15em;
    font-weight: bold;
  }
  td, th {
    width: 50%;
    vertical-align: top;
  }
  .raw {
    line-height: 1.6em;
  }
  .translated {
    font-size: 0.85em;
    line-height: 2.25em;
  }
  p.img_center {
    text-align: center;
    border: 5px solid #d5d5d5;
    padding: 20px 10px;
    max-width: 100%;
    margin: 10px 10%;
  }
  img {
    max-width: 80%;
  }
  span.odd {
    background-color: #fff!important;
  }
  span.even {
    background-color: #ddd!important;
  }
  sup {
    color: #777;
    font-size: .75em;
  }
  @media print {
    * {
      -webkit-print-color-adjust: exact;
    }
    span.odd {
      background-color: #fff!important;
    }
    span.even {
      background-color: #ddd!important;
    }
  }
</style>