[publican-list] Partial URL Entity Expansion in ulink?

AdamD. adam820 at gmail.com
Thu Apr 11 00:49:00 UTC 2013


On Wed, Apr 10, 2013 at 7:05 PM, Jeff Fearn <jfearn at redhat.com> wrote:
> Hi Adam, which version of Publican?
>
>
> On 04/11/2013 08:14 AM, AdamD. wrote:
>>
>> I've looked around the internet for examples of using expanded entities as
>> ulink URLs, but in all the instances I've found they use the entire link,
>> such as:
>>
>> <!ENTITIY myurl "http://www.thisismy.com/url"> or, the entire <ulink> tag
>> structure as the entity.
>>
>> What I'm looking to do is use an entity to represent just part of a URL,
>> leading up to the final file. I'm trying to put links to files distributed
>> via HTTP, and while the filenames should remain fairly constant the DNS
>> name/HTTP link of the URL may change names, and not having to go update
>> individual URLs all through a document would be a huge time-saver.
>
>
> Relative links aren't realistic?

I suppose in the short term they would be, but I was thinking about
the future and the potential for the files on a different machine, or
externally hosted, etc.

>
>> What seems to work when locally built (HTML, PDF, etc. on local machine)
>> is
>> putting the entity in the .ent file like <!ENTITY MYURL "
>> http://docs.mysite.com/itfiles/tutorial"> and the ulink as:
>>
>> <ulink url="&MYURL;/awesomefile.txt">file</ulink>
>>
>> This correctly generates the URL to the external site in the PDF, HTML,
>> etc. However, when this is packaged as an RPM and deployed on the
>> documentation site, it makes the final URL as displayed  "
>> http://docs.mysite.com/awesomefile.txt" instead of pointing to the correct
>> external link (which happens to be on the same server, just a different
>> URL).
>>
>> I saw a post about using correct XML, and putting the entity as
>> "&MYURL;", but this just makes the URL"
>> http://docs.mysite.com/&MYURL/awesomefile.txt" without expanding the
>> entity, taking the literal text.
>>
>> Is there a proper way to do this, if at all?
>>
>> Thanks in advance.
>
>
> You could try having all the data for the URL in the ent file.
>
> <!ENTITY SITE "http://docs.mysite.com/docs/etc">
> <!ENTITY AWESOME "&SITE;/awesomefile.txt">
>
> <ulink url="&AWESOME;">file</ulink>
>
>
> Cheers, Jeff.

I tried a bunch of different things, but I didn't think of that one. I
suppose with some comments that would make it fairly easy to keep
up-to-date if need be.

Thanks!

-- 
Adam D.




More information about the publican-list mailing list