Comments (3)
So, this is really a blogofile issue, not a blogofile_blog one, correct? Though, of course, you need a site, which comes from a plugin like blogofile_blog, to demonstrate the issue.
from blogofile_blog.
Yes, the issue is with the function itself in blogofile/util.py — either we could add a clause to it like the one it already has for assuring that the links it generates are preceded with slashes that also checks for a terminal slash, or we could add the clause behind a test for a new option "append_slash_to_site_paths" or something so that people would have to make a deliberate change to get the new behavior. (And thanks, by the way, for taking over blogofile — it has been great to watch all the activity on github each time I log in, because of your work!)
from blogofile_blog.
So, just adding a trailing slash would break this use case:
<script src="${bf.util.site_path_helper('js/libs/modernizr-1.7.min.js')}"></script>
That breakage could be avoided by checking for a file extension at the end of the path and only adding the trailing slash if there wasn't one, but that feels like it could be fraught with other exceptions.
Add to the above that "explicit is better than implicit" and we arrive at a new function signature:
site_path_helper(*parts, trailing_slash=False)
It turns out that a signature like that is valid in Python 3, but not in Python 2. Who knew? Certainly not me. To suppport both version the signature has to be:
site_path_helper(*parts, **kwargs)
and the function has to do the kwargs-processing dance.
This may be the first time I've hit one of the syntactic improvements in Python 3 that has really made me regret having to support Python 2 as well. The Python 3 version is just plain clearer and more elegant. Fodder for your code beauty talk?
from blogofile_blog.
Related Issues (16)
- Add YAML syntax tip to "Post has bad YAML" error msg
- Tags don't do anything. HOT 2
- Fix template lookup order HOT 1
- Build fails with UUID in permalink (Py3k)
- Add command line option to `post create` specify markup type
- Release 0.8
- Improve image inclusion in rst posts
- blog template nav_class does not work on windows (header.mako) HOT 1
- Enable excerpt generation by both BeautifulSoup & lxml
- Unicode characters not handled by syntax highlighter HOT 1
- md vs. markdown extension & filter chains HOT 2
- Extra space in pygments CSS file path HOT 1
- Explicit post slugs are not applied
- Adding rel="prev" and rel="next" to chronological blog template HOT 1
- Reading UTF-8 posts broken on Windows
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blogofile_blog.