Skip to content
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

Fixes emoji titles by uppercasing only letters. #232

Merged
merged 1 commit into from Aug 16, 2018

Conversation

samueldr
Copy link
Member

@samueldr samueldr commented Aug 16, 2018

Template Toolkit doesn't really care about UTF-8, but this ISN'T
template toolit's fault. This was ucfirst that was munging the
initial emoji.


Before this fix:

[nix-shell:~/.../nixos/nixos-homepage]$ rm index.html ; make index.html
tpage \
  --pre_chomp --post_chomp \
  --define modifiedAt="`git log -1 --pretty='%ai' index.tt`" \
  --define modifiedBy="`git log -1 --pretty='%an' index.tt`" \
  --define root=`echo index.html | sed -e 's|[^/]||g' -e 's|/|../|g'` \
  --define fileName=index.tt \
  --pre_process=nix-release.tt --pre_process=nixos-release.tt --pre_process=common.tt \
  index.tt > index.html.tmp
xmllint --nonet --noout index.html.tmp
index.html.tmp:290: parser error : Input is not proper UTF-8, indicate encoding !
Bytes: 0x8F 0x83 0xF0 0x9F
             <a href="http://grahamc.com/blog/cache-nixos-org-now-more-local">П
                                                                               ^
make: *** [Makefile:132: index.html] Error 1

After the fix:

[nix-shell:~/.../nixos/nixos-homepage]$ rm index.html ; make index.html
tpage \
  --pre_chomp --post_chomp \
  --define modifiedAt="`git log -1 --pretty='%ai' index.tt`" \
  --define modifiedBy="`git log -1 --pretty='%an' index.tt`" \
  --define root=`echo index.html | sed -e 's|[^/]||g' -e 's|/|../|g'` \
  --define fileName=index.tt \
  --pre_process=nix-release.tt --pre_process=nixos-release.tt --pre_process=common.tt \
  index.tt > index.html.tmp
xmllint --nonet --noout index.html.tmp
mv index.html.tmp index.html

image

The running individual is present and doesn't trip up the site update process.


This fixes the issue where anything that gets "made" (make'd) after index.html isn't being built.

Template Toolkit doesn't really care about UTF-8, but this ISN'T
template toolit's fault. This was `ucfirst` that was munging the
initial emoji.
@grahamc
Copy link
Member

grahamc commented Aug 16, 2018

I've papered over the issue by deleting the emoji, but would like to add it back.

@samueldr
Copy link
Member Author

Additional proof that this was the only issue, the website updated.

@edolstra
Copy link
Member

but this ISN'T template toolit's fault

A bug in ucfirst is template toolkit's fault right?

@edolstra edolstra merged commit 1e3957a into NixOS:master Aug 16, 2018
@samueldr
Copy link
Member Author

Ah, you're right. My experience with perl is really limited. I assumed that ucfirst was perl's ucfirst, didn't test it actuallt reproduced the error; but when searching online saw corroborating statements.

It must have been VMethods' ucfirst.

This works fine (in the console)

#!/usr/bin/env perl

use strict;

print ucfirst("a\n");
print ucfirst("hi! 🏃💨\n");
print ucfirst("!hi! 🏃💨\n");
print ucfirst("🏃💨\n");

(I don't know how to call VMethods outside of template toolkit.)

@samueldr samueldr deleted the fix/emojititles branch October 10, 2018 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants