Browse Source

Added PDF download button

pull/46/head
Jure Šorn 5 years ago
parent
commit
40535c474e
8 changed files with 16 additions and 4 deletions
  1. 2
      README.md
  2. 6
      index.html
  3. 9
      parse.js
  4. BIN
      web/button.png
  5. 2
      web/index_for_pdf.html
  6. BIN
      web/python-cheatsheet-4e31793.pdf
  7. BIN
      web/python-cheatsheet-for-print.pdf
  8. 1
      web/template.html

2
README.md

@ -1,6 +1,6 @@
Comprehensive Python Cheatsheet
===============================
<sup>[Download text file](https://raw.githubusercontent.com/gto76/python-cheatsheet/master/README.md), [PDF](https://gto76.github.io/python-cheatsheet/web/python-cheatsheet-4e31793.pdf), [Fork me on GitHub](https://github.com/gto76/python-cheatsheet) or [Check out FAQ](https://github.com/gto76/python-cheatsheet/wiki/Frequently-Asked-Questions).
<sup>[Download text file](https://raw.githubusercontent.com/gto76/python-cheatsheet/master/README.md), [Fork me on GitHub](https://github.com/gto76/python-cheatsheet) or [Check out FAQ](https://github.com/gto76/python-cheatsheet/wiki/Frequently-Asked-Questions).
</sup>
![Monty Python](web/image_888.jpeg)

6
index.html

@ -208,8 +208,8 @@ pre.prettyprint {
</header>
<a href="javascript:" id="return-to-top"><i class="icon-chevron-up"></i></a>
<div><h1 id="comprehensivepythoncheatsheet">Comprehensive Python Cheatsheet</h1><p class="banner"><sup><a href="https://raw.githubusercontent.com/gto76/python-cheatsheet/master/README.md">Download text file</a>, <a href="https://gto76.github.io/python-cheatsheet/web/python-cheatsheet-4e31793.pdf">PDF</a>, <a href="https://github.com/gto76/python-cheatsheet">Fork me on GitHub</a> or <a href="https://github.com/gto76/python-cheatsheet/wiki/Frequently-Asked-Questions">Check out FAQ</a>.
</sup></p><p class="banner"><img src="web/image_888.jpeg" alt="Monty Python"></p><br><div><h2 id="toc"><a href="#toc" name="toc">#</a>Contents</h2><pre><code class="hljs bash"><strong>ToC</strong> = {
<div><h1 id="comprehensivepythoncheatsheet">Comprehensive Python Cheatsheet</h1><p class="banner"><sup><a href="https://raw.githubusercontent.com/gto76/python-cheatsheet/master/README.md">Download text file</a>, <a href="https://github.com/gto76/python-cheatsheet">Fork me on GitHub</a> or <a href="https://github.com/gto76/python-cheatsheet/wiki/Frequently-Asked-Questions">Check out FAQ</a>.
</sup></p><a href="https://transactions.sendowl.com/products/78175486/4422834F/view" rel="nofollow" class="banner"><img src="web/button.png"></a><p><img src="web/image_888.jpeg" alt="Monty Python"></p><br><div><h2 id="toc"><a href="#toc" name="toc">#</a>Contents</h2><pre><code class="hljs bash"><strong>ToC</strong> = {
<strong><span class="hljs-string"><span class="hljs-string">'1. Collections'</span></span></strong>: [<a href="#list">List</a>, <a href="#dictionary">Dictionary</a>, <a href="#set">Set</a>, <a href="#tuple">Tuple</a>, <a href="#range">Range</a>, <a href="#enumerate">Enumerate</a>, <a href="#iterator">Iterator</a>, <a href="#generator">Generator</a>],
<strong><span class="hljs-string"><span class="hljs-string">'2. Types'</span></span></strong>: [<a href="#type">Type</a>, <a href="#string">String</a>, <a href="#regex">Regular_Exp</a>, <a href="#format">Format</a>, <a href="#numbers">Numbers</a>, <a href="#combinatorics">Combinatorics</a>, <a href="#datetime">Datetime</a>],
<strong><span class="hljs-string"><span class="hljs-string">'3. Syntax'</span></span></strong>: [<a href="#arguments">Args</a>, <a href="#inline">Inline</a>, <a href="#closure">Closure</a>, <a href="#decorator">Decorator</a>, <a href="#class">Class</a>, <a href="#ducktypes">Duck_Types</a>, <a href="#enum">Enum</a>, <a href="#exceptions">Exceptions</a>],
@ -226,6 +226,7 @@ pre.prettyprint {
<div><h2 id="main"><a href="#main" name="main">#</a>Main</h2><pre><code class="python language-python hljs"><span class="hljs-keyword">if</span> __name__ == <span class="hljs-string">'__main__'</span>: <span class="hljs-comment"># Runs main() if file wasn't imported.</span>
main()
</code></pre></div>
@ -2458,5 +2459,6 @@ simpleaudio.play_buffer(samples_b, <span class="hljs-number">1</span>, <span cla
<br>
<script src="web/jquery-3.4.0.min.js"></script>
<script src="web/script_2.js"></script>
<script type="text/javascript" src="https://transactions.sendowl.com/assets/sendowl.js" ></script>
</body>
</html>

9
parse.js

@ -15,6 +15,9 @@ const showdown = require('showdown');
const hljs = require('highlightjs');
const PDF_BUTTON =
'<a href="https://transactions.sendowl.com/products/78175486/4422834F/view" rel="nofollow"><img src="web/button.png" /></a>\n';
const TOC =
'<br>' +
'<h2 id="toc">Contents</h2>\n' +
@ -92,6 +95,7 @@ function getMd() {
}
function modifyPage() {
addPdfButton()
removeOrigToc();
addToc();
insertLinks();
@ -99,6 +103,11 @@ function modifyPage() {
highlightCode();
}
function addPdfButton() {
const nodes = $.parseHTML(PDF_BUTTON);
$('img').first().parent().before(nodes);
}
function removeOrigToc() {
const headerContents = $('#contents');
const contentsList = headerContents.next();

BIN
web/button.png

Before After
Width: 180  |  Height: 38  |  Size: 2.4 KiB

2
web/index_for_pdf.html

@ -63,7 +63,7 @@
<strong>hexadecimal representation, <a href="#binhex">8</a></strong> </p>
<h3 id="i">I</h3>
<p><strong>image, <a href="#image">39</a></strong><br>
<strong>inline, <a href="#inline">11</a>-12</strong><br>
<strong>inline, <a href="#inline">11</a>-<a href="#namedtupleenumdataclass">12</a></strong><br>
<strong>input function, <a href="#input">22</a></strong><br>
<strong>introspection, <a href="#introspection">31</a></strong><br>
<strong>ints, <a href="#abc">4</a>, <a href="#types">7</a>, <a href="#binhex">8</a></strong><br>

BIN
web/python-cheatsheet-4e31793.pdf

BIN
web/python-cheatsheet-for-print.pdf

1
web/template.html

@ -220,5 +220,6 @@ pre.prettyprint {
<br>
<script src="web/jquery-3.4.0.min.js"></script>
<script src="web/script_2.js"></script>
<script type="text/javascript" src="https://transactions.sendowl.com/assets/sendowl.js" ></script>
</body>
</html>
Loading…
Cancel
Save