-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patch out bootstrap rule forcing black and white printing #3212
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -398,6 +398,28 @@ def run(self): | |
update_package_data(self.distribution) | ||
|
||
|
||
def patch_out_bootstrap_bw_print(): | ||
"""Hack! Manually patch out the bootstrap rule that forces printing in B&W. | ||
|
||
We haven't found a way to override this rule with another one. | ||
""" | ||
print_less = pjoin(static, 'components', 'bootstrap', 'less', 'print.less') | ||
with open(print_less) as f: | ||
lines = f.readlines() | ||
|
||
for ix, line in enumerate(lines): | ||
if 'Black prints faster' in line: | ||
break | ||
else: | ||
return # Already patched out, nothing to do. | ||
|
||
rmed = lines.pop(ix) | ||
print("Removed line", ix, "from bootstrap print.less:") | ||
print("-", rmed) | ||
print() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why this empty There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It makes a blank line, so the text above is slightly easier to pick out. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough 👍 |
||
with open(print_less, 'w') as f: | ||
f.writelines(lines) | ||
|
||
class CompileCSS(Command): | ||
"""Recompile Notebook CSS | ||
|
||
|
@@ -424,6 +446,8 @@ def run(self): | |
self.run_command('jsdeps') | ||
env = os.environ.copy() | ||
env['PATH'] = npm_path | ||
|
||
patch_out_bootstrap_bw_print() | ||
|
||
for src, dst in zip(self.sources, self.targets): | ||
try: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is enough specific to patch the proper line, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be. The original file is not very long:
https://github.com/twbs/bootstrap/blob/v3.3.7/less/print.less