On Sep 23, 2010, at 15:15, JiHO wrote:
> Thanks for the help Christiaan.
>
> On Thu, Sep 23, 2010 at 11:38, Christiaan Hofman <[email protected]> wrote:
>>> Ok. An I guess DeTeXifying means removing those commands without
>>> affecting the output while TeXifying is converting those commands into
>>> their RTF equivalent. i.e.:
>>> {\'e} -- DeTeX --> e
>>> {\'e} -- TeX --> é
>>> Is that right?
>>
>> That's correct.
Sorry, that's NOT correct.
DeTeX: {\'e} -> é
TeX: é -> {\'e}
It's the conversions from the "Unicode to TeX Conversion" in the Files
preferences.
>>
>>> If it is, what is the difference between DeTeX and stringByRevingTeX?
>>
>> I assume you mean stringByRemovingTeX. That's very different, it removes tex
>> commands.
>
> Indeed that was a spelling mistake on my end. However, I don't see how
> stringByRemovingTeX is different from stringByDeTeXifying. For the
> simple example above it seems to do the same:
> {\'e} ----> e
They're not the same at all, they don't even overlap, certainly not in this
particular example. The first gives "é", the second "\'e". In general,
stringByRemovingTeX removes TeX commands and curly braces, while
stringByDeTeXifyingString converts TeX accents and TeX specials to
accented/special characters.
> Could you give me an example of where they are different, so that I
> can use the correct one.
>
They're different for basically any string that contains anything relevant to
these.
Values you get through the "fields" key in a template are already DeTeXified.
We use stringByRemovingTeX for display values of strings like the title in the
main table as well as in the default RTF template.
>>>> It's converted to rich text (NSAttributedString), and rich text support
>>>> for html is limited wrt the webview.
>>>
>>> OK, so I am actually better off doing everything in RTF directly then.
>>
>> I think so.
>
> I actually went ahead on the HTML end and I think I got pretty good
> results. I'll try to keep the HTML and RTF versions on par once I
> understand the odds and ends of both.
>
>>> My only big remaining issue is that BibDesk template values are not
>>> expanded within links. For example if I have an RTF file with a only a
>>> link to the DOI:
>>>
>>> {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf320
>>> {\fonttbl\f0\froman\fcharset0 Palatino-Roman;}
>>> {\colortbl;\red255\green255\blue255;}
>>> {\info
>>> {\author
>>> Foo}}\paperw11900\paperh16840\margl1440\margr1440\vieww9000\viewh8400\viewkind0
>>> \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural
>>> {\field{\*\fldinst{HYPERLINK
>>> "http://dx.doi.org/%3C$string.Doi/%3E"}}{\fldrslt
>>> \f0\fs22 \cf0 <$string.Doi/>}}}
>>>
>>> The "<$string.Doi/>" element of the link is converted by TextEdit in
>>> HTML entities: "%3C$string.Doi/%3E". Even if I replace the %3*
>>> commands by < and > with a plain text editor, the link still points to
>>> http://dx.doi.org/<$string.Doi/> and not to the expanded form (i.e.,
>>> not the actual value of the DOI).
>>
>> I am not sure what your'e doing here, but you're not doing something you're
>> supposed to do. Don't mess with the RTF data directly, that won't be
>> interpreted as the template, the rich text you see in a rich text editor
>> will be.
>>
>> Also, I don't know what <$string.Doi/> should stand for? I think you want
>> something like <$urls.Doi/>.
>>
>>> Is there any way that BibDesk can
>>> expand template values in links.
>>
>> Use the "linkedText" key, e.g. <$urls.Doi.linkedText/>.
>
> Sorry, this was not very clear. I want the value of the DOI (which was
> <$fields.Doi/>, not <$string.Doi/> that was another mistake from me)
> to be a link to http://dx.doi.org/<$fields.Doi/> so that clicking on
> the DOI resolves the DOI on doi.org servers and reroutes the user to
> the page of the publication, online.
>
> <$urls.Doi.linkedText/> does that but instead of displaying only the
> DOI number it displays the full http:// url, which takes a little more
> room.
>
I know, but with RTF it is not possible to do exactly what you want, because
there's no way to pass an extra argument (the URL or displayed string) to a
template key. What I said is the closest you can get.
Also, for HTML you should <$urls.Doi/> for the linked URL, not
http://dx.doi.org/<$fields.Doi/>, because we do some more validation and
cleaning that you may otherwise not get.
> Similarly, I want to make the a link that searches for the current
> paper on Google Scholar. In HTML I can do this:
> <a
> href="http://scholar.google.com/scholar?&as_q=<$fields.Title.stringByRemovingTeX.htmlString/>&as_sauthors=<$authors.lastna...@firstobject/>">Foo</a>
> and "Foo" is a link to a Google Scholar search which has the first
> author and the title as arguments. This works well but I am not sure
> if/how I can do this in RTF.
>
If you use some value as part of a URL you should also always use
stringByAddingPercentEscapes or stringByAddingPercentEscapesIncludingReserved
(in this case the latter, because you want to escape everything including
characters like /&=). And as noted above, you can only add links in RTF with
the text equal to the full URL or path.
> Finally, in RTFD I can easily include images. In HTML I can easily
> link to online images. However, adding an image in the templates
> folder and using a relative link does not work. I would prefer to use
> a local image rather than an online one so that it works offline too.
> How can I include local images in HTML?
> FYI, the point of all this is to display a magnifying glass as the
> link to the Scholar search for example.
>
> Thanks in advance,
>
> JiHO
> ---
> http://maururu.net
You cannot include images in a HTML preview. As I noted before, you cannot have
external files (like css or images), as it is based on data, not on files. You
can also not link to remote images, because a text view also does not download
anything.
Christiaan
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Bibdesk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users