Skip to content

Commit 40535c4

Browse files
committed
Added PDF download button
1 parent 194fc4a commit 40535c4

File tree

8 files changed

+16
-4
lines changed

8 files changed

+16
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Comprehensive Python Cheatsheet
22
===============================
3-
<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).
3+
<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).
44
</sup>
55

66
![Monty Python](web/image_888.jpeg)

index.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@
208208
</header>
209209

210210
<a href="javascript:" id="return-to-top"><i class="icon-chevron-up"></i></a>
211-
<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>.
212-
</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> = {
211+
<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>.
212+
</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> = {
213213
<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>],
214214
<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>],
215215
<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 @@
226226

227227

228228

229+
229230
<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>
230231
main()
231232
</code></pre></div>
@@ -2458,5 +2459,6 @@
24582459
<br>
24592460
<script src="web/jquery-3.4.0.min.js"></script>
24602461
<script src="web/script_2.js"></script>
2462+
<script type="text/javascript" src="https://transactions.sendowl.com/assets/sendowl.js" ></script>
24612463
</body>
24622464
</html>

parse.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ const showdown = require('showdown');
1515
const hljs = require('highlightjs');
1616

1717

18+
const PDF_BUTTON =
19+
'<a href="https://transactions.sendowl.com/products/78175486/4422834F/view" rel="nofollow"><img src="web/button.png" /></a>\n';
20+
1821
const TOC =
1922
'<br>' +
2023
'<h2 id="toc">Contents</h2>\n' +
@@ -92,13 +95,19 @@ function getMd() {
9295
}
9396

9497
function modifyPage() {
98+
addPdfButton()
9599
removeOrigToc();
96100
addToc();
97101
insertLinks();
98102
unindentBanner();
99103
highlightCode();
100104
}
101105

106+
function addPdfButton() {
107+
const nodes = $.parseHTML(PDF_BUTTON);
108+
$('img').first().parent().before(nodes);
109+
}
110+
102111
function removeOrigToc() {
103112
const headerContents = $('#contents');
104113
const contentsList = headerContents.next();

web/button.png

2.44 KB
Loading

web/index_for_pdf.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ <h3 id="h">H</h3>
6363
<strong>hexadecimal representation, <a href="#binhex">8</a></strong> </p>
6464
<h3 id="i">I</h3>
6565
<p><strong>image, <a href="#image">39</a></strong><br>
66-
<strong>inline, <a href="#inline">11</a>-12</strong><br>
66+
<strong>inline, <a href="#inline">11</a>-<a href="#namedtupleenumdataclass">12</a></strong><br>
6767
<strong>input function, <a href="#input">22</a></strong><br>
6868
<strong>introspection, <a href="#introspection">31</a></strong><br>
6969
<strong>ints, <a href="#abc">4</a>, <a href="#types">7</a>, <a href="#binhex">8</a></strong><br>

web/python-cheatsheet-4e31793.pdf

-583 KB
Binary file not shown.

web/python-cheatsheet-for-print.pdf

-561 KB
Binary file not shown.

web/template.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,5 +220,6 @@
220220
<br>
221221
<script src="web/jquery-3.4.0.min.js"></script>
222222
<script src="web/script_2.js"></script>
223+
<script type="text/javascript" src="https://transactions.sendowl.com/assets/sendowl.js" ></script>
223224
</body>
224225
</html>

0 commit comments

Comments
 (0)