tomboy r2069 - in trunk: . Tomboy/Addins/ExportToHtml
- From: sschweiz svn gnome org
- To: svn-commits-list gnome org
- Subject: tomboy r2069 - in trunk: . Tomboy/Addins/ExportToHtml
- Date: Thu, 7 Aug 2008 22:09:19 +0000 (UTC)
Author: sschweiz
Date: Thu Aug 7 22:09:19 2008
New Revision: 2069
URL: http://svn.gnome.org/viewvc/tomboy?rev=2069&view=rev
Log:
* Tomboy/Addins/ExportToHtml/NoteNameResolver.cs,
Tomboy/Addins/ExportToHtml/ExportToHtml.xsl: Resolve note URIs only
once to simplify check for loops between linked notes. Removed not
working check with xsl:key for already processed notes.
Fixes bug #546623.
Modified:
trunk/ChangeLog
trunk/Tomboy/Addins/ExportToHtml/ExportToHtml.xsl
trunk/Tomboy/Addins/ExportToHtml/NoteNameResolver.cs
Modified: trunk/Tomboy/Addins/ExportToHtml/ExportToHtml.xsl
==============================================================================
--- trunk/Tomboy/Addins/ExportToHtml/ExportToHtml.xsl (original)
+++ trunk/Tomboy/Addins/ExportToHtml/ExportToHtml.xsl Thu Aug 7 22:09:19 2008
@@ -77,24 +77,9 @@
</div>
<xsl:if test="$export-linked and ((not($export-linked-all) and /tomboy:note/tomboy:title/text() = $root-note) or $export-linked-all)">
- <!--
- Loop through all the links contained in this note and
- check to see if they've already been loaded/processed
- (skip them if they have).
- -->
<xsl:for-each select=".//link:internal/text()">
-
- <xsl:variable name="link-already-processed">
- <xsl:call-template name="note-already-loaded">
- <xsl:with-param name="title" select="."/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:if test="contains($link-already-processed, 'NO')">
- <!-- Load in the linked note's XML for processing. -->
- <xsl:apply-templates select="document(.)/node()"/>
- </xsl:if>
-
+ <!-- Load in the linked note's XML for processing. -->
+ <xsl:apply-templates select="document(.)/node()"/>
</xsl:for-each>
</xsl:if>
</xsl:template>
@@ -145,7 +130,7 @@
</xsl:template>
<xsl:template match="link:internal">
- <a style="color:#204A87" href="#{document(node())/tomboy:note/tomboy:title}">
+ <a style="color:#204A87" href="#{node()}">
<xsl:value-of select="node()"/>
</a>
</xsl:template>
@@ -172,27 +157,6 @@
</li>
</xsl:template>
-<!--
- The "note-title" key keeps a list of all note titles that have been
- processed. Each time a note's XML is loaded, its title is added to this
- key automatically. This is used to prevent including the text of a note
- more than once if "export-linked" is true and a recursive link to a note
- is found.
--->
-<xsl:key name="note-title" match="tomboy:note" use="tomboy:title" />
-
-<xsl:template name="note-already-loaded">
- <xsl:param name="title" />
- <xsl:choose>
- <xsl:when test="key('note-title', $title)">
- YES
- </xsl:when>
- <xsl:otherwise>
- NO
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
<!-- Evolution.dll Plugin -->
<xsl:template match="link:evo-mail">
<a href="{./@uri}">
Modified: trunk/Tomboy/Addins/ExportToHtml/NoteNameResolver.cs
==============================================================================
--- trunk/Tomboy/Addins/ExportToHtml/NoteNameResolver.cs (original)
+++ trunk/Tomboy/Addins/ExportToHtml/NoteNameResolver.cs Thu Aug 7 22:09:19 2008
@@ -11,22 +11,19 @@
{
NoteManager manager;
- // Use this dictionary to keep track of notes that have already been
- // resolved. The key is the Note.Title:string and the value is the
- // number of times the specified note has been requested. ResolveUri
- // for some reason, gets called twice for each of the notes. Allow it
- // to be called twice, but then return null after that.
- Dictionary<string, int> resolvedNotes;
+ // Use this list to keep track of notes that have already been
+ // resolved.
+ List<string> resolvedNotes;
public NoteNameResolver (NoteManager manager, Note originNote)
{
this.manager = manager;
- resolvedNotes = new Dictionary<string,int> ();
+ resolvedNotes = new List<string> ();
- // Set the resolved count to 2 for the original note so it won't
- // be included again.
- resolvedNotes [originNote.Title.ToLower ()] = 2;
+ // Add the original note to the list of resolved notes
+ // so it won't be included again.
+ resolvedNotes.Add (originNote.Title.ToLower ());
}
public override System.Net.ICredentials Credentials
@@ -72,18 +69,13 @@
public override Uri ResolveUri (Uri baseUri, string relativeUri)
{
string noteTitleLowered = relativeUri.ToLower ();
- if (resolvedNotes.ContainsKey (noteTitleLowered) == true
- && resolvedNotes [noteTitleLowered] > 1) {
+ if (resolvedNotes.Contains (noteTitleLowered)) {
return null;
}
Note note = manager.Find (relativeUri);
if (note != null) {
- if (resolvedNotes.ContainsKey (noteTitleLowered) == true) {
- resolvedNotes [noteTitleLowered] = 2;
- } else {
- resolvedNotes [noteTitleLowered] = 1;
- }
+ resolvedNotes.Add (noteTitleLowered);
return new Uri (note.Uri);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]