From da29d0fcae845ad61033cb2a038177b933d12e7a Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 14 Apr 2020 11:05:30 +1000 Subject: [PATCH] move latex header and styling into separate files --- rslib/src/notetype/header.tex | 7 +++++++ rslib/src/notetype/mod.rs | 23 +++-------------------- rslib/src/notetype/schema11.rs | 1 + rslib/src/notetype/styling.css | 7 +++++++ 4 files changed, 18 insertions(+), 20 deletions(-) create mode 100644 rslib/src/notetype/header.tex create mode 100644 rslib/src/notetype/styling.css diff --git a/rslib/src/notetype/header.tex b/rslib/src/notetype/header.tex new file mode 100644 index 000000000..019161875 --- /dev/null +++ b/rslib/src/notetype/header.tex @@ -0,0 +1,7 @@ +\documentclass[12pt]{article} +\special{papersize=3in,5in} +\usepackage[utf8]{inputenc} +\usepackage{amssymb,amsmath} +\pagestyle{empty} +\setlength{\parindent}{0in} +\begin{document} diff --git a/rslib/src/notetype/mod.rs b/rslib/src/notetype/mod.rs index e142e290e..6f51c6a07 100644 --- a/rslib/src/notetype/mod.rs +++ b/rslib/src/notetype/mod.rs @@ -27,26 +27,9 @@ use unicase::UniCase; define_newtype!(NoteTypeID, i64); -pub(crate) const DEFAULT_CSS: &str = "\ -.card { - font-family: arial; - font-size: 20px; - text-align: center; - color: black; - background-color: white; -} -"; - -pub(crate) const DEFAULT_LATEX_HEADER: &str = r#"\documentclass[12pt]{article} -\special{papersize=3in,5in} -\usepackage[utf8]{inputenc} -\usepackage{amssymb,amsmath} -\pagestyle{empty} -\setlength{\parindent}{0in} -\begin{document} -"#; - -pub(crate) const DEFAULT_LATEX_FOOTER: &str = r#"\end{document}"#; +pub(crate) const DEFAULT_CSS: &str = include_str!("styling.css"); +pub(crate) const DEFAULT_LATEX_HEADER: &str = include_str!("header.tex"); +pub(crate) const DEFAULT_LATEX_FOOTER: &str = r"\end{document}"; pub struct NoteType { pub id: NoteTypeID, diff --git a/rslib/src/notetype/schema11.rs b/rslib/src/notetype/schema11.rs index a7ae3e11f..41a686ce6 100644 --- a/rslib/src/notetype/schema11.rs +++ b/rslib/src/notetype/schema11.rs @@ -1,5 +1,6 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + use crate::{ decks::DeckID, notetype::{ diff --git a/rslib/src/notetype/styling.css b/rslib/src/notetype/styling.css new file mode 100644 index 000000000..c5a11b359 --- /dev/null +++ b/rslib/src/notetype/styling.css @@ -0,0 +1,7 @@ +.card { + font-family: arial; + font-size: 20px; + text-align: center; + color: black; + background-color: white; +}