Template:Muwatta: Difference between revisions

Changed template for Quranx.com
[checked revision][checked revision]
No edit summary
(Changed template for Quranx.com)
Line 1: Line 1:
[[Compendium of Muslim Texts|Al-Muwatta]] [{{Compendium-of-muslim-texts-base-url}}/hadith/muwatta/{{three digit|{{{1|7}}}}}-mmt.php#{{three digit|{{{1|7}}}}}.{{{1|7}}}.{{{2|1}}}.{{{3|5}}}{{{4|b}}} {{{1|7}}} {{{2|1}}}.{{{3|5}}}{{{4|b}}}]<noinclude>
{{#vardefine:Clean4thParameter|}}
 
<!--If parameter 4 exists, set the variable to the number at the start of it (1-4 digits) if there is one due to misuse by some editors. Leaves out any suffix-->
 
{{#if: {{{4|}}}  |
  {{#ifexpr: {{#pos:0123456789|{{#sub:{{{4|}}}|0|1}}}}    |  {{#vardefine:Clean4thParameter|{{#sub:{{{4|}}}|0|1}}}}
  }}
  {{#ifexpr: {{#pos:0123456789|{{#sub:{{{4|}}}|1|1}}}}    |  {{#vardefine:Clean4thParameter|{{#sub:{{{4|}}}|0|2}}}}
  }}
  {{#ifexpr: {{#pos:0123456789|{{#sub:{{{4|}}}|2|1}}}}    |  {{#vardefine:Clean4thParameter|{{#sub:{{{4|}}}|0|3}}}}
  }}
  {{#ifexpr: {{#pos:0123456789|{{#sub:{{{4|}}}|3|1}}|}}  |  {{#vardefine:Clean4thParameter|{{#sub:{{{4|}}}|0|4}}}}
  }}
}}
 
<!--If parameter 5 exists and is not erroneously mistyped create an in-book url with 1st and 3rd parameters. If no 5th parameter, create a USC ref using parameters 2 and 4 for cases where the old template was misused (i.e. 4 contains a number), or otherwise with parameters 1 and 3-->
 
{{#if: {{{5|}}}  |
  {{ #switch: {{lc: {{{5|}}} }}  
    | in-book = [http://quranx.com/Hadith/Malik/ByIndex/In-Book/Book-{{#expr:{{{1|1}}}}}/Hadith-{{#expr:{{{3|1}}}}}/ Al-Muwatta {{{1|1}}}:{{{3|1}}} (In-Book Ref)]
    | [http://quranx.com/Hadith/Malik/ByIndex/In-Book/Book-{{#expr:{{{1|1}}}}}/Hadith-{{#expr:{{{3|1}}}}}/ Al-Muwatta {{{1|1}}}:{{{3|1}}} (5th parameter error)]
  }}|
    {{#ifexpr: {{#var:Clean4thParameter}} |  [http://quranx.com/Hadith/Malik/ByIndex/USC-MSA/Book-{{#expr:{{{2|1}}}}}/Hadith-{{#expr:{{#var:Clean4thParameter}}}}/ Al-Muwatta {{{2|1}}}:{{{4|1}}}]  |  [http://quranx.com/Hadith/Malik/ByIndex/USC-MSA/Book-{{#expr:{{{1|1}}}}}/Hadith-{{#expr:{{{3|1}}}}}/ Al-Muwatta {{{1|1}}}:{{{3|1}}}]  
 
    }} 
}}
 
<!--The <nowiki>{{#expr: }}</nowiki> function in the template is used to trim any leading zeros in the numbers.-->
<!--the old cmje links were constructed making use of the <nowiki>{{three digit|}}</nowiki> function)-->
<noinclude>
This template is used to provide sources for Sahih Muslim references. It formerly produced links to the cmje website, which no longer works. We are currently using QuranX.com instead, which is able to handle USC-MSA and in-book reference conventions.
 
This template is used to provide sources for al-Muwatta references. It formerly produced links to the cmje website, which no longer works. We are currently using QuranX.com instead, which is able to handle USC-MSA and in-book reference conventions.


This template is used to provide sources for Muwatta references from USC-MSA.


==Usage==
==Usage==
First Parameter is the Book Number.<BR>
First Parameter is the Book Number.<BR>
Second Parameter is the Section Number.<BR>
Second Parameter is the Section Number (leave this empty - it is ignored by the current template and was used for the cmje site)<BR>
Thrid Parameter is the Verse Number.<BR>
Third Parameter is the Verse Number.<BR>
Forth Parameter is for the a, b, c etc suffix which some hadiths have on cmje (leave this empty - it is ignored by the current template except for any number within it due to some editors incorrectly using the template in the past by putting the hadith number in there (with or without suffix) and the book number in the 2nd parameter)
 
;Example for hadiths using MSA-USC numbering:
:<nowiki>{{Muwatta|14||8}}</nowiki> (note the empty 3rd parameter)
 
Produces:
:{{Muwatta|14||8}}
 
;Example for the same hadith using in-book numbering:
:<nowiki>{{Muwatta|14||465||in-book}}</nowiki> (note the empty 2nd and 4th parameters)


;Source and sample
Produces:
{{clear}}
:{{Muwatta|14||465||in-book}}
'''For hadiths with section "a","b" and so on use'''
*<nowiki>{{Muwatta|7|1|5|b}}</nowiki> will produce {{Muwatta|7|1|5|b}}
'''For hadiths without sections use the following format'''
*<nowiki>{{Muwatta|17|19|34|}}</nowiki> will produce {{Muwatta|17|19|34|}}




Editors, em-bypass-2, Reviewers, rollback, Administrators
2,743

edits