Spaces in wikimedia templates - templates

I'm working on a MediaWiki-generated Wiki, and want to build a template that would link me to a French Wikipedia article. I have this :
[http://fr.wikipedia.org/wiki/{{{1|}}} {{#if:{{{2|}}}|{{{2|}}}|{{{1|}}}}}]
Logic being :
{{Wpfr|article name|alternate name (if needed)}}
Thing is, if the article name has spaces in it, it breaks, keeping the first word as {{{1}}} and putting the rest in {{{2}}}.
I'd like to find a way to be able to use spaces in {{{1}}} without breaking the links. That way :
{{Wpfr|Greg Weisman}}
would automatically link to the article on Greg Weisman and display "Greg Weisman".
I've tried using :
[http://fr.wikipedia.org/wiki/{{{art|}}} {{#if:{{{2|}}}|{{{2|}}}|{{{art|}}}}}]
{{Wpfr|art=article name}}
(even replacing the 2s by 1s) to no avail.
The Wiki admin part hasn't been updated in a while so the Interwiki table can't be updated and I can't use the "replace" function either.
I'm new to Wikicoding, so I'm sorry if the answer is very simple.
Thanks !
Edit : the MediaWiki version is 1.13.5

Mediawiki has a magic word for handeling encoding of url:
{{urlencode:data|style}}
{{urlencode:Greg Weisman|PATH}} will return:
Greg%20Weisman
Change your template with:
[http://fr.wikipedia.org/wiki/{{urlencode:{{{1|}}}|PATH}} {{#if:{{{2|}}}|{{{2|}}}|{{{1|}}}}}]

Related

Adding preamble.tex and/or modifying css

Thanks for making papaja. It's really terrific!
I just submitted my first journal article using it and ran into problems. The layout staff don't know what to do with the code chunks and listings that are fine in single-column, full page format, but not in their 2-column format. I'm trying use the class 'jou' option to make 2 columns, but I can't figure out how to control the size of code and listing fonts (possibly by modifying the css, as recommended here), or how to using the latex package 'listings' to set listings to wrap (as recommended here).
I'd be grateful for any advice, and my apologies if I've missed how one might do this in the documentation.
If it's only about getting the listings package to work, you can modify the YAML header that it looks similar to the following:
documentclass : "apa6"
classoption : "jou"
output :
papaja::apa6_pdf:
pandoc_args: --listings
header-includes:
- \lstset{breaklines=true}
However, note that using automatic line breaks will most likely break the code at some points. Therefore, it is worthwhile to consider alternatives: For instance, you could try to use a code style that uses more line breaks. The styler package and add-in might be helpful accomplishing this: https://styler.r-lib.org/

Weblog comment error

I am using Weblog for blog functionality. Now I am facing one problem. I have created one Entry with name like 'sitecore-mvc', now when I am going to submit a comments it is giving me error 'End of string expected at position 39' if I changed Entry name like 'sitecoremvc' it works fine. There is some problem when I use '-' in Entry name. Any how I want to use '-' in url. Please give me solution.
If you look at the issues in GitHub for Weblog this is a known issue.
See this link for a solution:
https://github.com/WeTeam/WeBlog/issues/52
You should be able to swap out the DuplicateSubmissionGuard pipeline processor to a custom implementation that escapes hyphen characters in the path.

Joomla Load Module in Featured Article

What I use:
- Joomla 2.5
- gantry framework
Need:
I must place in my homepage a slideshow module inside the mainbody as a featured article.
What I did:
Installed a slideshow module and placed temporary inside gantry's maintop-a position to see if it worked (it did), then moved in a non-previously-exsisting 'slideshow' position.
Created a new article, with this content: {loadposition slideshow} and set it to featured state.
Result:
the article was published correctly but the introtext char limit trimmed the actual module code to 100 chars making it useless.
What I already tried to fix the issue:
Modified my slideshow article from database adding the loadmodule code in the fulltext field (which was originally empty),
then modified components/com_content/view/featured/tmpl/default_item.php replacing echo $this->item->introtext; with an if to identify my slideshow article id then query the database to find the fulltext field and echo it. this thingy works but the loadmodule function isn't, so it's displayed as simple HTML. I deduce that introtext is treated differently than fulltext since what's inside the brackets is interpreted as code only when echoed as introtext, and I miss that layer.
Modified modules/mod_articles_category/helper.php to break the 100 introtext_limit, sadly finding that's not called for my featured articles (added dump($item, 'some name') which returns only the articles that are inside my news sidebar, even if all my featured articles including slideshow are categorized)
tried a million different combinations of the above (i.e.:{loadmodule slideshow}{module [myslideshow_article_id]} <- a module loader plugin i tried, ...) which are too long to put here.
Searched the whole project folder for files containing 'introtext' inside their code, finding alot, but nothing that actually trims it (except helper.php of course)
Searched the Joomla API
Googled for everything that came into my mind finding no working solutions.
Came Here :)
Thanks
If you want to show a module inside an artice, you can use an component to show them there.
In my experience, this works on normal and featured articles, so this might work for you:
http://www.nonumber.nl/extensions/modulesanywhere
I hope this was helpfull, since this is my first answer here.
Kind Regards,
McBurgerKong

JSDuck Guides: How to Generate Subsection Navigation?

I am using the Guides feature of JSDuck where I specify README.md files in the guides.json file.
The problem I have is that I can't specify an anchor in a README.md file in guides.json.
For example, my README.md file has an H1 Head, then 5 H2 heads. Assume above each H2 header, I put an anchor--e.g, <a name="h2_1">, <a name="h2_2">, <a name="h2_3">, etc.
I want the title: (param) I enter in the guides.json to appear in the JSDuck-generated navigation on the left of the page. So, assume i entered these parameters:
{
name:foo-section-h2_1,
title: This is Header2
}
The problem is that the -section tail - which is a valid link reference in JSDuck causes the parser to fail to render the README.md into the target README.js in a directory "foo".
Anyone have any suggestions - it is a huge hinderance if one can't express subsections in the main navigation of a guide.
Unfortunately this is not supported by JSDuck. It expects each entry name in the guides.json to reference a directory name, to which it appends "/README.md" and expects to find the guide file in there. There is no workaround that I know of, and I'm the author of this whole thing.
The whole guides feature is full of various quirks and unresolved corner-cases like this. It's largely a bolt-on feature to JSDuck. My main suggestion is, that when you want to do anything more than the most basic guides, you should look for an alternative solution.
Or you could try patching this. But I took a look around the code, and it's not a simple fix to make.

MVC - Strip unwanted text from rss feed

Ive got the following code in my RSS consumer (Vandelay Industries RemoteRSS) in my Orchard CMS implementation:
#using System.Xml.Linq
#{
var feed = Model.Feed as XElement;
}
<ul>
#foreach(var item in feed
.Element("channel")
.Elements("item")
.Take((int)Model.ItemsToDisplay))
{
<li>#T(item.Element("description").Value)</li>
}
</ul>
The rss feed Im using is from Pinterest, and this bundles the image, link, and a short description all inside the 'description' elements of the feed.
<description><a href="/pin/215609900882251703/"><img src="http://media-cache-ec2.pinterest.com/upload/88664686384961121_UIyVRN8A_b.jpg"></a>How to install Orchard CMS on IIS Server</description>
My issue is that I don't want the text bits, and I also need to prefix the 'href=' links with 'http://www.pinterest.com'.
I've managed to edit the original code with my newbie skills to the above,, which essentially displays the images as links which are only relative and thus pointing locally to my server. These images are also then followed by the short description.
So to summarise, I need a way to prefix all links with 'http://pinterest.com' and then to remove the fee text after the image/links.
Any pointers will be greatly appreciated, Thanks.
You should probably parse the description, with something like http://htmlagilitypack.codeplex.com/, and then tweak it to add the prefix. Or you can learn regular expression and do without a library. Could be a little trickier and error-prone however.