Skip to content

Commit b656877

Browse files
committed
Added contents to README.md
1 parent 21dcea9 commit b656877

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ Comprehensive Python Cheatsheet
66
![Monty Python](web/image_888.jpeg)
77

88

9+
Contents
10+
--------
11+
**   ** **1. Collections:** ** ** **[`List`](#list)**__,__ **[`Dict`](#dictionary)**__,__ **[`Set`](#set)**__,__ **[`Range`](#range)**__,__ **[`Enumerate`](#enumerate)**__,__ **[`Namedtuple`](#named-tuple)**__,__ **[`Iterator`](#iterator)**__,__ **[`Generator`](#generator)**__.__
12+
**   ** **2. Types:** **          ** **[`Type`](#type)**__,__ **[`String`](#string)**__,__ **[`Regex`](#regex)**__,__ **[`Format`](#format)**__,__ **[`Numbers`](#numbers)**__,__ **[`Combinatorics`](#combinatorics)**__,__ **[`Datetime`](#datetime)**__.__
13+
**   ** **3. Syntax:** **         ** **[`Arguments`](#arguments)**__,__ **[`Splat`](#splat-operator)**__,__ **[`Inline`](#inline)**__,__ **[`Closure`](#closure)**__,__ **[`Decorator`](#decorator)**__,__ **[`Class`](#class)**__,__ **[`Enum`](#enum)**__,__ **[`Exceptions`](#exceptions)**__.__
14+
**   ** **4. System:** **        ** **[`Print`](#print)**__,__ **[`Input`](#input)**__,__ **[`Command_Line_Arguments`](#command-line-arguments)**__,__ **[`Open`](#open)**__,__ **[`Path`](#path)**__,__ **[`Command_Execution`](#command-execution)**__.__
15+
**   ** **5. Data:** **             ** **[`CSV`](#csv)**__,__ **[`JSON`](#json)**__,__ **[`Pickle`](#pickle)**__,__ **[`SQLite`](#sqlite)**__,__ **[`Bytes`](#bytes)**__,__ **[`Struct`](#struct)**__,__ **[`Array`](#array)**__,__ **[`MemoryView`](#memory-view)**__,__ **[`Deque`](#deque)**__.__
16+
**   ** **6. Advanced:** **   ** **[`Threading`](#threading)**__,__ **[`Introspection`](#introspection)**__,__ **[`Metaprograming`](#metaprograming)**__,__ **[`Operator`](#operator)**__,__ **[`Eval`](#eval)**__,__ **[`Coroutine`](#coroutine)**__.__
17+
**   ** **7. Libraries:** **      ** **[`Progress_Bar`](#progress-bar)**__,__ **[`Plot`](#plot)**__,__ **[`Table`](#table)**__,__ **[`Curses`](#curses)**__,__ **[`Logging`](#logging)**__,__ **[`Scraping`](#scraping)**__,__ **[`Web`](#web)**__,__ **[`Profile`](#profile)**__,__
18+
**                                 ** **[`NumPy`](#numpy)**__,__ **[`Image`](#image)**__,__ **[`Audio`](#audio)**__.__
19+
20+
921
Main
1022
----
1123
```python

web/script.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ $(document).ready(function() {
55
function parseMd() {
66
var GITHUB = 'https://raw.githubusercontent.com/gto76/python-cheatsheet/master/README.md'
77
jQuery.get(GITHUB, function(text) {
8+
text = removeMdToc(text)
89
var converter = new showdown.Converter()
910
html = converter.makeHtml(text)
1011
aDiv = $('#main_container')
@@ -16,6 +17,23 @@ function parseMd() {
1617
});
1718
}
1819

20+
function removeMdToc(text) {
21+
out = []
22+
lines = text.match(/[^\r\n]+/g);
23+
insideContents = false
24+
for (line of lines) {
25+
if (line.trim() === 'Contents') {
26+
insideContents = true
27+
} else if (line.trim() === 'Main') {
28+
insideContents = false
29+
}
30+
if (!insideContents) {
31+
out.push(line)
32+
}
33+
}
34+
return out
35+
}
36+
1937
function insertLinks() {
2038
$('h2').each(function() {
2139
aId = $(this).attr('id')

0 commit comments

Comments
 (0)