Package: proxyprinter
Proxy PrinterGenerates reasonably good-looking HTML proxies for a card game from an ODS spreadsheet. Useful for making card game prototypes. Comes with some basic CSS; you can add your own style rules to make the proxies prettier or better suited to your game. Does some heuristic text resizing so that text of different lengths is more likely to fit without being too small.Installing with pip(Python 3 required)pip3 install proxyprinter(You might need to usesudoor a VirtualEnv depending on your system setup.)Usageproxyprinter example-cards.ods > output_file.htmlDoproxyprinter --helpfor usage statement with all commandline options.Input FormatOpenDocument Spreadsheet (ODF) file. Example:example-cards.ods. Each "Sheet" in the document is one type of card in your game. The name of the sheet is the card type. The first row in the sheet lists the titles for each field. Each subsequent row is a card.The following field names are special in some way:Name: The name of your card (goes in the title area of the card).Traits: A comma-separated list of tags/labels for the card. Each gets its own span with a class so you can style it. Procedurally generates style rules to color-code these.Text: Gets put in a single text_area alongside Flavor Text.Flavor Text: Gets put in a single text_area alongside Text.Version: Listed in the footer. Use this with the-vswitch to only print recently-updated cards.Copies:If present and a non-negative integer, prints that many copies of the card as part of the overall print sheet. (Otherwise, the print sheet contains 1 copy of this card.)In-Stylesheet SettingsYou can customize various settings for your project by adding aProxyPrinter Settingstab to your spreadsheet. (The sheet must match that name exactly.) In that spreadsheet page, put a setting name in thefirst rowof the sheet to define a custom value for that setting:SettingDescriptionHow to SetCSSFileThe filename of an external CSS file to reference.Put the value in the2nd row, same columnCopyrightThe copyright owner to print at the bottom of the cards.Put the value in the2nd row, same columnText Size ThresholdsDownsize text when it exceeds length thresholds.Text Size ThresholdsRich Field SubstitutionSubstitution patterns to embed special styles or symbols in field textRich Field SubstitutionsFor any setting defined in the spreadsheet that can also be set by commandline parameter, the commandline parameter overrides it if specified.Text Size ThresholdsThe Proxy Printer sizes down text for most fields based on the number of characters in it. Depending on how much space you have available for each field, you may need to adjust these thresholds, so that it goes down to medium or small text sizes with less (or more) text.To customize the text sizing thresholds, put the following 3 setting names in the first row of your settings sheet tab:TextSizeFieldTextSizeMediumIfOverTextSizeSmallIfOverIn each row after it, you can define a threshold to use.  In each row, put the values in the columns as follows:TextSizeField columnTextSizeMediumIfOverTextSizeSmallIfOverName of the field these thresholds apply to. (Each "Field" is a column from one of the card pages in your spreadsheet, e.g.Text,Flavor Text,Cost, etc.) The default for all fields is represented by the field name*.Decrease from big to medium size text if the number of characters is over this number. (Defaults: 30 for most fields, 140 forText, 18 forName)Decrease from medium to small size if the number of characters is over this limit. (Defaults: 50 for most fields, 220 forText, 24 forName.)Any default values you don't redefine remain. Any fields that don't have thresholds defined use the thresholds for*(whether you defined it or left it default).Rich Field SubstitutionsTo include special styles and images inline in your text, you can define patterns from the spreadsheet values that will map to specific styles in the HTML. For example, you can make it so that<5 G>gets replaced with a "5 Gold" icon in the text. (Custom CSS may be necessary, of course.)Put the valueRichFieldsin the first row of your settings sheet tab to define which fields should get processed this way. In each other row, put the name of a field in the same column. The field name*means "all fields". By default, only theTextfield is processed.To do define which substitutions to make, put the following 2 setting names in the first row of your settings sheet tab:ProcessPatternsProcessReplacementsIn each later row, put the following values:ProcessPatterns columnProcessReplacements columnRegular Expressionto search for in the text. Example:\<([0-9]+) G\>Text to replace it with. Regular-expression backreferences are allowed. Example:<span class='gold_coin'>\1</span>These substitutions apply after escaping any HTML that appears in the text, so if your pattern needs to match<or>, you must use the escaped versions&lt;and&gt;instead. Also, this means your substitutions can include raw HTML.