Skip to content

Commit

Permalink
add carbonad
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyguitar committed Nov 1, 2018
1 parent dd622f1 commit 33cf978
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 18 deletions.
2 changes: 2 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def find_key(token):
"*.cloudflare.com",
"*.googletagmanager.com",
"*.google-analytics.com",
"*.carbonads.com",
"*.carbonads.net",
"'unsafe-inline'",
"'unsafe-eval'",
],
Expand Down
1 change: 1 addition & 0 deletions docs/_static/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
!.gitignore
!guido.png
!style.css
!carbonad.css
90 changes: 90 additions & 0 deletions docs/_static/carbonad.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#carbonads {
display: block;
overflow: hidden;
padding: 1em;
padding-bottom: 0.3em;
line-height: 1.5;
border: 4px solid #f5f5f5;
margin-top: 10px;
margin-bottom: 10px;
}

#carbonads a {
text-decoration: none !important;
border-bottom: none;
}

#carbonads a:hover {
text-decoration: none !important;
}

#carbonads span {
display: block;
overflow: hidden;
}

.carbon-img {
display: block;
margin: 0 auto 8px;
}

.carbon-text {
display: block;
text-align: left;
margin-bottom: .5em;
color: #666;
}

.carbon-poweredby {
display: block;
text-align: right;
font-size: .9em;
color: #ccc;
}

@media only screen and (min-width: 320px) and (max-width: 875px) {
#carbonads {
float: none;
max-width: 330px;
border: 0;
display: block;
overflow: hidden;
margin-top: 20px;
margin-bottom: 20px;
border-radius: 4px;
text-align: center;
box-shadow: 0 0 0 1px hsla(0, 0%, 0%, .1);
font-size: var(--font-size);
background-color: #eee;
line-height: 1.5;
}
#carbonads span {
position: relative;
}
#carbonads > span {
max-width: none;
}
.carbon-img {
float: left;
margin: 0;
}

.carbon-img img {
max-width: 130px !important;
}
.carbon-text {
float: left;
margin-bottom: 0;
padding: 8px 20px;
text-align: left;
color: #333 !important;
max-width: calc(100% - 130px - 3em);
}
.carbon-poweredby {
left: 130px;
bottom: 0;
display: block;
color: #555 !important;
width: 100%;
}
}
1 change: 1 addition & 0 deletions docs/_templates/carbonad.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?serve={{ carbonad_serve }}&placement={{ carbonad_placement }}" id="_carbonads_js"></script>
47 changes: 29 additions & 18 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,13 @@
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = "pysheeet"
html_context = {"tracking_id": os.environ.get("TRACKING_ID")}
html_context = {
"tracking_id": os.environ.get("TRACKING_ID"),
"carbonad_serve": os.environ.get("CARBONAD_SERVE"),
"carbonad_placement": os.environ.get("CARBONAD_PLACEMENT")
}

has_carbonad = os.environ.get("CARBONAD_SERVE") and os.environ.get("CARBONAD_PLACEMENT")

# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
Expand All @@ -154,6 +160,8 @@
html_static_path = ['_static']

html_css_files = ['style.css']
if has_carbonad:
html_css_files.append('carbonad.css')

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
Expand All @@ -169,23 +177,26 @@
#html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
html_sidebars = {
'index': [
'sidebarintro.html',
'link.html',
'relations.html',
'github.html',
'searchbox.html'
],
'**': [
'sidebarintro.html',
'link.html',
'github.html',
'localtoc.html',
'relations.html',
'searchbox.html'
]
}
sidebar_index = [
'sidebarintro.html',
'link.html',
'github.html',
]
sidebar_notes = [
'sidebarintro.html',
'link.html',
'github.html',
]

if has_carbonad:
sidebar_index.append('carbonad.html')
sidebar_notes.append('carbonad.html')

sidebar_index.append('searchbox.html')
sidebar_notes.append('localtoc.html')
sidebar_notes.append('searchbox.html')
html_sidebars = {'index': sidebar_index, '**': sidebar_notes}


# Additional templates that should be rendered to pages, maps page names to
# template names.
Expand Down

0 comments on commit 33cf978

Please sign in to comment.