Skip to content

Commit dcbcf34

Browse files
committed
Introduce new version of plugin (that works)
1 parent ed4fb9f commit dcbcf34

File tree

8 files changed

+114
-70
lines changed

8 files changed

+114
-70
lines changed

book.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
1212
1313
"language-picker",
14-
"sidebar-ad"
15-
"gitbook-plugin-codeblock-filename@git+https://github.com/aniav/gitbook-plugin-codeblock-filename.git"
14+
"sidebar-ad",
15+
"codeblock-filename@git+https://github.com/aniav/gitbook-plugin-codeblock-filename.git"
1616
],
1717
"pluginsConfig": {
1818
"ga": {

en/chromebook_setup/instructions.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ somewhere else that Cloud 9 sets up for you.
2121
Now you should see an interface with a sidebar, a big main window with some
2222
text, and a small window at the bottom that looks something like:
2323

24-
yourusername:~/workspace $
24+
```
25+
yourusername:~/workspace $
26+
```
2527

2628
This bottom area is your _terminal_, where you will give the computer Cloud 9
2729
has prepared for you instructions. You can resize that window to make it a bit
@@ -36,18 +38,22 @@ things don't get mixed up between projects.
3638

3739
In your terminal at the bottom of the Cloud 9 interface, run the following:
3840

39-
sudo apt install python3.5-venv
41+
{% filename %}Cloud 9{% endfilename %}
42+
```
43+
sudo apt install python3.5-venv
44+
```
4045

4146
If this still doesn't work, ask your coach for some help.
4247

4348
Next, run:
4449

50+
{% filename %}Cloud 9{% endfilename %}
4551
```
46-
mkdir djangogirls
47-
cd djangogirls
48-
python3.5 -mvenv myvenv
49-
source myvenv/bin/activate
50-
pip install django~=1.9.0
52+
mkdir djangogirls
53+
cd djangogirls
54+
python3.5 -mvenv myvenv
55+
source myvenv/bin/activate
56+
pip install django~=1.9.0
5157
```
5258

5359
(note that on the last line we use a tilde followed by an equal sign: ~=).

en/css/README.md

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ It was written by programmers who worked for Twitter. Now it's developed by volu
1818

1919
To install Bootstrap, you need to add this to your `<head>` in your `.html` file:
2020

21-
```html:blog/templates/blog/post_list.html
21+
{% filename %}blog/templates/blog/post_list.html{% endfilename %}
22+
```html
2223
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
2324
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
2425
```
@@ -42,7 +43,8 @@ Django already knows where to find the static files for the built-in "admin" app
4243

4344
We do that by creating a folder called `static` inside the blog app:
4445

45-
```:command-line
46+
{% filename %}command-line{% endfilename %}
47+
```
4648
djangogirls
4749
├── blog
4850
│ ├── migrations
@@ -58,7 +60,8 @@ Django will automatically find any folders called "static" inside any of your ap
5860

5961
Let's create a CSS file now, to add your own style to your web-page. Create a new directory called `css` inside your `static` directory. Then create a new file called `blog.css` inside this `css` directory. Ready?
6062

61-
```:command-line
63+
{% filename %}command-line{% endfilename %}
64+
```
6265
djangogirls
6366
└─── blog
6467
└─── static
@@ -75,7 +78,8 @@ To understand colors, computers use special codes. These codes start with `#` fo
7578

7679
In your `blog/static/css/blog.css` file you should add the following code:
7780

78-
```css:blog/static/css/blog.css
81+
{% filename %}blog/static/css/blog.css{% endfilename %}
82+
```css
7983
h1 a {
8084
color: #FCA205;
8185
}
@@ -94,22 +98,25 @@ Read about [CSS Selectors in w3schools](http://www.w3schools.com/cssref/css_sele
9498

9599
Then, we need to also tell our HTML template that we added some CSS. Open the `blog/templates/blog/post_list.html` file and add this line at the very beginning of it:
96100

97-
```html:blog/templates/blog/post_list.html
101+
{% filename %}blog/templates/blog/post_list.html{% endfilename %}
102+
```html
98103
{% load staticfiles %}
99104
```
100105

101106
We're just loading static files here :).
102107
Between the `<head>` and `</head>`, after the links to the Bootstrap CSS files add this line:
103108

104-
```html:blog/templates/blog/post_list.html
109+
{% filename %}blog/templates/blog/post_list.html{% endfilename %}
110+
```html
105111
<link rel="stylesheet" href="{% static 'css/blog.css' %}">
106112
```
107113
The browser reads the files in the order they're given, so we need to make sure this is in the right place. Otherwise the code in our file may override code in Bootstrap files.
108114
We just told our template where our CSS file is located.
109115

110116
Your file should now look like this:
111117

112-
```html:blog/templates/blog/post_list.html
118+
{% filename %}blog/templates/blog/post_list.html{% endfilename %}
119+
```html
113120
{% load staticfiles %}
114121
<html>
115122
<head>
@@ -140,7 +147,8 @@ OK, save the file and refresh the site!
140147

141148
Nice work! Maybe we would also like to give our website a little air and increase the margin on the left side? Let's try this!
142149

143-
```css:blog/static/css/blog.css
150+
{% filename %}blog/static/css/blog.css{% endfilename %}
151+
```css
144152
body {
145153
padding-left: 15px;
146154
}
@@ -152,15 +160,17 @@ Add this to your CSS, save the file and see how it works!
152160

153161
Maybe we can customize the font in our header? Paste this into your `<head>` in `blog/templates/blog/post_list.html` file:
154162

155-
```html:blog/templates/blog/post_list.html
163+
{% filename %}blog/templates/blog/post_list.html{% endfilename %}
164+
```html
156165
<link href="//fonts.googleapis.com/css?family=Lobster&subset=latin,latin-ext" rel="stylesheet" type="text/css">
157166
```
158167

159168
As before, check the order and place before the link to `blog/static/css/blog.css`. This line will import a font called *Lobster* from Google Fonts (https://www.google.com/fonts).
160169

161170
Find the `h1 a` declaration block (the code between braces `{` and `}`) in the CSS file `blog/static/css/blog.css`. Now add the line `font-family: 'Lobster';` between the braces, and refresh the page:
162171

163-
```css:blog/static/css/blog.css
172+
{% filename %}blog/static/css/blog.css{% endfilename %}
173+
```css
164174
h1 a {
165175
color: #FCA205;
166176
font-family: 'Lobster';
@@ -176,15 +186,17 @@ As mentioned above, CSS has a concept of classes. These allow you to name a part
176186

177187
Go ahead and name some parts of the HTML code. Add a class called `page-header` to your `div` that contains your header, like this:
178188

179-
```html:blog/templates/blog/post_list.html
189+
{% filename %}blog/templates/blog/post_list.html{% endfilename %}
190+
```html
180191
<div class="page-header">
181192
<h1><a href="/">Django Girls Blog</a></h1>
182193
</div>
183194
```
184195

185196
And now add a class `post` to your `div` containing a blog post.
186197

187-
```html:blog/templates/blog/post_list.html
198+
{% filename %}blog/templates/blog/post_list.html{% endfilename %}
199+
```html
188200
<div class="post">
189201
<p>published: {{ post.published_date }}</p>
190202
<h1><a href="">{{ post.title }}</a></h1>
@@ -194,7 +206,8 @@ And now add a class `post` to your `div` containing a blog post.
194206

195207
We will now add declaration blocks to different selectors. Selectors starting with `.` relate to classes. There are many great tutorials and explanations about CSS on the Web to help you understand the following code. For now, just copy and paste it into your `blog/static/css/blog.css` file:
196208

197-
```css:blog/static/css/blog.css
209+
{% filename %}blog/static/css/blog.css{% endfilename %}
210+
```css
198211
.page-header {
199212
background-color: #ff9400;
200213
margin-top: 0;
@@ -245,7 +258,8 @@ h1, h2, h3, h4 {
245258

246259
Then surround the HTML code which displays the posts with declarations of classes. Replace this:
247260

248-
```html:blog/templates/blog/post_list.html
261+
{% filename %}blog/templates/blog/post_list.html{% endfilename %}
262+
```html
249263
{% for post in posts %}
250264
<div class="post">
251265
<p>published: {{ post.published_date }}</p>
@@ -257,7 +271,8 @@ Then surround the HTML code which displays the posts with declarations of classe
257271

258272
in the `blog/templates/blog/post_list.html` with this:
259273

260-
```html:blog/templates/blog/post_list.html
274+
{% filename %}blog/templates/blog/post_list.html{% endfilename %}
275+
```html
261276
<div class="content container">
262277
<div class="row">
263278
<div class="col-md-8">

en/deploy/README.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Git tracks changes to a particular set of files in what's called a code reposito
2626

2727
> **Note** Check your current working directory with a `pwd` (OSX/Linux) or `cd` (Windows) command before initializing the repository. You should be in the `djangogirls` folder.
2828
29-
```:command-line
29+
{% filename %}command-line{% endfilename %}
30+
```
3031
$ git init
3132
Initialized empty Git repository in ~/djangogirls/.git/
3233
$ git config --global user.name "Your Name"
@@ -37,7 +38,8 @@ Initializing the git repository is something we only need to do once per project
3738

3839
Git will track changes to all the files and folders in this directory, but there are some files we want it to ignore. We do this by creating a file called `.gitignore` in the base directory. Open up your editor and create a new file with the following contents:
3940

40-
```:.gitignore
41+
{% filename %}.gitignore{% endfilename %}
42+
```
4143
*.pyc
4244
__pycache__
4345
myvenv
@@ -54,7 +56,8 @@ And save it as `.gitignore` in the "djangogirls" folder.
5456
5557
It's a good idea to use a `git status` command before `git add` or whenever you find yourself unsure of what has changed. This will help stop any surprises from happening, such as wrong files being added or commited. The `git status` command returns information about any untracked/modifed/staged files, branch status, and much more. The output should be similar to:
5658

57-
```:command-line
59+
{% filename %}command-line{% endfilename %}
60+
```
5861
$ git status
5962
On branch master
6063
@@ -73,7 +76,8 @@ nothing added to commit but untracked files present (use "git add" to track)
7376

7477
And finally we save our changes. Go to your console and run these commands:
7578

76-
```:command-line
79+
{% filename %}command-line{% endfilename %}
80+
```
7781
$ git add --all .
7882
$ git commit -m "My Django Girls app, first commit"
7983
[...]
@@ -102,14 +106,16 @@ Now we need to hook up the Git repository on your computer to the one up on GitH
102106

103107
Type the following into your console (Replace `<your-github-username>` with the username you entered when you created your GitHub account, but without the angle-brackets):
104108

105-
```:command-line
109+
{% filename %}command-line{% endfilename %}
110+
```
106111
$ git remote add origin https://github.com/<your-github-username>/my-first-blog.git
107112
$ git push -u origin master
108113
```
109114

110115
Enter your GitHub username and password and you should see something like this:
111116

112-
```:command-line
117+
{% filename %}command-line{% endfilename %}
118+
```
113119
Username for 'https://github.com': hjwp
114120
Password for 'https://[email protected]':
115121
Counting objects: 6, done.
@@ -140,13 +146,15 @@ When you've signed up for PythonAnywhere, you'll be taken to your dashboard or "
140146
141147
Let's pull down our code from GitHub and onto PythonAnywhere by creating a "clone" of our repo. Type the following into the console on PythonAnywhere (don't forget to use your GitHub username in place of `<your-github-username>`):
142148

143-
```:command-line
149+
{% filename %}command-line{% endfilename %}
150+
```
144151
$ git clone https://github.com/<your-github-username>/my-first-blog.git
145152
```
146153

147154
This will pull down a copy of your code onto PythonAnywhere. Check it out by typing `tree my-first-blog`:
148155

149-
```:command-line
156+
{% filename %}command-line{% endfilename %}
157+
```
150158
$ tree my-first-blog
151159
my-first-blog/
152160
├── blog
@@ -171,7 +179,8 @@ my-first-blog/
171179

172180
Just like you did on your own computer, you can create a virtualenv on PythonAnywhere. In the Bash console, type:
173181

174-
```:command-line
182+
{% filename %}command-line{% endfilename %}
183+
```
175184
$ cd my-first-blog
176185
177186
$ virtualenv --python=python3.5 myvenv
@@ -198,7 +207,8 @@ Here's another thing that's different between your own computer and the server:
198207

199208
We can initialise the database on the server just like we did the one on your own computer, with `migrate` and `createsuperuser`:
200209

201-
```:command-line
210+
{% filename %}command-line{% endfilename %}
211+
```
202212
(mvenv) $ python manage.py migrate
203213
Operations to perform:
204214
[...]
@@ -237,7 +247,8 @@ Click on the "WSGI configuration file" link (in the "Code" section near the top
237247

238248
Delete all the contents and replace them with something like this:
239249

240-
```python:&lt;your-username&gt;_pythonanywhere_com_wsgi.py
250+
{% filename %}<your-username>_pythonanywhere_com_wsgi.py{% endfilename %}
251+
```python
241252
import os
242253
import sys
243254

en/deploy/install_git.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,28 @@ If it isn't installed already, git should be available via your package manager,
1212

1313
#### Debian or Ubuntu
1414

15-
```:command-line
15+
{% filename %}command-line{% endfilename %}
16+
```bash
1617
$ sudo apt-get install git
1718
```
1819

1920
#### Fedora (up to 21)
2021

21-
```:command-line
22+
{% filename %}command-line{% endfilename %}
23+
```bash
2224
$ sudo yum install git
2325
```
2426

2527
#### Fedora (22+)
2628

27-
```:command-line
29+
{% filename %}command-line{% endfilename %}
30+
```bash
2831
$ sudo dnf install git
2932
```
3033

3134
#### openSUSE
3235

33-
```:command-line
36+
{% filename %}command-line{% endfilename %}
37+
```bash
3438
$ sudo zypper install git
3539
```

0 commit comments

Comments
 (0)