Jump to content

Help talk:ExpandTemplates

About this board

Expand Templates to HTML RAW

1
חגי1234 (talkcontribs)

Hi!

I want to use ExpandTemplates Api, but I want it to expand templates not to <template> tags etc. but to <div> to other formats, how to do it?

Not to this :

<template lineStart="1">

      <title>עמודות</title>

      <part>

        <name index="1" />

        <value>2</value>

      </part>

</template>

But to this :

<div style="width: 100%; overflow: hidden; display: table;">

<div style="direction: rtl; text-align: right; display: table-cell; *float: right; *width: 49%; padding-left: 5px;">אֲמָרָה</div>

<div style="direction: ltr; text-align: left; display: table-cell; *float: left; *width: 49%; padding-right: 5px;">statement</div>

</div>


I'm using these params in post requset (C#):

                  var values = new NameValueCollection();

                        values["action"] = "parse";

                        values["text"] =  WikiDocument.ToString();

                        values["prop"] = "parsetree";

                        values["format"] = "xml";

                   webClient.Encoding = Encoding.UTF8;

                  var response = webClient.UploadValues("https://en.wikipedia.org/w/api.php", values);

Thanks!

Reply to "Expand Templates to HTML RAW"
Erutuon (talkcontribs)

Is there a parameter in the URL for setting the "context title"? None is mentioned on this page, but maybe it's undocumented. title= doesn't work of course.

197.235.63.81 (talkcontribs)

Apparently some users (@Shirayuki, @DannyS712, @Tomybrz) in this wiki are ignorant about how this works, and when attempts are made to document it they blindly revert it because they are either bored or because it was made by an IP. This is especially silly considering that they don't seem to know what it is for, can't be bothered to try the link before and after, nor can they even read the code to see it for themselves (doc.wikimedia.org/mediawiki-core/master/php/SpecialExpandTemplates_8php_source.html). At least one of the users above has a pattern of blindly doing this kind of reverts.

The last revert was the most ridiculous, it removed the bullet, and left the url parameter in the link. Anyway, it seems like a waste of time to fix it again. The accurate documentation is reflected in mediawiki.org/w/index.php?title=Help:ExpandTemplates&oldid=3221450#Query_parameters, and in the more reliable link above that is generated by the actual code that the extension runs, and presumably only editable by competent developers.

Tomybrz (talkcontribs)

Hello 197.235.63.81 / 197.235.231.76 . Thanks for your contributions. There are issues I would like to talk about :

  • Please keep good faith , for you and for us. users above has a pattern of blindly : please be careful what do you say :), same for are ignorant...
  • For the edit, me i trusted more @DannyS712 than you, that right. Because DannyS712 write script using query, he has experience in this "place", i talked with him about this edit here, unfortunately he have no idea.
  • We know good ip are rare. So excuse us if we reverted with mistake but next time, try to use summary more often next time.
  • Also i recommend you to create a account on this page Special:CreateAccount because you have a "unstable" ip (if i can say like that : your ip is not fix), when you have a account, you can present your skill on your userpage (Here).

Regards

197.235.63.81 (talkcontribs)

That's pretty ironic considering that you violated the good faith. If you acted in good faith you would have created a thread here and asked before reverting, and you'd see this thread. In reality DannyS712's revert could be considered slightly sensible because I only documented the parameter without fixing the link, every revert after that was just downright unconstructive, considering that I amended the page to include a URL which clearly demonstrated how it worked, and added an edit summary reflecting the edits.


It is pretty simple, read before acting, if someone makes a contribution, check that it is accurate, if it is not revert it. If the original contributor adds more information, double check that it is right before blindly reverting it. The edit was so obvious that it didn't even need an edit summary, because the link itself provided adequate proof which would be trivial to double check by simply clicking it before and after.

The funniest thing is that this page wouldn't even have existed on this wiki if I hadn't resurrected it and imported it from meta.

Having an account wouldn't fix anything, some users here blindly revert even registered users.

Tomybrz (talkcontribs)
There are no older topics