diff --git a/taggedTextMast.php b/taggedTextMast.php index 5a5040c..5e4b372 100644 --- a/taggedTextMast.php +++ b/taggedTextMast.php @@ -1 +1 @@ - # with a THIN SPACE (U+2009,  ). # This is for cases like "B. D. Colen" -> "B.D. Colen", # "Bruno B. F. Faviero" -> "Bruno B.F. Faviero", and # "Jonathon E. D. Richmond" -> "Jonathan E.D. Richmond PhD" $members = preg_replace( '/([A-Z]\.) ([A-Z]\. )/', '$1' . mb_convert_encoding(' ', 'UTF-8', 'HTML-ENTITIES') . '$2', $members); $seperator = ", "; # Production positioning hack: replace "Associate " with "Assoc-iateN", # where the hyphen is discretionary (aka soft) and the N is a nonbreaking # space. This reduces the liklihood that a line will break as: # _DEPARTMENT_ # Editor: .... Associate # Editor: ... # and cause confusion or bad copyfitting as a result. $title = preg_replace( '/Associate /', 'Assoc' . mb_convert_encoding('­', 'UTF-8', 'HTML-ENTITIES') . 'iate' . mb_convert_encoding(' ', 'UTF-8', 'HTML-ENTITIES'), $title); if ($title == '') return join($seperator, $members); // For AdBoard if (sizeof($members) > 1 and !preg_match("/Staff$/", $title)) { $title = $title . (substr($title, -1) == "s" ? "es" : "s"); } return "$title: " . join($seperator, $members); } # Takes department name and array of positions to array of members and returns # formatted text function formatDepartment($name, $positions) { // Editors at Larger and AdBoard don't modify their dept names if(!($name == "Editors at Large" or $name == "Advisory Board" or $name == "Production Staff for This Issue")) { $name = $name . " Staff"; } $folded = array(); foreach ($positions as $title => $members) { array_push($folded, formatPosition($title, $members)); } $folded = join('; ', $folded); return "$name\r" . "$folded."; } $depts = getDepartments(); // Exec board gets special formatting $exec = getDepartmentMembers(array_shift($depts)); header('Content-Type: text/plain; charset="UTF-16BE"'); header('Content-Disposition: attachment; filename=masthead.txt'); // XXX: Due to a bug in PHP - kinda http://bugs.php.net/34776 (although some // may also argue PHP itself is the bug) - the BOM must be output before we do // the rest of the conversion. Now, this will also cause headers to be sent, // which will mean that when we flush output at the bottom it'll try to send // headers again and emit a warning. echo("\xfe\xff"); // BOM for proper UTF-16BE detection mb_internal_encoding("UTF-8"); mb_http_output("UTF-16BE"); ob_start("mb_output_handler"); ?> $members) { // Exec has Shift-returns (a.k.a just a newline) between titles and names $person = "\n".$members[0]; ?> array("@@", "@@"), "Staff" => array("@@"), "Copy Editors" => array("@@"))) . "\r"; // Time for the copyright with the current year $currentyear=date("Y"); ?> The Tech (ISSN 0148-9607) is published on Tuesdays and Fridays during the academic year (except during MIT vacations), Wednesdays during January, and monthly during the summer by The Tech, Room W20-483, 84 Massachusetts Avenue, Cambridge, Mass. 02139. Subscriptions are $50.00 per year (third class). Postmaster: Please send all address changes to our mailing address: The Tech, P.O. Box 397029, Cambridge, Mass. 02139-7029. Telephone: Editorial: (617) 253-1541. Business: (617) 258-8324. Facsimile: (617) 258-8226. Advertising, subscription, and typesetting rates available. Entire contents © The Tech. Printed on recycled paper by Mass Web Printing Company. # with a THIN SPACE (U+2009,  ). # This is for cases like "B. D. Colen" -> "B.D. Colen", # "Bruno B. F. Faviero" -> "Bruno B.F. Faviero", and # "Jonathon E. D. Richmond" -> "Jonathan E.D. Richmond PhD" $members = preg_replace( '/([A-Z]\.) ([A-Z]\. )/', '$1' . mb_convert_encoding(' ', 'UTF-8', 'HTML-ENTITIES') . '$2', $members); $seperator = ", "; # Production positioning hack: replace "Associate " with "Assoc-iateN", # where the hyphen is discretionary (aka soft) and the N is a nonbreaking # space. This reduces the liklihood that a line will break as: # _DEPARTMENT_ # Editor: .... Associate # Editor: ... # and cause confusion or bad copyfitting as a result. $title = preg_replace( '/Associate /', 'Assoc' . mb_convert_encoding('­', 'UTF-8', 'HTML-ENTITIES') . 'iate' . mb_convert_encoding(' ', 'UTF-8', 'HTML-ENTITIES'), $title); if ($title == '') return join($seperator, $members); // For AdBoard if (sizeof($members) > 1 and !preg_match("/Staff$/", $title)) { $title = $title . (substr($title, -1) == "s" ? "es" : "s"); } return "$title: " . join($seperator, $members); } # Takes department name and array of positions to array of members and returns # formatted text function formatDepartment($name, $positions) { // Editors at Larger and AdBoard don't modify their dept names if(!($name == "Editors at Large" or $name == "Advisory Board" or $name == "Production Staff for This Issue")) { $name = $name . " Staff"; } $folded = array(); foreach ($positions as $title => $members) { array_push($folded, formatPosition($title, $members)); } $folded = join('; ', $folded); return "$name\r" . "$folded."; } $depts = getDepartments(); // Exec board gets special formatting $exec = getDepartmentMembers(array_shift($depts)); header('Content-Type: text/plain; charset="UTF-16BE"'); header('Content-Disposition: attachment; filename=masthead.txt'); // XXX: Due to a bug in PHP - kinda http://bugs.php.net/34776 (although some // may also argue PHP itself is the bug) - the BOM must be output before we do // the rest of the conversion. Now, this will also cause headers to be sent, // which will mean that when we flush output at the bottom it'll try to send // headers again and emit a warning. echo("\xfe\xff"); // BOM for proper UTF-16BE detection mb_internal_encoding("UTF-8"); mb_http_output("UTF-16BE"); ob_start("mb_output_handler"); ?> $members) { // Exec has Shift-returns (a.k.a just a newline) between titles and names $person = "\n".$members[0]; ?> array("@@", "@@"), "Staff" => array("@@"), "Copy Editors" => array("@@"))) . "\r"; // Time for the copyright with the current year $currentyear=date("Y"); ?> The Tech (ISSN 0148-9607) is published on Tuesdays and Fridays during the academic year (except during MIT vacations), Wednesdays during January, and monthly during the summer by The Tech, Room W20-483, 84 Massachusetts Avenue, Cambridge, Mass. 02139. Subscriptions are $50.00 per year (third class). Postmaster: Please send all address changes to our mailing address: The Tech, P.O. Box 397029, Cambridge, Mass. 02139-7029. Telephone: Editorial: (617) 253-1541. Business: (617) 258-8324. Facsimile: (617) 258-8226. Advertising, subscription, and typesetting rates available. Entire contents © The Tech. Printed by Upper Valley Press, Inc.