Merge pull request #25 from mwalzer/feature/issue22
[fix] suggestion to fix #22
chahuistle authored 6 years ago
GitHub committed 6 years ago
1130 | 1130 | label = "" |
1131 | 1131 | help_text = "" |
1132 | 1132 | # This tag is found in some descriptions |
1133 | desc = str(desc).replace("#br#", " <br>") | |
1133 | if not isinstance(desc, basestring): | |
1134 | desc = str(desc) | |
1135 | desc = desc.encode("utf8").replace("#br#", " <br>") | |
1134 | 1136 | # Get rid of dots in the end |
1135 | 1137 | if desc.endswith("."): |
1136 | desc = desc.rstrip(".") | |
1138 | desc = desc.rstrip(".") | |
1137 | 1139 | # Check if first word is a normal word and make it uppercase |
1138 | 1140 | if str(desc).find(" ") > -1: |
1139 | 1141 | first_word, rest = str(desc).split(" ", 1) |
1140 | 1142 | if str(first_word).islower(): |
1141 | # check if label has a quotient of the form a/b | |
1143 | # check if label has a quotient of the form a/b | |
1142 | 1144 | if first_word.find("/") != 1 : |
1143 | 1145 | first_word.capitalize() |
1144 | 1146 | desc = first_word + " " + rest |
1145 | label = desc | |
1147 | label = desc.decode("utf8") | |
1146 | 1148 | |
1147 | 1149 | # Try to split the label if it is too long |
1148 | 1150 | if len(desc) > 50: |