<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for x + 3</title>
	<atom:link href="http://xplus3.net/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://xplus3.net</link>
	<description></description>
	<lastBuildDate>Sat, 28 Jan 2012 19:19:30 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
	<item>
		<title>Comment on Convert hOCR to PDF by Josh</title>
		<link>http://xplus3.net/2009/04/02/convert-hocr-to-pdf/comment-page-1/#comment-2853</link>
		<dc:creator>Josh</dc:creator>
		<pubDate>Sat, 28 Jan 2012 19:19:30 +0000</pubDate>
		<guid isPermaLink="false">http://xplus3.net/?p=207#comment-2853</guid>
		<description>Thanks!  Great tool.  I had to modify it slightly to get it to work with hocr produced by tesseract.  At least in my hocr files, the text of each line is nested within sub elements of the one currently referenced by the to_pdf method, one sub-element for each word (a span element with a class attribute of &#039;ocr_word,&#039; which has a child span element with a class attribute of &#039;ocrx_word,&#039; where the actual text of the word is held), so the calls to line.text would yield &quot;none,&quot; as the text was in a child element.  Here&#039;s the tweak I used:
1) add as a sub-function of the to_pdf method the following function, which gathers the text from each of the sub-elements for the line element into a single string:
     def get_full_line(line_elem):
	    result = &quot;&quot;
	    for word_unit in line_elem.findall(&#039;span[@class=&quot;ocr_word&quot;]&#039;):
		    for word in word_unit.findall(&#039;span[@class=&quot;ocrx_word&quot;]&#039;):
			result = result + word.text + &#039; &#039;
	    return result

2) change the following portion of the to_pdf method as indicated in order to call the above function and use the returned line text, rather than try to retrieve this text directly from the element corresponding to the entire line:

    if self.hocr is not None:
      for line in self.hocr.findall(&quot;.//%sspan&quot;%(self.xmlns)):
        if line.attrib[&#039;class&#039;] == &#039;ocr_line&#039;:
	  line_text = get_full_line(line)
          coords = self.element_coordinates(line)
          text = pdf.beginText()
          text.setFont(fontname, fontsize)
          text.setTextRenderMode(3) # invisible
          
          # set cursor to bottom left corner of line bbox (adjust for dpi)
          text.setTextOrigin((float(coords[0])/ocr_dpi[0])*inch, (height*inch)-(float(coords[3])/ocr_dpi[1])*inch)
          
          # scale the width of the text to fill the width of the line&#039;s bbox
          
          text.setHorizScale((((float(coords[2])/ocr_dpi[0]*inch)-(float(coords[0])/ocr_dpi[0]*inch))/pdf.stringWidth(line_text, fontname, fontsize))*100)
          # write the text to the page
          text.textLine(line_text)
          pdf.drawText(text)

After making these two minor changes, it worked great.  Thanks for sharing this.  It saved me a lot of time.</description>
		<content:encoded><![CDATA[<p>Thanks!  Great tool.  I had to modify it slightly to get it to work with hocr produced by tesseract.  At least in my hocr files, the text of each line is nested within sub elements of the one currently referenced by the to_pdf method, one sub-element for each word (a span element with a class attribute of &#8216;ocr_word,&#8217; which has a child span element with a class attribute of &#8216;ocrx_word,&#8217; where the actual text of the word is held), so the calls to line.text would yield &#8220;none,&#8221; as the text was in a child element.  Here&#8217;s the tweak I used:<br />
1) add as a sub-function of the to_pdf method the following function, which gathers the text from each of the sub-elements for the line element into a single string:<br />
     def get_full_line(line_elem):<br />
	    result = &#8220;&#8221;<br />
	    for word_unit in line_elem.findall(&#8216;span[@class="ocr_word"]&#8216;):<br />
		    for word in word_unit.findall(&#8216;span[@class="ocrx_word"]&#8216;):<br />
			result = result + word.text + &#8216; &#8216;<br />
	    return result</p>
<p>2) change the following portion of the to_pdf method as indicated in order to call the above function and use the returned line text, rather than try to retrieve this text directly from the element corresponding to the entire line:</p>
<p>    if self.hocr is not None:<br />
      for line in self.hocr.findall(&#8220;.//%sspan&#8221;%(self.xmlns)):<br />
        if line.attrib['class'] == &#8216;ocr_line&#8217;:<br />
	  line_text = get_full_line(line)<br />
          coords = self.element_coordinates(line)<br />
          text = pdf.beginText()<br />
          text.setFont(fontname, fontsize)<br />
          text.setTextRenderMode(3) # invisible</p>
<p>          # set cursor to bottom left corner of line bbox (adjust for dpi)<br />
          text.setTextOrigin((float(coords[0])/ocr_dpi[0])*inch, (height*inch)-(float(coords[3])/ocr_dpi[1])*inch)</p>
<p>          # scale the width of the text to fill the width of the line&#8217;s bbox</p>
<p>          text.setHorizScale((((float(coords[2])/ocr_dpi[0]*inch)-(float(coords[0])/ocr_dpi[0]*inch))/pdf.stringWidth(line_text, fontname, fontsize))*100)<br />
          # write the text to the page<br />
          text.textLine(line_text)<br />
          pdf.drawText(text)</p>
<p>After making these two minor changes, it worked great.  Thanks for sharing this.  It saved me a lot of time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Custom Permalinks for Custom Post Types in WordPress 3.0+ by DearSusan</title>
		<link>http://xplus3.net/2010/05/20/wp3-custom-post-type-permalinks/comment-page-1/#comment-2844</link>
		<dc:creator>DearSusan</dc:creator>
		<pubDate>Mon, 23 Jan 2012 18:20:55 +0000</pubDate>
		<guid isPermaLink="false">http://xplus3.net/?p=275#comment-2844</guid>
		<description>Solved with permalinks plugin.</description>
		<content:encoded><![CDATA[<p>Solved with permalinks plugin.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Custom Permalinks for Custom Post Types in WordPress 3.0+ by DearSusan</title>
		<link>http://xplus3.net/2010/05/20/wp3-custom-post-type-permalinks/comment-page-1/#comment-2843</link>
		<dc:creator>DearSusan</dc:creator>
		<pubDate>Mon, 23 Jan 2012 15:56:59 +0000</pubDate>
		<guid isPermaLink="false">http://xplus3.net/?p=275#comment-2843</guid>
		<description>Can you also help me? I&#039;m using the More Types plugin.

When I create a new post the url will look like:
mydomain/permalink base/postname

We can edit &quot;permalink base&quot; in More Types. However, how can we include the %post_id%? I tried but it did not work.

This is extremely important for me to create unique urls.

Please let me know if you have the answer.

Thanks!</description>
		<content:encoded><![CDATA[<p>Can you also help me? I&#8217;m using the More Types plugin.</p>
<p>When I create a new post the url will look like:<br />
mydomain/permalink base/postname</p>
<p>We can edit &#8220;permalink base&#8221; in More Types. However, how can we include the %post_id%? I tried but it did not work.</p>
<p>This is extremely important for me to create unique urls.</p>
<p>Please let me know if you have the answer.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on jQuery and Ajax in WordPress Plugins &#8211; Public Pages by Reparar y Arreglar &#187; Informática &#8211; Tema: Crear un Plugin Wordpress</title>
		<link>http://xplus3.net/2008/10/27/jquery-and-ajax-in-wordpress-plugins-public-pages/comment-page-1/#comment-2840</link>
		<dc:creator>Reparar y Arreglar &#187; Informática &#8211; Tema: Crear un Plugin Wordpress</dc:creator>
		<pubDate>Sat, 21 Jan 2012 18:37:37 +0000</pubDate>
		<guid isPermaLink="false">http://xplus3.net/?p=108#comment-2840</guid>
		<description>[...] jQuery y Ajax en Plugins WordPress [...]</description>
		<content:encoded><![CDATA[<p>[...] jQuery y Ajax en Plugins WordPress [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Custom Permalinks for Custom Post Types in WordPress 3.0+ by mos</title>
		<link>http://xplus3.net/2010/05/20/wp3-custom-post-type-permalinks/comment-page-1/#comment-2837</link>
		<dc:creator>mos</dc:creator>
		<pubDate>Tue, 10 Jan 2012 17:02:43 +0000</pubDate>
		<guid isPermaLink="false">http://xplus3.net/?p=275#comment-2837</guid>
		<description>ahh.. finally figured it out: had to change the permalink structure from /%postname%/ to /%slug%/%postname%/. hope this dosen&#039;t give me other headaches!</description>
		<content:encoded><![CDATA[<p>ahh.. finally figured it out: had to change the permalink structure from /%postname%/ to /%slug%/%postname%/. hope this dosen&#8217;t give me other headaches!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Rethinking Object-Oriented WordPress Plugins by Erhan</title>
		<link>http://xplus3.net/2011/03/08/rethinking-object-oriented-wordpress-plugins/comment-page-1/#comment-2836</link>
		<dc:creator>Erhan</dc:creator>
		<pubDate>Mon, 09 Jan 2012 12:02:46 +0000</pubDate>
		<guid isPermaLink="false">http://xplus3.net/?p=391#comment-2836</guid>
		<description>My approach;

https://github.com/eabay/oo-wordpress</description>
		<content:encoded><![CDATA[<p>My approach;</p>
<p><a href="https://github.com/eabay/oo-wordpress" rel="nofollow">https://github.com/eabay/oo-wordpress</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Understanding Rewrite Tags, or, Custom Permalinks for Custom Post Types in WordPress 3.0+, Part 2 by Help Needed: Custom Permalinks with Custom Post Types &#38; Taxonomies &#124; Ryan Rampersad</title>
		<link>http://xplus3.net/2010/10/04/wp-rewrite-tags-in-permalinks/comment-page-1/#comment-2821</link>
		<dc:creator>Help Needed: Custom Permalinks with Custom Post Types &#38; Taxonomies &#124; Ryan Rampersad</dc:creator>
		<pubDate>Tue, 20 Dec 2011 13:28:03 +0000</pubDate>
		<guid isPermaLink="false">http://xplus3.net/?p=344#comment-2821</guid>
		<description>[...] have I tried? I attempted to follow Jonathan&#8217;s post about permalinks and post types, but I did not have much success with it. I have searched the WordPress forums. And [...]</description>
		<content:encoded><![CDATA[<p>[...] have I tried? I attempted to follow Jonathan&#8217;s post about permalinks and post types, but I did not have much success with it. I have searched the WordPress forums. And [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Custom Permalinks for Custom Post Types in WordPress 3.0+ by jnz31</title>
		<link>http://xplus3.net/2010/05/20/wp3-custom-post-type-permalinks/comment-page-1/#comment-2808</link>
		<dc:creator>jnz31</dc:creator>
		<pubDate>Sun, 11 Dec 2011 14:09:23 +0000</pubDate>
		<guid isPermaLink="false">http://xplus3.net/?p=275#comment-2808</guid>
		<description>me again with the correct filter function

&lt;code&gt;
function my_post_type_link_filter_function( $post_link, $id = 0, $leavename = FALSE ) {
	if ( strpos(&#039;%author%&#039;, $post_link) === FALSE ) {
		$post = &amp;get_post($id);
		$author = get_userdata($post-&gt;post_author);
		return str_replace(&#039;%author%&#039;, $author-&gt;user_nicename, $post_link);
	}
}
&lt;/code&gt;
with that solution it also works in the backend (after you saved the article!).</description>
		<content:encoded><![CDATA[<p>me again with the correct filter function</p>
<p><code><br />
function my_post_type_link_filter_function( $post_link, $id = 0, $leavename = FALSE ) {<br />
	if ( strpos('%author%', $post_link) === FALSE ) {<br />
		$post = &amp;get_post($id);<br />
		$author = get_userdata($post-&gt;post_author);<br />
		return str_replace('%author%', $author-&gt;user_nicename, $post_link);<br />
	}<br />
}<br />
</code><br />
with that solution it also works in the backend (after you saved the article!).</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Custom Permalinks for Custom Post Types in WordPress 3.0+ by jnz31</title>
		<link>http://xplus3.net/2010/05/20/wp3-custom-post-type-permalinks/comment-page-1/#comment-2807</link>
		<dc:creator>jnz31</dc:creator>
		<pubDate>Sat, 10 Dec 2011 18:28:19 +0000</pubDate>
		<guid isPermaLink="false">http://xplus3.net/?p=275#comment-2807</guid>
		<description>sorry again, found another error in my solution
instead of
&lt;code&gt;
$author = get_the_author();
&lt;/code&gt;
you have to write
&lt;code&gt;
get_the_author_meta( &#039;user_nicename&#039; );
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>sorry again, found another error in my solution<br />
instead of<br />
<code><br />
$author = get_the_author();<br />
</code><br />
you have to write<br />
<code><br />
get_the_author_meta( 'user_nicename' );<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Custom Permalinks for Custom Post Types in WordPress 3.0+ by jnz31</title>
		<link>http://xplus3.net/2010/05/20/wp3-custom-post-type-permalinks/comment-page-1/#comment-2806</link>
		<dc:creator>jnz31</dc:creator>
		<pubDate>Sat, 10 Dec 2011 17:12:09 +0000</pubDate>
		<guid isPermaLink="false">http://xplus3.net/?p=275#comment-2806</guid>
		<description>one more question:

this works fine on the website, but in the cms the linking doesnt work properly,
i get a url.tld/whatever//post
any solution on this, or f*§# it..? or did i miss something..?</description>
		<content:encoded><![CDATA[<p>one more question:</p>
<p>this works fine on the website, but in the cms the linking doesnt work properly,<br />
i get a url.tld/whatever//post<br />
any solution on this, or f*§# it..? or did i miss something..?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

