diff --git a/rem2html/rem2html b/rem2html/rem2html index 5c9c6f69..449780d1 100644 --- a/rem2html/rem2html +++ b/rem2html/rem2html @@ -232,12 +232,17 @@ sub parse_input chomp($line); ($Month, $Year, $Numdays, $Firstwkday, $Mondayfirst) = split(' ', $line); + $Month =~ s/_/ /g; # Day names $line = ; return 0 unless $line; chomp($line); @Daynames = split(' ', $line); + for (my $i=0; $i<7; $i++) { + $Daynames[$i] =~ s/_/ /g; + } + # Prevmon prevlen $line = ; return 0 unless $line; diff --git a/rem2pdf/lib/Remind/PDF.pm b/rem2pdf/lib/Remind/PDF.pm index 1eb426e5..93dbc3c3 100644 --- a/rem2pdf/lib/Remind/PDF.pm +++ b/rem2pdf/lib/Remind/PDF.pm @@ -120,6 +120,7 @@ sub read_one_month # Month Year Days FirstWkday MondayFirst if ($line =~ /^(\S+) (\d+) (\d+) (\d+) (\d+)/) { $self->{monthname} = $1; + $self->{monthname} =~ s/_/ /g; $self->{year} = $2; $self->{daysinmonth} = $3; $self->{firstwkday} = $4; @@ -132,7 +133,7 @@ sub read_one_month $line = $in->getline(); chomp($line); if ($line =~ /^\S+ \S+ \S+ \S+ \S+ \S+ \S+$/) { - @{$self->{daynames}} = split(/ /, $line); + @{$self->{daynames}} = map { s/_/ /g; $_; } (split(/ /, $line)); } else { return (undef, "Cannot interpret line: $line"); } diff --git a/scripts/tkremind b/scripts/tkremind index bbec9638..bed0a9cc 100755 --- a/scripts/tkremind +++ b/scripts/tkremind @@ -964,9 +964,14 @@ proc FillCalWindow {} { gets $file line regexp {^([^ ]*) ([0-9][0-9][0-9][0-9]) ([0-9][0-9]?) ([0-9]) ([0-9])} $line dummy monthName year daysInMonth firstWkday mondayFirst + set monthName [regsub -all {_} $monthName " "] # Get the day names gets $file line - set DayNames $line + set DayNames {} + foreach day $line { + set day [regsub -all {_} $day " "]; + lappend DayNames $day + } ConfigureCalWindow $monthName $year $firstWkday $daysInMonth diff --git a/src/rem2ps.c b/src/rem2ps.c index 755b0e98..7c7bcd62 100644 --- a/src/rem2ps.c +++ b/src/rem2ps.c @@ -383,6 +383,7 @@ void DoPsCal(void) int firstcol; DynamicBuffer buf; CalEntry *c, *d, *p; + char *s; /* Read the month and year name, followed by # days in month and 1st day of month */ @@ -391,12 +392,28 @@ void DoPsCal(void) sscanf(DBufValue(&buf), "%s %s %d %d %d", month, year, &days, &wkday, &MondayFirst); + /* Replace underscores in month name with spaces */ + s = month; + while(*s) { + if (*s == '_') *s = ' '; + s++; + } + /* Get day names */ DBufGets(&buf, stdin); sscanf(DBufValue(&buf), "%32s %32s %32s %32s %32s %32s %32s", DayName[0], DayName[1], DayName[2], DayName[3], DayName[4], DayName[5], DayName[6]); + /* Replace underscores in day names with spaces */ + for (i=0; i<7; i++) { + s = DayName[i]; + while(*s) { + if (*s == '_') *s = ' '; + s++; + } + } + /* We write the prolog here because it's only at this point that MondayFirst is set correctly. */ if (validfile == 1) {