Skip to content
This repository was archived by the owner on Nov 13, 2022. It is now read-only.

Commit b00e68e

Browse files
author
Hamel Husain
authored
Merge pull request #139 from fastai/fix-settings
Fix settings
2 parents d6e12ce + 9dbe043 commit b00e68e

File tree

6 files changed

+48
-19
lines changed

6 files changed

+48
-19
lines changed

.github/workflows/setup.yaml

100644100755
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,28 @@ jobs:
1919
run: |
2020
import re, os
2121
from pathlib import Path
22+
from configparser import ConfigParser
23+
config = ConfigParser()
2224
2325
nwo = os.getenv('GITHUB_REPOSITORY')
2426
username, repo_name = nwo.split('/')
2527
readme_template_path = Path('README_TEMPLATE.md')
2628
readme_path = Path('README.md')
2729
config_path = Path('_config.yml')
2830
pr_msg_path = Path('_setup_pr_template.md')
31+
settings = Path('_action_files/settings.ini')
2932
3033
assert readme_template_path.exists(), 'Did not find README_TEMPLATE.md in the current directory!'
3134
assert readme_path.exists(), 'Did not find README.md in the current directory!'
3235
assert config_path.exists(), 'Did not find _config.yml in the current directory!'
3336
assert pr_msg_path.exists(), 'Did not find _setup_pr_template.md in the current directory!'
37+
assert settings.exists(), 'Did not find _action_files/settings.ini in the current directory!'
38+
39+
# edit settings.ini file to inject baseurl
40+
config.read(settings)
41+
config['DEFAULT']['baseurl'] = repo_name
42+
with open('_action_files/settings.ini', 'w') as configfile:
43+
config.write(configfile)
3444
3545
# replace content of README with template
3646
readme = readme_template_path.read_text().replace('{_username_}', username).replace('{_repo_name_}', repo_name)
@@ -58,7 +68,7 @@ jobs:
5868
git rm _notebooks/2020-02-21-introducing-fastpages.ipynb
5969
git rm .github/workflows/chatops.yaml
6070
git rm -rf .github/ISSUE_TEMPLATE
61-
git add _config.yml README.md _setup_pr_template.md
71+
git add _config.yml README.md _setup_pr_template.md _action_files/settings.ini
6272
git commit -m'setup repo'
6373
git push -f --set-upstream origin fastpages-automated-setup
6474
env:

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@ help:
22
cat Makefile
33

44
# start (or restart) the services
5-
server:
5+
server: .FORCE
66
docker-compose down || true;
77
docker-compose up
88

99
# start (or restart) the services in detached mode
10-
server-detached:
10+
server-detached: .FORCE
1111
docker-compose down || true;
1212
docker-compose up -d
1313

1414
# build or rebuild the services WITHOUT cache
15-
build:
15+
build: .FORCE
1616
docker-compose stop || true; docker-compose rm || true;
1717
docker-compose build --force-rm --no-cache
1818

1919
# rebuild the services WITH cache
20-
quick-build:
20+
quick-build: .FORCE
2121
docker-compose stop || true;
2222
docker-compose build
2323

2424
# convert word & nb without Jekyll services
25-
convert:
25+
convert: .FORCE
2626
docker-compose up converter
2727

2828
# stop all containers

_action_files/settings.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ description = Writing a library entirely in notebooks
77
keywords = jupyter notebook
88
author = Sylvain Gugger and Jeremy Howard
99
author_email = [email protected]
10+
baseurl =
1011
title = nbdev
1112
copyright = fast.ai
1213
license = apache2
@@ -32,10 +33,11 @@ console_scripts = nbdev_build_lib=nbdev.cli:nbdev_build_lib
3233
nbs_path = nbs
3334
doc_path = images/copied_from_nb
3435
doc_host = https://nbdev.fast.ai
35-
doc_baseurl = {{site.baseurl}}/images/copied_from_nb/
36+
doc_baseurl = %(baseurl)s/images/copied_from_nb/
3637
git_url = https://github.com/fastai/nbdev/tree/master/
3738
lib_path = nbdev
3839
tst_flags = fastai2
3940
custom_sidebar = False
4041
cell_spacing = 1
4142
monospace_docstrings = False
43+

_config.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,28 @@ github_username: fastai
1313
github_repo: "fastpages"
1414

1515
# OPTIONAL: override baseurl and url if using a custom domain
16+
# Note: leave out the trailing / from this value.
1617
url: "https://fastpages.fast.ai" # the base hostname & protocol for your site, e.g. http://example.com
17-
baseurl: "" # the subpath of your site, e.g. "/blog". WARNING: if you are not using a custom domain, the baseurl *must* be set to your repo name.
18+
19+
###########################################################
20+
######### Special Instructions for baseurl ###############
21+
#
22+
#### Scenario One: If you do not have a Custom Domain #####
23+
# - if you are not using a custom domain, the baseurl *must* be set to your repo name
24+
#
25+
#### Scenario Two: If you have a Custom Domain #####
26+
# 1. If your domain does NOT have a subpath, this leave this value as ""
27+
# 2. If your domain does have a subpath, you must preceed the value with a / and NOT have a / at the end.
28+
# For example:
29+
# "" is valid
30+
# "/blog" is valid
31+
# "/blog/site/" is invalid ( / at the end)
32+
# "/blog/site" is valid
33+
# "blog/site" is invalid ( because doesn't begin with a /)
34+
#
35+
# 3. You must replace the parameter `baseurl` in _action_files/settings.ini with the same value as you set here but WITHOUT QUOTES.
36+
#
37+
baseurl: "" # the subpath of your site, e.g. "/blog".
1838

1939
# Email and twitter are optional:
2040
email:

_includes/image

Lines changed: 0 additions & 11 deletions
This file was deleted.

_includes/image.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<figure>
2+
{% if {{include.url}} %}<a class="no_icon" target="_blank" href="{{include.url}}">{% endif %}
3+
<img class="docimage" src="{{include.file}}" alt="{{include.alt}}" {% if {{include.max-width}} %}style="max-width: {{include.max-width}}px"{% endif %} />
4+
{% if {{include.url}} %}</a>{% endif %}
5+
{% if {{include.caption}} %}
6+
<figcaption>{{include.caption}}</figcaption>
7+
{% endif %}
8+
</figure>

0 commit comments

Comments
 (0)