{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Create a Template" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "PDF(HTML) templates are shown [here](https://github.com/iwasakishuto/Translation-Gummy/tree/master/gummy/templates)." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[32m[success]\u001b[0m local driver can be built.\n", "\u001b[31m[failure]\u001b[0m remote driver can't be built.\n", "DRIVER_TYPE: \u001b[32mlocal\u001b[0m\n" ] } ], "source": [ "from gummy.utils import tohtml" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "code_folding": [] }, "outputs": [], "source": [ "contents = [\n", " {\n", " \"en\": \"English\",\n", " \"ja\": \"日本語\",\n", " \"head\": \"見出し\",\n", " \"subhead\": \"小見出し\"\n", " }\n", "]" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Save HTML file at \u001b[34mexample.html\u001b[0m\n" ] } ], "source": [ "_ = tohtml(\n", " path=\"example.html\", \n", " title=\"Title\", \n", " contents=contents,\n", " template=\"paper.html\",\n", ")" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "scrolled": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\r\n", "\r\n", " \r\n", " \r\n", " \r\n", " \r\n", " \r\n", " \r\n", " \r\n", " \r\n", " \r\n", " \r\n", " Title\r\n", " \r\n", " \r\n", " \r\n", " Title \r\n", " \r\n", "

見出し

\r\n", "

小見出し

\r\n", "\r\n", " \r\n", "" ] } ], "source": [ "!cat example.html" ] } ], "metadata": { "hide_input": false, "kernelspec": { "display_name": "Python 3 (/usr/local/bin/)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.5" } }, "nbformat": 4, "nbformat_minor": 4 }