sancho 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +37 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +31 -0
- data/README.md +49 -0
- data/Rakefile +15 -0
- data/STORY.md +13 -0
- data/_layouts/footer.md +4 -0
- data/_layouts/header.md +3 -0
- data/_layouts/layout.html +73 -0
- data/_layouts/robots.txt.erb +4 -0
- data/_layouts/sitemap.xml.erb +20 -0
- data/_layouts/styles.css +92 -0
- data/docs/changelog.html +96 -0
- data/docs/css/styles.css +92 -0
- data/docs/index.html +159 -0
- data/docs/readme.html +159 -0
- data/docs/robots.txt +4 -0
- data/docs/sitemap.xml +30 -0
- data/docs/story.html +57 -0
- data/docs/styles.css +90 -0
- data/lib/config.ru +21 -0
- data/lib/sancho/conf.rb +21 -0
- data/lib/sancho/page.rb +11 -0
- data/lib/sancho/site.rb +24 -0
- data/lib/sancho.rb +37 -0
- data/lib/tasks.rake +80 -0
- data/sancho.gemspec +38 -0
- data/sancho.yml +6 -0
- metadata +70 -0
    
        data/docs/index.html
    ADDED
    
    | @@ -0,0 +1,159 @@ | |
| 1 | 
            +
            <!DOCTYPE html>
         | 
| 2 | 
            +
            <html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
         | 
| 3 | 
            +
            <head>
         | 
| 4 | 
            +
              <meta charset="utf-8" />
         | 
| 5 | 
            +
              <meta name="generator" content="pandoc" />
         | 
| 6 | 
            +
              <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
         | 
| 7 | 
            +
              <meta name="keywords" content="ruby, github-pages-generator" />
         | 
| 8 | 
            +
              <title>Sancho Readme</title>
         | 
| 9 | 
            +
              <style>
         | 
| 10 | 
            +
                code{white-space: pre-wrap;}
         | 
| 11 | 
            +
                span.smallcaps{font-variant: small-caps;}
         | 
| 12 | 
            +
                div.columns{display: flex; gap: min(4vw, 1.5em);}
         | 
| 13 | 
            +
                div.column{flex: auto; overflow-x: auto;}
         | 
| 14 | 
            +
                div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
         | 
| 15 | 
            +
                ul.task-list{list-style: none;}
         | 
| 16 | 
            +
                ul.task-list li input[type="checkbox"] {
         | 
| 17 | 
            +
                  width: 0.8em;
         | 
| 18 | 
            +
                  margin: 0 0.8em 0.2em -1.6em;
         | 
| 19 | 
            +
                  vertical-align: middle;
         | 
| 20 | 
            +
                }
         | 
| 21 | 
            +
                .display.math{display: block; text-align: center; margin: 0.5rem auto;}
         | 
| 22 | 
            +
                /* CSS for syntax highlighting */
         | 
| 23 | 
            +
                pre > code.sourceCode { white-space: pre; position: relative; }
         | 
| 24 | 
            +
                pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
         | 
| 25 | 
            +
                pre > code.sourceCode > span:empty { height: 1.2em; }
         | 
| 26 | 
            +
                .sourceCode { overflow: visible; }
         | 
| 27 | 
            +
                code.sourceCode > span { color: inherit; text-decoration: inherit; }
         | 
| 28 | 
            +
                div.sourceCode { margin: 1em 0; }
         | 
| 29 | 
            +
                pre.sourceCode { margin: 0; }
         | 
| 30 | 
            +
                @media screen {
         | 
| 31 | 
            +
                div.sourceCode { overflow: auto; }
         | 
| 32 | 
            +
                }
         | 
| 33 | 
            +
                @media print {
         | 
| 34 | 
            +
                pre > code.sourceCode { white-space: pre-wrap; }
         | 
| 35 | 
            +
                pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
         | 
| 36 | 
            +
                }
         | 
| 37 | 
            +
                pre.numberSource code
         | 
| 38 | 
            +
                  { counter-reset: source-line 0; }
         | 
| 39 | 
            +
                pre.numberSource code > span
         | 
| 40 | 
            +
                  { position: relative; left: -4em; counter-increment: source-line; }
         | 
| 41 | 
            +
                pre.numberSource code > span > a:first-child::before
         | 
| 42 | 
            +
                  { content: counter(source-line);
         | 
| 43 | 
            +
                    position: relative; left: -1em; text-align: right; vertical-align: baseline;
         | 
| 44 | 
            +
                    border: none; display: inline-block;
         | 
| 45 | 
            +
                    -webkit-touch-callout: none; -webkit-user-select: none;
         | 
| 46 | 
            +
                    -khtml-user-select: none; -moz-user-select: none;
         | 
| 47 | 
            +
                    -ms-user-select: none; user-select: none;
         | 
| 48 | 
            +
                    padding: 0 4px; width: 4em;
         | 
| 49 | 
            +
                    color: #aaaaaa;
         | 
| 50 | 
            +
                  }
         | 
| 51 | 
            +
                pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa;  padding-left: 4px; }
         | 
| 52 | 
            +
                div.sourceCode
         | 
| 53 | 
            +
                  {   }
         | 
| 54 | 
            +
                @media screen {
         | 
| 55 | 
            +
                pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
         | 
| 56 | 
            +
                }
         | 
| 57 | 
            +
                code span.al { color: #ff0000; font-weight: bold; } /* Alert */
         | 
| 58 | 
            +
                code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
         | 
| 59 | 
            +
                code span.at { color: #7d9029; } /* Attribute */
         | 
| 60 | 
            +
                code span.bn { color: #40a070; } /* BaseN */
         | 
| 61 | 
            +
                code span.bu { color: #008000; } /* BuiltIn */
         | 
| 62 | 
            +
                code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
         | 
| 63 | 
            +
                code span.ch { color: #4070a0; } /* Char */
         | 
| 64 | 
            +
                code span.cn { color: #880000; } /* Constant */
         | 
| 65 | 
            +
                code span.co { color: #60a0b0; font-style: italic; } /* Comment */
         | 
| 66 | 
            +
                code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
         | 
| 67 | 
            +
                code span.do { color: #ba2121; font-style: italic; } /* Documentation */
         | 
| 68 | 
            +
                code span.dt { color: #902000; } /* DataType */
         | 
| 69 | 
            +
                code span.dv { color: #40a070; } /* DecVal */
         | 
| 70 | 
            +
                code span.er { color: #ff0000; font-weight: bold; } /* Error */
         | 
| 71 | 
            +
                code span.ex { } /* Extension */
         | 
| 72 | 
            +
                code span.fl { color: #40a070; } /* Float */
         | 
| 73 | 
            +
                code span.fu { color: #06287e; } /* Function */
         | 
| 74 | 
            +
                code span.im { color: #008000; font-weight: bold; } /* Import */
         | 
| 75 | 
            +
                code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
         | 
| 76 | 
            +
                code span.kw { color: #007020; font-weight: bold; } /* Keyword */
         | 
| 77 | 
            +
                code span.op { color: #666666; } /* Operator */
         | 
| 78 | 
            +
                code span.ot { color: #007020; } /* Other */
         | 
| 79 | 
            +
                code span.pp { color: #bc7a00; } /* Preprocessor */
         | 
| 80 | 
            +
                code span.sc { color: #4070a0; } /* SpecialChar */
         | 
| 81 | 
            +
                code span.ss { color: #bb6688; } /* SpecialString */
         | 
| 82 | 
            +
                code span.st { color: #4070a0; } /* String */
         | 
| 83 | 
            +
                code span.va { color: #19177c; } /* Variable */
         | 
| 84 | 
            +
                code span.vs { color: #4070a0; } /* VerbatimString */
         | 
| 85 | 
            +
                code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
         | 
| 86 | 
            +
              </style>
         | 
| 87 | 
            +
              <link rel="stylesheet" href="css/styles.css" />
         | 
| 88 | 
            +
              <!--[if lt IE 9]>
         | 
| 89 | 
            +
                <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
         | 
| 90 | 
            +
              <![endif]-->
         | 
| 91 | 
            +
            </head>
         | 
| 92 | 
            +
            <body>
         | 
| 93 | 
            +
            <p class="navbar">
         | 
| 94 | 
            +
            <span class="smallcaps">= <strong>“Sancho” Pages Puncher</strong> = <a
         | 
| 95 | 
            +
            href="readme.html">Readme</a> ~ <a href="changelog.html">Changelog</a> ~
         | 
| 96 | 
            +
            <a href="story.html">Story</a> ~ <a
         | 
| 97 | 
            +
            href="https://github.com/nvoynov/sancho">Github</a></span>
         | 
| 98 | 
            +
            </p>
         | 
| 99 | 
            +
            <header id="title-block-header">
         | 
| 100 | 
            +
            <h1 class="title">Sancho Readme</h1>
         | 
| 101 | 
            +
            </header>
         | 
| 102 | 
            +
            <nav id="TOC" role="doc-toc">
         | 
| 103 | 
            +
            <ul>
         | 
| 104 | 
            +
            <li><a href="#overview" id="toc-overview">Overview</a></li>
         | 
| 105 | 
            +
            <li><a href="#installation" id="toc-installation">Installation</a></li>
         | 
| 106 | 
            +
            <li><a href="#usage" id="toc-usage">Usage</a></li>
         | 
| 107 | 
            +
            <li><a href="#links" id="toc-links">Links</a></li>
         | 
| 108 | 
            +
            </ul>
         | 
| 109 | 
            +
            </nav>
         | 
| 110 | 
            +
            <h2 id="overview">Overview</h2>
         | 
| 111 | 
            +
            <p><code>Sancho</code> is static site generator for <a
         | 
| 112 | 
            +
            href="https://pages.github.com/">Github Pages</a> that proposes placing
         | 
| 113 | 
            +
            your site content under <code>docs</code> directory in a separate git
         | 
| 114 | 
            +
            branch branch.</p>
         | 
| 115 | 
            +
            <p>For rendering HTML <code>Sancho</code> utilizes <a
         | 
| 116 | 
            +
            href="https://pandoc.org">Pandoc</a>, and it is supposed that your site
         | 
| 117 | 
            +
            pages will be written in Markdown or <a
         | 
| 118 | 
            +
            href="https://pandoc.org/MANUAL.html#pandocs-markdown">Pandoc
         | 
| 119 | 
            +
            Markdown</a>.</p>
         | 
| 120 | 
            +
            <h2 id="installation">Installation</h2>
         | 
| 121 | 
            +
            <p>Run</p>
         | 
| 122 | 
            +
            <pre><code>bundle add sancho --git https://github.com/nvoynov/sancho.git</code></pre>
         | 
| 123 | 
            +
            <p>Require Sancho in Rakefile</p>
         | 
| 124 | 
            +
            <div class="sourceCode" id="cb2"><pre
         | 
| 125 | 
            +
            class="sourceCode ruby"><code class="sourceCode ruby"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="fu">require</span> <span class="st">"sancho"</span></span>
         | 
| 126 | 
            +
            <span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a>source, folders <span class="kw">=</span> <span class="dt">Sancho</span><span class="at">.tasks</span></span>
         | 
| 127 | 
            +
            <span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="dt">Rake</span><span class="at">.application.rake_require</span> source, folders</span></code></pre></div>
         | 
| 128 | 
            +
            <p>Install <a href="https://pandoc.org/installing.html">pandoc</a></p>
         | 
| 129 | 
            +
            <h2 id="usage">Usage</h2>
         | 
| 130 | 
            +
            <p><u>Basic flow</u></p>
         | 
| 131 | 
            +
            <ol type="1">
         | 
| 132 | 
            +
            <li>Commit your repo changes!</li>
         | 
| 133 | 
            +
            <li>Run <code>$ git checkout docs</code></li>
         | 
| 134 | 
            +
            <li>Run <code>$ rake sancho:init</code></li>
         | 
| 135 | 
            +
            <li>Customize <code>sancho.yml</code> for pages and
         | 
| 136 | 
            +
            <code>_layouts/header.md</code> for navbar</li>
         | 
| 137 | 
            +
            <li>Run <code>$ rake sancho:generate</code> to create your site</li>
         | 
| 138 | 
            +
            <li>Run <code>$ rake sancho:serve</code> to run the site locally</li>
         | 
| 139 | 
            +
            <li>Run <code>$ git push -u origin docs</code></li>
         | 
| 140 | 
            +
            </ol>
         | 
| 141 | 
            +
            <p><u>Template</u></p>
         | 
| 142 | 
            +
            <p>You can provide your own HTML template by placing
         | 
| 143 | 
            +
            <code>_layouts/template.html</code> file. Read <a
         | 
| 144 | 
            +
            href="https://pandoc.org/MANUAL.html#templates">Pandoc Templates</a>
         | 
| 145 | 
            +
            section for details.</p>
         | 
| 146 | 
            +
            <h2 id="links">Links</h2>
         | 
| 147 | 
            +
            <ul>
         | 
| 148 | 
            +
            <li><a href="https://www.zenspider.com/projects/zenweb.html">Zenweb,
         | 
| 149 | 
            +
            stupid fast static website generation</a></li>
         | 
| 150 | 
            +
            <li><a
         | 
| 151 | 
            +
            href="https://devcenter.heroku.com/articles/static-sites-ruby">Creating
         | 
| 152 | 
            +
            Static Sites in Ruby with Rack</a></li>
         | 
| 153 | 
            +
            </ul>
         | 
| 154 | 
            +
            <div id="footer">
         | 
| 155 | 
            +
            <hr />
         | 
| 156 | 
            +
            <p>© 2022-2023 <a href="http://nvoynov.github.io/">nvoynov</a></p>
         | 
| 157 | 
            +
            </div>
         | 
| 158 | 
            +
            </body>
         | 
| 159 | 
            +
            </html>
         | 
    
        data/docs/readme.html
    ADDED
    
    | @@ -0,0 +1,159 @@ | |
| 1 | 
            +
            <!DOCTYPE html>
         | 
| 2 | 
            +
            <html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
         | 
| 3 | 
            +
            <head>
         | 
| 4 | 
            +
              <meta charset="utf-8" />
         | 
| 5 | 
            +
              <meta name="generator" content="pandoc" />
         | 
| 6 | 
            +
              <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
         | 
| 7 | 
            +
              <meta name="keywords" content="ruby, github-pages-generator" />
         | 
| 8 | 
            +
              <title>Sancho Readme</title>
         | 
| 9 | 
            +
              <style>
         | 
| 10 | 
            +
                code{white-space: pre-wrap;}
         | 
| 11 | 
            +
                span.smallcaps{font-variant: small-caps;}
         | 
| 12 | 
            +
                div.columns{display: flex; gap: min(4vw, 1.5em);}
         | 
| 13 | 
            +
                div.column{flex: auto; overflow-x: auto;}
         | 
| 14 | 
            +
                div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
         | 
| 15 | 
            +
                ul.task-list{list-style: none;}
         | 
| 16 | 
            +
                ul.task-list li input[type="checkbox"] {
         | 
| 17 | 
            +
                  width: 0.8em;
         | 
| 18 | 
            +
                  margin: 0 0.8em 0.2em -1.6em;
         | 
| 19 | 
            +
                  vertical-align: middle;
         | 
| 20 | 
            +
                }
         | 
| 21 | 
            +
                .display.math{display: block; text-align: center; margin: 0.5rem auto;}
         | 
| 22 | 
            +
                /* CSS for syntax highlighting */
         | 
| 23 | 
            +
                pre > code.sourceCode { white-space: pre; position: relative; }
         | 
| 24 | 
            +
                pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
         | 
| 25 | 
            +
                pre > code.sourceCode > span:empty { height: 1.2em; }
         | 
| 26 | 
            +
                .sourceCode { overflow: visible; }
         | 
| 27 | 
            +
                code.sourceCode > span { color: inherit; text-decoration: inherit; }
         | 
| 28 | 
            +
                div.sourceCode { margin: 1em 0; }
         | 
| 29 | 
            +
                pre.sourceCode { margin: 0; }
         | 
| 30 | 
            +
                @media screen {
         | 
| 31 | 
            +
                div.sourceCode { overflow: auto; }
         | 
| 32 | 
            +
                }
         | 
| 33 | 
            +
                @media print {
         | 
| 34 | 
            +
                pre > code.sourceCode { white-space: pre-wrap; }
         | 
| 35 | 
            +
                pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
         | 
| 36 | 
            +
                }
         | 
| 37 | 
            +
                pre.numberSource code
         | 
| 38 | 
            +
                  { counter-reset: source-line 0; }
         | 
| 39 | 
            +
                pre.numberSource code > span
         | 
| 40 | 
            +
                  { position: relative; left: -4em; counter-increment: source-line; }
         | 
| 41 | 
            +
                pre.numberSource code > span > a:first-child::before
         | 
| 42 | 
            +
                  { content: counter(source-line);
         | 
| 43 | 
            +
                    position: relative; left: -1em; text-align: right; vertical-align: baseline;
         | 
| 44 | 
            +
                    border: none; display: inline-block;
         | 
| 45 | 
            +
                    -webkit-touch-callout: none; -webkit-user-select: none;
         | 
| 46 | 
            +
                    -khtml-user-select: none; -moz-user-select: none;
         | 
| 47 | 
            +
                    -ms-user-select: none; user-select: none;
         | 
| 48 | 
            +
                    padding: 0 4px; width: 4em;
         | 
| 49 | 
            +
                    color: #aaaaaa;
         | 
| 50 | 
            +
                  }
         | 
| 51 | 
            +
                pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa;  padding-left: 4px; }
         | 
| 52 | 
            +
                div.sourceCode
         | 
| 53 | 
            +
                  {   }
         | 
| 54 | 
            +
                @media screen {
         | 
| 55 | 
            +
                pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
         | 
| 56 | 
            +
                }
         | 
| 57 | 
            +
                code span.al { color: #ff0000; font-weight: bold; } /* Alert */
         | 
| 58 | 
            +
                code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
         | 
| 59 | 
            +
                code span.at { color: #7d9029; } /* Attribute */
         | 
| 60 | 
            +
                code span.bn { color: #40a070; } /* BaseN */
         | 
| 61 | 
            +
                code span.bu { color: #008000; } /* BuiltIn */
         | 
| 62 | 
            +
                code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
         | 
| 63 | 
            +
                code span.ch { color: #4070a0; } /* Char */
         | 
| 64 | 
            +
                code span.cn { color: #880000; } /* Constant */
         | 
| 65 | 
            +
                code span.co { color: #60a0b0; font-style: italic; } /* Comment */
         | 
| 66 | 
            +
                code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
         | 
| 67 | 
            +
                code span.do { color: #ba2121; font-style: italic; } /* Documentation */
         | 
| 68 | 
            +
                code span.dt { color: #902000; } /* DataType */
         | 
| 69 | 
            +
                code span.dv { color: #40a070; } /* DecVal */
         | 
| 70 | 
            +
                code span.er { color: #ff0000; font-weight: bold; } /* Error */
         | 
| 71 | 
            +
                code span.ex { } /* Extension */
         | 
| 72 | 
            +
                code span.fl { color: #40a070; } /* Float */
         | 
| 73 | 
            +
                code span.fu { color: #06287e; } /* Function */
         | 
| 74 | 
            +
                code span.im { color: #008000; font-weight: bold; } /* Import */
         | 
| 75 | 
            +
                code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
         | 
| 76 | 
            +
                code span.kw { color: #007020; font-weight: bold; } /* Keyword */
         | 
| 77 | 
            +
                code span.op { color: #666666; } /* Operator */
         | 
| 78 | 
            +
                code span.ot { color: #007020; } /* Other */
         | 
| 79 | 
            +
                code span.pp { color: #bc7a00; } /* Preprocessor */
         | 
| 80 | 
            +
                code span.sc { color: #4070a0; } /* SpecialChar */
         | 
| 81 | 
            +
                code span.ss { color: #bb6688; } /* SpecialString */
         | 
| 82 | 
            +
                code span.st { color: #4070a0; } /* String */
         | 
| 83 | 
            +
                code span.va { color: #19177c; } /* Variable */
         | 
| 84 | 
            +
                code span.vs { color: #4070a0; } /* VerbatimString */
         | 
| 85 | 
            +
                code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
         | 
| 86 | 
            +
              </style>
         | 
| 87 | 
            +
              <link rel="stylesheet" href="css/styles.css" />
         | 
| 88 | 
            +
              <!--[if lt IE 9]>
         | 
| 89 | 
            +
                <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
         | 
| 90 | 
            +
              <![endif]-->
         | 
| 91 | 
            +
            </head>
         | 
| 92 | 
            +
            <body>
         | 
| 93 | 
            +
            <p class="navbar">
         | 
| 94 | 
            +
            <span class="smallcaps">= <strong>“Sancho” Pages Puncher</strong> = <a
         | 
| 95 | 
            +
            href="readme.html">Readme</a> ~ <a href="changelog.html">Changelog</a> ~
         | 
| 96 | 
            +
            <a href="story.html">Story</a> ~ <a
         | 
| 97 | 
            +
            href="https://github.com/nvoynov/sancho">Github</a></span>
         | 
| 98 | 
            +
            </p>
         | 
| 99 | 
            +
            <header id="title-block-header">
         | 
| 100 | 
            +
            <h1 class="title">Sancho Readme</h1>
         | 
| 101 | 
            +
            </header>
         | 
| 102 | 
            +
            <nav id="TOC" role="doc-toc">
         | 
| 103 | 
            +
            <ul>
         | 
| 104 | 
            +
            <li><a href="#overview" id="toc-overview">Overview</a></li>
         | 
| 105 | 
            +
            <li><a href="#installation" id="toc-installation">Installation</a></li>
         | 
| 106 | 
            +
            <li><a href="#usage" id="toc-usage">Usage</a></li>
         | 
| 107 | 
            +
            <li><a href="#links" id="toc-links">Links</a></li>
         | 
| 108 | 
            +
            </ul>
         | 
| 109 | 
            +
            </nav>
         | 
| 110 | 
            +
            <h2 id="overview">Overview</h2>
         | 
| 111 | 
            +
            <p><code>Sancho</code> is static site generator for <a
         | 
| 112 | 
            +
            href="https://pages.github.com/">Github Pages</a> that proposes placing
         | 
| 113 | 
            +
            your site content under <code>docs</code> directory in a separate git
         | 
| 114 | 
            +
            branch branch.</p>
         | 
| 115 | 
            +
            <p>For rendering HTML <code>Sancho</code> utilizes <a
         | 
| 116 | 
            +
            href="https://pandoc.org">Pandoc</a>, and it is supposed that your site
         | 
| 117 | 
            +
            pages will be written in Markdown or <a
         | 
| 118 | 
            +
            href="https://pandoc.org/MANUAL.html#pandocs-markdown">Pandoc
         | 
| 119 | 
            +
            Markdown</a>.</p>
         | 
| 120 | 
            +
            <h2 id="installation">Installation</h2>
         | 
| 121 | 
            +
            <p>Run</p>
         | 
| 122 | 
            +
            <pre><code>bundle add sancho --git https://github.com/nvoynov/sancho.git</code></pre>
         | 
| 123 | 
            +
            <p>Require Sancho in Rakefile</p>
         | 
| 124 | 
            +
            <div class="sourceCode" id="cb2"><pre
         | 
| 125 | 
            +
            class="sourceCode ruby"><code class="sourceCode ruby"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="fu">require</span> <span class="st">"sancho"</span></span>
         | 
| 126 | 
            +
            <span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a>source, folders <span class="kw">=</span> <span class="dt">Sancho</span><span class="at">.tasks</span></span>
         | 
| 127 | 
            +
            <span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="dt">Rake</span><span class="at">.application.rake_require</span> source, folders</span></code></pre></div>
         | 
| 128 | 
            +
            <p>Install <a href="https://pandoc.org/installing.html">pandoc</a></p>
         | 
| 129 | 
            +
            <h2 id="usage">Usage</h2>
         | 
| 130 | 
            +
            <p><u>Basic flow</u></p>
         | 
| 131 | 
            +
            <ol type="1">
         | 
| 132 | 
            +
            <li>Commit your repo changes!</li>
         | 
| 133 | 
            +
            <li>Run <code>$ git checkout docs</code></li>
         | 
| 134 | 
            +
            <li>Run <code>$ rake sancho:init</code></li>
         | 
| 135 | 
            +
            <li>Customize <code>sancho.yml</code> for pages and
         | 
| 136 | 
            +
            <code>_layouts/header.md</code> for navbar</li>
         | 
| 137 | 
            +
            <li>Run <code>$ rake sancho:generate</code> to create your site</li>
         | 
| 138 | 
            +
            <li>Run <code>$ rake sancho:serve</code> to run the site locally</li>
         | 
| 139 | 
            +
            <li>Run <code>$ git push -u origin docs</code></li>
         | 
| 140 | 
            +
            </ol>
         | 
| 141 | 
            +
            <p><u>Template</u></p>
         | 
| 142 | 
            +
            <p>You can provide your own HTML template by placing
         | 
| 143 | 
            +
            <code>_layouts/template.html</code> file. Read <a
         | 
| 144 | 
            +
            href="https://pandoc.org/MANUAL.html#templates">Pandoc Templates</a>
         | 
| 145 | 
            +
            section for details.</p>
         | 
| 146 | 
            +
            <h2 id="links">Links</h2>
         | 
| 147 | 
            +
            <ul>
         | 
| 148 | 
            +
            <li><a href="https://www.zenspider.com/projects/zenweb.html">Zenweb,
         | 
| 149 | 
            +
            stupid fast static website generation</a></li>
         | 
| 150 | 
            +
            <li><a
         | 
| 151 | 
            +
            href="https://devcenter.heroku.com/articles/static-sites-ruby">Creating
         | 
| 152 | 
            +
            Static Sites in Ruby with Rack</a></li>
         | 
| 153 | 
            +
            </ul>
         | 
| 154 | 
            +
            <div id="footer">
         | 
| 155 | 
            +
            <hr />
         | 
| 156 | 
            +
            <p>© 2022-2023 <a href="http://nvoynov.github.io/">nvoynov</a></p>
         | 
| 157 | 
            +
            </div>
         | 
| 158 | 
            +
            </body>
         | 
| 159 | 
            +
            </html>
         | 
    
        data/docs/robots.txt
    ADDED
    
    
    
        data/docs/sitemap.xml
    ADDED
    
    | @@ -0,0 +1,30 @@ | |
| 1 | 
            +
            <?xml version='1.0' encoding='UTF-8'?>
         | 
| 2 | 
            +
            <urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         | 
| 3 | 
            +
                xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
         | 
| 4 | 
            +
                xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              <url>
         | 
| 7 | 
            +
                <loc>noynov.github.io/sancho/</loc>
         | 
| 8 | 
            +
                <lastmod>2024-03-08</lastmod>
         | 
| 9 | 
            +
                <changefreq>weekly</changefreq>
         | 
| 10 | 
            +
                <priority>1.0</priority>
         | 
| 11 | 
            +
              </url>
         | 
| 12 | 
            +
              <url>
         | 
| 13 | 
            +
                <loc>noynov.github.io/sancho/readme.html</loc>
         | 
| 14 | 
            +
                <lastmod>2024-03-08</lastmod>
         | 
| 15 | 
            +
                <changefreq>weekly</changefreq>
         | 
| 16 | 
            +
                <priority>0.8</priority>
         | 
| 17 | 
            +
              </url>
         | 
| 18 | 
            +
              <url>
         | 
| 19 | 
            +
                <loc>noynov.github.io/sancho/changelog.html</loc>
         | 
| 20 | 
            +
                <lastmod>2024-03-08</lastmod>
         | 
| 21 | 
            +
                <changefreq>weekly</changefreq>
         | 
| 22 | 
            +
                <priority>0.8</priority>
         | 
| 23 | 
            +
              </url>
         | 
| 24 | 
            +
              <url>
         | 
| 25 | 
            +
                <loc>noynov.github.io/sancho/story.html</loc>
         | 
| 26 | 
            +
                <lastmod>2024-03-08</lastmod>
         | 
| 27 | 
            +
                <changefreq>weekly</changefreq>
         | 
| 28 | 
            +
                <priority>0.8</priority>
         | 
| 29 | 
            +
              </url>
         | 
| 30 | 
            +
            </urlset>
         | 
    
        data/docs/story.html
    ADDED
    
    | @@ -0,0 +1,57 @@ | |
| 1 | 
            +
            <!DOCTYPE html>
         | 
| 2 | 
            +
            <html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
         | 
| 3 | 
            +
            <head>
         | 
| 4 | 
            +
              <meta charset="utf-8" />
         | 
| 5 | 
            +
              <meta name="generator" content="pandoc" />
         | 
| 6 | 
            +
              <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
         | 
| 7 | 
            +
              <meta name="dcterms.date" content="2023-01-28" />
         | 
| 8 | 
            +
              <meta name="keywords" content="ruby, github-pages-generator" />
         | 
| 9 | 
            +
              <title>Sancho Story</title>
         | 
| 10 | 
            +
              <style>
         | 
| 11 | 
            +
                code{white-space: pre-wrap;}
         | 
| 12 | 
            +
                span.smallcaps{font-variant: small-caps;}
         | 
| 13 | 
            +
                div.columns{display: flex; gap: min(4vw, 1.5em);}
         | 
| 14 | 
            +
                div.column{flex: auto; overflow-x: auto;}
         | 
| 15 | 
            +
                div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
         | 
| 16 | 
            +
                ul.task-list{list-style: none;}
         | 
| 17 | 
            +
                ul.task-list li input[type="checkbox"] {
         | 
| 18 | 
            +
                  width: 0.8em;
         | 
| 19 | 
            +
                  margin: 0 0.8em 0.2em -1.6em;
         | 
| 20 | 
            +
                  vertical-align: middle;
         | 
| 21 | 
            +
                }
         | 
| 22 | 
            +
                .display.math{display: block; text-align: center; margin: 0.5rem auto;}
         | 
| 23 | 
            +
              </style>
         | 
| 24 | 
            +
              <link rel="stylesheet" href="css/styles.css" />
         | 
| 25 | 
            +
              <!--[if lt IE 9]>
         | 
| 26 | 
            +
                <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
         | 
| 27 | 
            +
              <![endif]-->
         | 
| 28 | 
            +
            </head>
         | 
| 29 | 
            +
            <body>
         | 
| 30 | 
            +
            <p class="navbar">
         | 
| 31 | 
            +
            <span class="smallcaps">= <strong>“Sancho” Pages Puncher</strong> = <a
         | 
| 32 | 
            +
            href="readme.html">Readme</a> ~ <a href="changelog.html">Changelog</a> ~
         | 
| 33 | 
            +
            <a href="story.html">Story</a> ~ <a
         | 
| 34 | 
            +
            href="https://github.com/nvoynov/sancho">Github</a></span>
         | 
| 35 | 
            +
            </p>
         | 
| 36 | 
            +
            <header id="title-block-header">
         | 
| 37 | 
            +
            <h1 class="title">Sancho Story</h1>
         | 
| 38 | 
            +
            <p class="date">2023-01-28</p>
         | 
| 39 | 
            +
            </header>
         | 
| 40 | 
            +
            <p>Exercising with <a href="https://github.com/nvoynov/punch">Punch</a>
         | 
| 41 | 
            +
            and inspired by the result I decided to propose my private “clean domain
         | 
| 42 | 
            +
            development” services. Having written some content drafts, my first
         | 
| 43 | 
            +
            thought was to just use Jekyll as it is on nvoynov.github.io, but have
         | 
| 44 | 
            +
            searched a bit through the Internet I bumped into <a
         | 
| 45 | 
            +
            href="https://github.com/seattlerb/zenweb">zenweb</a> and decided to
         | 
| 46 | 
            +
            give it a try.</p>
         | 
| 47 | 
            +
            <p>Fortunately, something went wrong :) and a few of my content pages,
         | 
| 48 | 
            +
            despite all my dancing with a tambourine, just failed to translate into
         | 
| 49 | 
            +
            HTML. Being looking through <code>zenweb</code> code I realized that
         | 
| 50 | 
            +
            it’s actually easy to design on my own.</p>
         | 
| 51 | 
            +
            <p>So meet the Sancho :)</p>
         | 
| 52 | 
            +
            <div id="footer">
         | 
| 53 | 
            +
            <hr />
         | 
| 54 | 
            +
            <p>© 2022-2023 <a href="http://nvoynov.github.io/">nvoynov</a></p>
         | 
| 55 | 
            +
            </div>
         | 
| 56 | 
            +
            </body>
         | 
| 57 | 
            +
            </html>
         | 
    
        data/docs/styles.css
    ADDED
    
    | @@ -0,0 +1,90 @@ | |
| 1 | 
            +
            body {
         | 
| 2 | 
            +
              margin: auto;
         | 
| 3 | 
            +
              padding-right: 1em;
         | 
| 4 | 
            +
              padding-left: 1em;
         | 
| 5 | 
            +
              max-width: 44em;
         | 
| 6 | 
            +
              color: black;
         | 
| 7 | 
            +
              font-family: Verdana, sans-serif;
         | 
| 8 | 
            +
              font-size: 100%;
         | 
| 9 | 
            +
              line-height: 140%;
         | 
| 10 | 
            +
              color: #333;
         | 
| 11 | 
            +
            }
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            pre {
         | 
| 14 | 
            +
              border: 1px dotted gray;
         | 
| 15 | 
            +
              background-color: #ececec;
         | 
| 16 | 
            +
              color: #1111111;
         | 
| 17 | 
            +
              padding: 0.5em;
         | 
| 18 | 
            +
            }
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            code {
         | 
| 21 | 
            +
              font-family: monospace;
         | 
| 22 | 
            +
            }
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            h1 a, h2 a, h3 a, h4 a, h5 a {
         | 
| 25 | 
            +
              text-decoration: none;
         | 
| 26 | 
            +
              color: #7a5ada;
         | 
| 27 | 
            +
            }
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            h1, h2, h3, h4, h5 {
         | 
| 30 | 
            +
              font-family: verdana;
         | 
| 31 | 
            +
              font-weight: bold;
         | 
| 32 | 
            +
              border-bottom: 1px dotted black;
         | 
| 33 | 
            +
              color: #7a5ada;
         | 
| 34 | 
            +
            }
         | 
| 35 | 
            +
             | 
| 36 | 
            +
            h1 {
         | 
| 37 | 
            +
              font-size: 130%;
         | 
| 38 | 
            +
            }
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            h2 {
         | 
| 41 | 
            +
              font-size: 110%;
         | 
| 42 | 
            +
            }
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            h3 {
         | 
| 45 | 
            +
              font-size: 95%;
         | 
| 46 | 
            +
            }
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            h4 {
         | 
| 49 | 
            +
              font-size: 90%;
         | 
| 50 | 
            +
              font-style: italic;
         | 
| 51 | 
            +
            }
         | 
| 52 | 
            +
             | 
| 53 | 
            +
            h5 {
         | 
| 54 | 
            +
              font-size: 90%;
         | 
| 55 | 
            +
              font-style: italic;
         | 
| 56 | 
            +
            }
         | 
| 57 | 
            +
             | 
| 58 | 
            +
            h1.title {
         | 
| 59 | 
            +
              font-size: 200%;
         | 
| 60 | 
            +
              font-weight: bold;
         | 
| 61 | 
            +
              padding-top: 0.2em;
         | 
| 62 | 
            +
              padding-bottom: 0.2em;
         | 
| 63 | 
            +
              text-align: left;
         | 
| 64 | 
            +
              border: none;
         | 
| 65 | 
            +
            }
         | 
| 66 | 
            +
             | 
| 67 | 
            +
            dt code {
         | 
| 68 | 
            +
              font-weight: bold;
         | 
| 69 | 
            +
            }
         | 
| 70 | 
            +
             | 
| 71 | 
            +
            dd p {
         | 
| 72 | 
            +
              margin-top: 0;
         | 
| 73 | 
            +
            }
         | 
| 74 | 
            +
             | 
| 75 | 
            +
            #footer {
         | 
| 76 | 
            +
              padding-top: 1em;
         | 
| 77 | 
            +
              font-size: 70%;
         | 
| 78 | 
            +
              color: gray;
         | 
| 79 | 
            +
              text-align: center;
         | 
| 80 | 
            +
            }
         | 
| 81 | 
            +
             | 
| 82 | 
            +
            .navbar {
         | 
| 83 | 
            +
              background: #fff;
         | 
| 84 | 
            +
              border-bottom: 1px solid #000;
         | 
| 85 | 
            +
              margin: 0 0 1em;
         | 
| 86 | 
            +
              padding: 1em 0;
         | 
| 87 | 
            +
              position: sticky;
         | 
| 88 | 
            +
              top: 0;
         | 
| 89 | 
            +
              z-index: 100;
         | 
| 90 | 
            +
            }
         | 
    
        data/lib/config.ru
    ADDED
    
    | @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            # https://devcenter.heroku.com/articles/static-sites-ruby
         | 
| 2 | 
            +
            require 'rack/static'
         | 
| 3 | 
            +
            require 'sancho'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            use Rack::Static,
         | 
| 6 | 
            +
              :urls => ["/images", "/js", "/css"],
         | 
| 7 | 
            +
              :root => "docs"
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            text_plain = { 'content-type'  => 'text/plain' }
         | 
| 10 | 
            +
            text_html = {
         | 
| 11 | 
            +
              'content-type'  => 'text/html',
         | 
| 12 | 
            +
              'cache-control' => 'public, max-age=86400'
         | 
| 13 | 
            +
            }
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            run lambda {|env|
         | 
| 16 | 
            +
              target = env['REQUEST_PATH'][1..-1]
         | 
| 17 | 
            +
              source = File.join(Sancho::DOCS, target)
         | 
| 18 | 
            +
              return [404, text_plain, ['not found']] \
         | 
| 19 | 
            +
                unless File.exist?(source)
         | 
| 20 | 
            +
              [200, text_html, File.open(source, File::RDONLY)]
         | 
| 21 | 
            +
            }
         | 
    
        data/lib/sancho/conf.rb
    ADDED
    
    | @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            require 'psych'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Sancho
         | 
| 4 | 
            +
              class Conf < Data.define(:domain, :title, :pages)
         | 
| 5 | 
            +
                def self.read
         | 
| 6 | 
            +
                  return new(**Psych.load(File.read(CONF)).transform_keys(&:to_sym)) \
         | 
| 7 | 
            +
                    if File.exist?(CONF)
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                  new.tap{|o| File.write(CONF, Psych.dump(o.to_h.transform_keys(&:to_s))) }
         | 
| 10 | 
            +
                rescue => e
         | 
| 11 | 
            +
                  puts 'Sancho: reading config error', e.full_message
         | 
| 12 | 
            +
                  new
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                def initialize(domain: 'domain', title: 'title', pages: %w[README.md CHANGELOG.md])
         | 
| 16 | 
            +
                  super
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                CONF = 'sancho.yml'
         | 
| 20 | 
            +
              end
         | 
| 21 | 
            +
            end
         | 
    
        data/lib/sancho/page.rb
    ADDED
    
    | @@ -0,0 +1,11 @@ | |
| 1 | 
            +
            module Sancho
         | 
| 2 | 
            +
             | 
| 3 | 
            +
              class Page < Data.define(:source, :url, :date)
         | 
| 4 | 
            +
                def initialize(source:, url: '')
         | 
| 5 | 
            +
                  url = File.basename(source, '.md').downcase + '.html' if url.empty?
         | 
| 6 | 
            +
                  date = File.mtime(source).to_date
         | 
| 7 | 
            +
                  super(source: source, url: url, date: date)
         | 
| 8 | 
            +
                end
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            end
         | 
    
        data/lib/sancho/site.rb
    ADDED
    
    | @@ -0,0 +1,24 @@ | |
| 1 | 
            +
            require_relative 'page'
         | 
| 2 | 
            +
            require 'forwardable'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            module Sancho
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              class Site < Data.define(:domain, :title, :pages)
         | 
| 7 | 
            +
                extend Forwardable
         | 
| 8 | 
            +
                def_delegator :pages, :each, :each_page
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                def initialize(domain:, title:, pages:)
         | 
| 11 | 
            +
                  pages = pages.map{|e| Page.new(e) }
         | 
| 12 | 
            +
                  super
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                def pages_by_date
         | 
| 16 | 
            +
                  pages.sort{|a, b| b.date <=> a.date}
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                def <<(page)
         | 
| 20 | 
            +
                  with(pages: pages.unshift(page))
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            end
         | 
    
        data/lib/sancho.rb
    ADDED
    
    | @@ -0,0 +1,37 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
            require 'date'
         | 
| 3 | 
            +
            require_relative 'sancho/conf'
         | 
| 4 | 
            +
            require_relative 'sancho/page'
         | 
| 5 | 
            +
            require_relative 'sancho/site'
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            # Github Pages site generator
         | 
| 8 | 
            +
            module Sancho
         | 
| 9 | 
            +
              extend self
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              VERSION = "0.6.2"
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              DOCS = 'docs'.freeze
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              def root
         | 
| 16 | 
            +
                dir = File.dirname(__dir__)
         | 
| 17 | 
            +
                File.expand_path(dir)
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
              def assets
         | 
| 21 | 
            +
                File.join(root, '_layouts')
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              def docs
         | 
| 25 | 
            +
                Site.new(**Conf.read.to_h)
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
              def lib
         | 
| 29 | 
            +
                File.join(root, 'lib')
         | 
| 30 | 
            +
              end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
              # Rake.application.rake_require "tasks", [sancho]
         | 
| 33 | 
            +
              def tasks
         | 
| 34 | 
            +
                ['tasks', [lib]]
         | 
| 35 | 
            +
              end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            end
         |