Cowsay.jl/dev/cowfiles.html
2024-12-17 06:21:45 +00:00

2 lines
9 KiB
HTML

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Make your own Cowfile · Cowsay.jl</title><meta name="title" content="Make your own Cowfile · Cowsay.jl"/><meta property="og:title" content="Make your own Cowfile · Cowsay.jl"/><meta property="twitter:title" content="Make your own Cowfile · Cowsay.jl"/><meta name="description" content="Documentation for Cowsay.jl."/><meta property="og:description" content="Documentation for Cowsay.jl."/><meta property="twitter:description" content="Documentation for Cowsay.jl."/><meta property="og:url" content="https://cowsay-jl.millironx.com/cowfiles.html"/><meta property="twitter:url" content="https://cowsay-jl.millironx.com/cowfiles.html"/><link rel="canonical" href="https://cowsay-jl.millironx.com/cowfiles.html"/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-mocha.css" data-theme-name="catppuccin-mocha"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-macchiato.css" data-theme-name="catppuccin-macchiato"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-frappe.css" data-theme-name="catppuccin-frappe"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-latte.css" data-theme-name="catppuccin-latte"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">Cowsay.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Home</a></li><li><a class="tocitem" href="cows.html">Available Cowfiles</a></li><li class="is-active"><a class="tocitem" href="cowfiles.html">Make your own Cowfile</a><ul class="internal"><li><a class="tocitem" href="#Helpful-hints-for-making-cow-functions"><span>Helpful hints for making cow functions</span></a></li></ul></li><li><a class="tocitem" href="private.html">Private API Reference</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="cowfiles.html">Make your own Cowfile</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="cowfiles.html">Make your own Cowfile</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://code.millironx.com/millironx/Cowsay.jl" title="View the repository"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">Repository</span></a><a class="docs-navbar-link" href="https://code.millironx.com/millironx/Cowsay.jl/src/commit/master/docs/src/cowfiles.md" title="Edit source"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Making-a-cow-function"><a class="docs-heading-anchor" href="#Making-a-cow-function">Making a cow function</a><a id="Making-a-cow-function-1"></a><a class="docs-heading-anchor-permalink" href="#Making-a-cow-function" title="Permalink"></a></h1><p>The original cowsay used Perl scripts (called &#39;cowfiles&#39;) to allow for creating more ASCII cow art. Cowsay.jl uses Julia functions, instead. In order to be usable by <code>Cowsay.cowsay</code>, a cow function <strong>must</strong></p><ol><li><p>Take the correct arguments</p><p>The function must take three (3) <a href="https://docs.julialang.org/en/v1/manual/functions/#Keyword-Arguments">keyword arguments</a> of the form</p><ul><li><code>eyes::AbstractString=&quot;oo&quot;</code></li><li><code>tongue::AbstractString=&quot; &quot;</code></li><li><code>thoughts::AbstractString=&quot;\\&quot;</code></li></ul><p>When drawing the cow artwork, you may then use the variables <code>eyes</code> in place of the eyes, <code>tongue</code> in place of the tongue, and <code>thoughts</code> in place of the speech ballon trail. Use of these variables in constructing the cow is optional (but makes the use of your cow function far more fun), but all three arguments must be present in the signature, regardless.</p></li><li><p>Return a string</p><p>The cow artwork must be returned from the function as a string. This is distinctly different from how the original cowsay modified the <code>$the_cow</code> variable.</p></li></ol><h2 id="Helpful-hints-for-making-cow-functions"><a class="docs-heading-anchor" href="#Helpful-hints-for-making-cow-functions">Helpful hints for making cow functions</a><a id="Helpful-hints-for-making-cow-functions-1"></a><a class="docs-heading-anchor-permalink" href="#Helpful-hints-for-making-cow-functions" title="Permalink"></a></h2><ol><li>Include one function per file, with the extension <code>.cow.jl</code></li><li>Do not indent within a <code>.cow.jl</code> file to better see the artwork</li><li>Make use of string literals (<code>&quot;&quot;&quot;</code>) and string interpolation (<code>$</code>) to build the cow art</li><li>Be sure to escape backslashes (<code>\</code>) and dollar signs (<code>$</code>) within your artwork</li><li>When converting from Perl cowfiles, <em>unescape</em> at symbols (<code>@</code>), as these are <strong>not</strong> special in Julia strings</li><li>Split the <code>eyes</code> variable to get individual left- and right-eye when creating large cow functions</li><li>Have fun!</li></ol></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="cows.html">« Available Cowfiles</a><a class="docs-footer-nextpage" href="private.html">Private API Reference »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.8.0 on <span class="colophon-date" title="Tuesday 17 December 2024 06:21">Tuesday 17 December 2024</span>. Using Julia version 1.11.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>