Index: wp-includes/feed-functions.php
===================================================================
--- wp-includes/feed-functions.php	(revision 3151)
+++ wp-includes/feed-functions.php	(working copy)
@@ -129,6 +129,8 @@
         $category->cat_name = convert_chars($category->cat_name);
         if ('rdf' == $type) {
             $the_list .= "\n\t<dc:subject>$category->cat_name</dc:subject>";
+	} elseif ('atom' == $type) {
+	    $the_list .= "\n\t<category term=\"$category->cat_name\" />";
         } else {
             $the_list .= "\n\t<category>$category->cat_name</category>";
         }
@@ -155,4 +157,23 @@
 	}
 }
 
-?>
\ No newline at end of file
+function atom_enclosure() {
+	global $id, $post;
+	if (!empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password)) return;
+
+	$custom_fields = get_post_custom();
+	if( is_array( $custom_fields ) ) {
+		while( list( $key, $val ) = each( $custom_fields ) ) { 
+			if( $key == 'enclosure' ) {
+				if (is_array($val)) {
+					foreach($val as $enc) {
+						$enclosure = split( "\n", $enc );
+						print "<link rel=\"enclosure\" length=\"".trim( $enclosure[ 1 ] )."\" type=\"".trim( $enclosure[ 2 ] )."\" href=\"".trim( htmlspecialchars($enclosure[ 0 ]) )."\"/>\n";
+					}
+				}
+			}
+		}
+	}
+}
+
+?>
Index: wp-content/themes/classic/header.php
===================================================================
--- wp-content/themes/classic/header.php	(revision 3151)
+++ wp-content/themes/classic/header.php	(working copy)
@@ -14,7 +14,7 @@
 
 	<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
 	<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
-	<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
+	<link rel="alternate" type="application/atom+xml" title="Atom 1.0" href="<?php bloginfo('atom_url'); ?>" />
 	
 	<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
     <?php wp_get_archives('type=monthly&format=link'); ?>
Index: wp-content/themes/default/header.php
===================================================================
--- wp-content/themes/default/header.php	(revision 3151)
+++ wp-content/themes/default/header.php	(working copy)
@@ -10,6 +10,7 @@
 
 <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
 <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
+<link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />
 <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
 
 <style type="text/css" media="screen">
Index: wp-atom.php
===================================================================
--- wp-atom.php	(revision 3151)
+++ wp-atom.php	(working copy)
@@ -10,35 +10,38 @@
 
 ?>
 <?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; ?>
-<feed version="0.3"
-  xmlns="http://purl.org/atom/ns#"
+<feed xmlns="http://www.w3.org/2005/Atom"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xml:lang="<?php echo get_option('rss_language'); ?>"
   <?php do_action('atom_ns'); ?>
   >
+	<id><?php bloginfo_rss('atom_url') ?></id>
 	<title><?php bloginfo_rss('name') ?></title>
-	<link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
-	<tagline><?php bloginfo_rss("description") ?></tagline>
-	<modified><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></modified>
-	<copyright>Copyright <?php echo mysql2date('Y', get_lastpostdate('blog'), 0); ?></copyright>
-	<generator url="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator>
+	<link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('atom_url') ?>" />
+	<link rel="alternate" type="application/rss+xml" href="<?php bloginfo_rss('rss2_url') ?>" />
+	<link rel="alternate" type="text/html"<?php if (defined('WPLANG') && strcmp(constant('WPLANG'), '')) echo ' hreflang="' . WPLANG . '"';?> href="<?php bloginfo_rss('home') ?>" />
+	<subtitle><?php bloginfo_rss("description") ?></subtitle>
+	<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></updated>
+	<rights>Copyright <?php echo mysql2date('Y', get_lastpostdate('blog'), 0); ?></rights>
+	<generator uri="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress <?php bloginfo_rss('version'); ?></generator>
 	<?php do_action('atom_head'); ?>
 	<?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?>
 	<entry>
 	  	<author>
 			<name><?php the_author() ?></name>
 		</author>
-		<title type="text/html" mode="escaped"><![CDATA[<?php the_title_rss() ?>]]></title>
+	<title type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><?php the_title_rss() ?></div></title>
 		<link rel="alternate" type="text/html" href="<?php permalink_single_rss() ?>" />
 		<id><?php the_guid(); ?></id>
-		<modified><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></modified>
-		<issued><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></issued>
-		<?php the_category_rss('rdf') ?> 
-		<summary type="text/plain" mode="escaped"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
-<?php if ( !get_settings('rss_use_excerpt') ) : ?>
-		<content type="<?php bloginfo('html_type'); ?>" mode="escaped" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
+		<updated><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></updated>
+		<published><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></published>
+		<?php the_category_rss('atom') ?> 
+		<summary type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><?php the_excerpt_rss(); ?></div></summary>
+<?php if (!get_settings('rss_use_excerpt') || strstr($_SERVER['HTTP_USER_AGENT'], "Technoratibot") !== FALSE): ?>
+<?php // FIXME: Ignore bloginfo('html_type') since it's deliberately set incorrectly; WordPress currently generates ONLY XHTML ?>
+		<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><?php the_content('', 0, '') ?></div></content>
 <?php endif; ?>
-<?php rss_enclosure(); ?>
+<?php atom_enclosure(); ?>
 <?php do_action('atom_entry'); ?>
 	</entry>
 	<?php $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?>

