Creating a dynamic hyperlink in Word with XDocReport - hyperlink

I need to create a hyperlink using XDocReport where both the URL and display name are provided using Velocity tags. There is some reference to this on the XDocReport web site, but no real guidance.
Other things I have tried, like http://blog.softartisans.com/2013/12/31/kb-creating-dynamic-links-with-mergefields-in-microsoft-word/, do not work.

Manage hyperlink with XDocReport is like mergefield. XDocReport wiki page about hyperlink with docx can be found here, but I agree, it should be improved.
If you cannot manage hyperlink with XDocReport and docx, I suggest :
use the XDocReport macro . There is a link checkbox to insert hyperlink instead of inserting mergefield.
download docxandvelocity-XXX-sample.zip or get Git project fr.opensagres.xdocreport.samples.docxandvelocity. You will find samples with hyperlinks.

Based on #MarkSalamon suggested link: http://blog.softartisans.com/2013/12/31/kb-creating-dynamic-links-with-mergefields-in-microsoft-word/ , it failed in my case too.
After debugging the opensagres library, it seems that instead of inserting a merge field inside the Hyperlink, the library is expecting there just a simple Freemarker placeholder. So it's enough to create the hyperlink from Word, and at the url definition part, you can specify there: ${url} .
That's it, the library is going to detect that there is a Freemarker syntax and replace the url with back-end data. So you don't have to do the trick with ALT+F9 and replace with merge field codes.
In my case this worked with opensagres version: 2.0.2

Related

substitute space character in lua

I am creating a template in Wikipedia to link articles to an external website which is a book archive called fadedpage.com. I am generating a url to link to a specific author page. Part of the url is the author's name which contains one or more spaces. For example, the url for the author "Ian Fleming" is: http://fadedpage.com/csearch.php?author=Fleming, Ian. My template call structure is {{FadedPage|id=Fleming, Ian|name=Ian Fleming|author=yes}}.
For my template I am replicating an existing template which uses a script coded in lua to parse the template arguments. I have been able to generate all of the url except for the space character between the last and first name.
I could code the template call as: {{FadedPage|id=Fleming,%20Ian|name=Ian Fleming|author=yes}} which works OK but I would rather have the call format as it looks on the fadedpage website, ie. with the embedded space. So I need a way in lua to find the space character within the string and substitute it for the string "%20". So far I haven't figured out how to do it. Any help would be appreciated.

Link to text file (resource) in Javadoc

I did my seach but couldn't find the right answer... How can I use link to a resource text file in Javadoc. {#link easywords.txt} doesn't work. Easy words doesn't work neither.
Try Easy words instead.
A Link should be a URL.
The browser may think D would be protocol to handle requests.
For literature: http://en.wikipedia.org/wiki/File_URI_scheme

Custom URL format for news in Expression Engine

Our site is migrating from MovableType to ExpressionEngine, and there is one small issue we are having. MT uses a date based URL structure, e.g. www.site.com/2012/03/post-title.html, while EE uses a category based structure, e.g. www.site.com/index.php/news/comments/post-title. The issue is that our MT page used Disqus for comments, and as such comments are tied to a specific URL, meaning that we'd lose all of our comments if we were to migrate. I am wondering if there's a way to change the URL structure in EE to match MT's, thus allowing us to keep the comments. Thanks in advance.
Correction: EE uses a Template Group/Template based structure for URLs, not categories - just to clarify.
You've got a couple of options here.
One is to create an .htaccess rule which internally redirects all requests matching YYYY/MM/ to your EE template which displays your posts (say, /news/entry/). I don't know exactly what those rewrite rules would look like off the top of my head, my mod_rewrite-fu is pretty shallow. But it could definitely work.
Another is to export all of your comments from Disqus via their XML export tool, then do a grep-based find and replace using something like BBEdit, replacing all /YYYY/MM/ strings in that file with /news/entry/; delete all of your existing comments on Disqus; then import your newly-modifed XML file.

Linking on a Redmine Wiki

I'm writing a wiki on Redmine for the program my company just developed. I've been reading Redmine Wiki formatting pages but I simply can't find how to link to headers on a page that hold spaces.
For example:
This works [[Setup#Oracle|Oracle Setup]]
This does not work [[Setup#Oracle DB|Oracle DB Setup]]
The second I have a header with a space, hyphen, underscore... ANYTHING more than one word, Redmine is unable to link.
Any ideas how to link correctly?
Hyphens worked for me using the textile formatting.
[[Wiki#Test-link-target|a link]]
If you open the wiki page you should see a little paragraph symbol next to each header that appears when you hover your mouse there. That should give you the (semi-)permalink you can use. You can always look at the wiki pages source for the link names.
One problem I remember when working on the Markdown filter was that each text formatter would create it's table of contents separately. So the anchor links for textile might be different than the ones for plain text or Markdown.

dynamic seo title for news articles

I have a news section where the pages resolve to urls like
newsArticle.php?id=210
What I would like to do is use the title from the database to create seo friendly titles like
newsArticle/joe-goes-to-town
Any ideas how I can achieve this?
Thanks,
R.
I suggest you actually include the ID in the URL, before the title part, and ignore the title itself when routing. So your URL might become
/news/210/joe-goes-to-town
That's exactly what Stack Overflow does, and it works well. It means that the title can change without links breaking.
Obviously the exact details will depend on what platform you're using - you haven't specified - but the basic steps will be:
When generating a link, take the article title and convert it into something URL-friendly; you probably want to remove all punctuation, and you should consider accented characters etc. Bear in mind that the title won't need to be unique, because you've got the ID as well
When handling a request to anything starting with /news, take the next part of the path, parse it as an integer and load the appropriate article.
Assuming you are using PHP and can alter your source code (this is quite mandatory to get the article's title), I'd do the following:
First, you'll need to have a function (or maybe a method in an object-oriented architecture) to generate the URLs for you in your code. You'd supply the function with the article object or the article ID and it returns the friendly URL with the ID and the friendly title.
Basically function url(Article $article) => URL.
You will also need some URL rewriting rules to remove the PHP script from the URL. For Apache, refer to the mod_rewrite documentation for details (RewriteEngine, RewriteRule, RewriteCond).

Resources