Issue:Including chapter content brings unwated 'ENTERS'

From FollowTheScore
Jump to: navigation, search
Description: Including chapter contents with mode=userformat does not allow full control of the table output because chapters contain 'ENTER' characters at the beginning and at the end.
Extension / Version: DPL   /   1.6.8
Type / Status: Bug   /   closed

Problem

Hi,

First thank you for this great extension with all the debugging feature it helped me understood how to personalise it and it's starting to find some very useful applications on my wiki (emuwiki.com). I appreciate the mode=userformat mode which basically enable to do anything.

But...

When we include chapter content, we don't want the ¶ characters located in the chapter content to come and break our table structure. For example, I want to reproduce this piece of code :

{| class="collapsible autocollapse" border="0" style="background:black; color:white" cellspacing="0" border-collapse="collapse" bordercolor="black"
|- style="background:black; color:white"
!width="425"|{{{Name}}}
!width="500"|{{{Description}}}
|- align="center"
| {{{VService}}} || {{{ExtendedDescription}}}
|}

this was the old way that I did things, I now want to replace all the templates variables by chapter contents from independant pages (for integration with inputbox and other reasons...)

problem is, chapter contents in mediawiki always contain a (not visible but present) ¶ at the beginning and at the end of chapter. So even if I remove all the ¶ I can in the listseparators and secseparators values, the best code I can reproduce is :

{| class="collapsible autocollapse" border="0" style="background:black; color:white" cellspacing="0" border-collapse="collapse" bordercolor="black"
|- style="background:black; color:white"
!width="425"|
Name
!width="500"|
Description
|- align="center"
| 
Vservice ||
ExtendedDescription
|}

As you can see, everywhere I use chapter content (Name, Description, Vservice, ExtendedDescription), it causes a 'ENTER' to be made and breaks my table structure.

That doesn't seem to be a big problem, if I knew anything about php I would go into the file but I really don't know anything. It would be nice to have an argument noenterchapter=true that would simply remove the 'ENTER' character at the beginning and at the end of the content when using #include.

Thanks a lot!

Here is the code I use to bring the table in mediawiki :

<DPL>
category       =Video
mode           =userformat
includepage    =#Title,#Short Description,#Video,#Long Description
listseparators =,,,
secseparators  ={| class="collapsible autocollapse" border="0" style="background:black; color:white" cellspacing="0" border-collapse="collapse" bordercolor="black"¶|- style="background:black; color:white"¶!width="425"|,,¶!width="500"|,¶|- align="center"¶,| , ,||,¶|}¶
debug=5
</DPL>

Reply

As far as I can see you are trying to create a table which contains several columns where each column gets filled with the contents from a chapter of certain articles.

There is a much easier way to do this: use table and tablerows. You can even add format tags with these commands very easily. A "width" would typically be placed in the headline, a color attribute or a text size attribute would have to be repeated in each row, so it goes into the tablerows command. Look how it works:

<dpl>
  titlematch=Nigeria
  include=#fruit,#color,#Religion
  table=class=sortable,Country,fruit,width=300px{{!}}color,Religion
  tablerow=%%,bgcolor=#ffccff{{!}}%%,«small»%%«/small»
</dpl>

and here is the result:

Country fruit color Religion
Nigeria

The fruit of Nigeria is big and round.

Nigeria is blue.

Nigeria has a variety of religions which tend to vary regionally, this situation accentuates regional and ethnic distinctions and has often been seen as a major source of sectarian conflict amongst the population. All religions represented in Nigeria were practiced in every major city in the 1990s. Islam dominates in the north and the South western part of the country with some northern states having incorporated Shari'a law amidst controversy.

According to the world CIA Factbook, Nigeria's population is comprised of 50% Muslims, 40% Christians and 10% indigenous groups [1].

Nigerian Muslims are historically 100% Sunni and of the Maliki School of Jurisprudence. Starting in the 80s, a small Shi'a population began taking root in some urban centers of the North.

Protestantism and local syncretic Christianity predominate in Yoruba areas, while Catholicism has a strong historical presence amongst the Igbo and closely-related ethnic groups. Indigenous beliefs such as Orisha and Voodoo (Vodun) are still widely held amongst the Yoruba, Igbos and other ethnic groups in the southwest and east of the country. Recently however, such worship has undergone significant decline, as many adherents are converting to Islam and Christianity.

Have fun with DPL! Gero 22:23, 4 April 2008 (CEST)


Re Reply

Thanks for the answer. Actually I like userformat so much that I found a way to overcome this by still using userformat : instead of referencing to chapter content I refer to template content, that are all put in chapter form in their respective template-based pages. You can see what it looks like at the video section of my website. It's basically a table that is expandible and that allows to see a youtube video directly on the wiki page. Now that wouldn't normally need DPL, but here's the kicker : any user can add a template page from an easy-to-use form using Semantic form, and the video list is automatically updated, thanks to DPL :)

Even if you showed that there was other ways to do what I wanted to do, I defenetly think that it would give more freedom to the user that uses the Include chapters feature with userformat if you would remove the ¶s at the beginning and end of chapter. Then we could say that the user can really do any thing with userformat.

Conclusion

Well, after all it is not that complicated to add an option for trimming included contents. See the new includetrim command. It would be nice if you tested it and gave some feedback.

Gero 22:35, 6 April 2008 (CEST)

Beta Testing

Here is the test : Test includetrim.

Well after testing all I can say is good job, I have no comment this is exactly what I needed. I think it totally goes in the spirit of userformat : gives the user the choice to do what he wants with what he's including. Now dynamic lists can be made out of chapter content without having these annoying ¶s at the beginning or the end. I saw that you don't just remove the ¶s that are inherent to mediawiki, you also remove any ¶s that users would have made before or after the chapter, which is good because people tend to write like this for readability :

=Chapter Name=


Hello this is the content....


=Other chapter name=


......

Great job ! If you need beta testers or if you're planning any other extensions and are looking for someone like me to write help files for it, don't hesitate to contact me at admin@emuwiki.com.

Reply

One of the most important things you could do at the moment is to put pressure on the MW developers. They should not change the parser in 1.12 in a way which will cut down significant parts of DPL's current functionality!

Apart from that: Thanks for the offer, we#ll see what comes up ... Gero 07:52, 7 April 2008 (CEST)

ReReply

Hum I'm using DPL with MW 1.12 on my website and didn't find any problem! What is the problem ?

In most cases the difference will not be very significant. Try the above example and watch the difference!