Difference between revisions of "Template:DecodeTextFormula"

From Encyclopedia of Scientonomy
Jump to navigation Jump to search
(Created page with "<noinclude> Use this template to convert a text formula into a proper text. This is useful when formulating page titles or formulation texts for questions or answers. '''NOTE...")
 
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
Use this template to convert a text formula into a proper text. This is useful when formulating page titles or formulation texts for questions or answers.
+
Use this template to convert a text formula that includes a <subject>, <predicate>, and <object> (in the sense of RDF) and their variations into a proper text. This is useful when formulating page titles or formulation texts for questions or answers. If no formula is given, the object will be returned.
  
 
'''NOTE:''' As any "printing" template, it doesn't store any values anywhere, but merely returns a value.
 
'''NOTE:''' As any "printing" template, it doesn't store any values anywhere, but merely returns a value.
Line 6: Line 6:
 
'''Parameters:'''
 
'''Parameters:'''
 
* <code><nowiki>|formula=</nowiki></code> - the term.
 
* <code><nowiki>|formula=</nowiki></code> - the term.
Any number of pairs of the encoded parameter and its corresponding value:
+
* <code><nowiki>|subject=</nowiki></code> - the singular form of the subject of the formulation. Must be a term (definitional topic) registered in the encyclopedia.
* <code>|''param''=''value''</code> - where ''param'' is the encoded parameter and ''value'' is what it should be replaced with. If the latter is a Definitional Topic page, then additional formatting is supported.  
+
* <code><nowiki>|object=</nowiki></code> - the object of the formulation. Can be a term or any other value.
 +
* <code><nowiki>|predicate=</nowiki></code> - the predicate of the formulation. Optional. Can be a term or any other value.
 +
* <code><nowiki>|link=</nowiki></code> - if not empty, links will be added to values (if the respective pages exist).
  
'''Additional Formatting:'''
+
 
 +
'''Additional Formatting'''
 +
 
 +
If any of the three terms is a Definitional Topic page, then additional formatting is supported for that term:
  
 
'''lowercase''' or '''Capitalize Each Word''': To tell the software that it should be lowercase, the variable name should be all lowercase, e.g.:
 
'''lowercase''' or '''Capitalize Each Word''': To tell the software that it should be lowercase, the variable name should be all lowercase, e.g.:
* <epistemic element> will produce “theory”, “method”, etc.  
+
* <subject> will produce “theory”, “method”, "epistemic elements", etc.  
If at least one letter is capitalized, then the software will go with the Capital Each Word option, e.g.:
+
If the first letter is capitalized, then the software will go with the Capital Each Word option, e.g.:
* <Epistemic element>, <Epistemic Element>, or <ePistemic eLement> etc. will produce “Theory”, “Method”, etc.  
+
* <Subject> will produce “Theory”, “Method”, "Epistemic Element" etc.
 +
 
 +
 
 +
'''singular''' or '''plural''': The usual way of using the variable will tell the software that the singular form is required, e.g.:
 +
* <subject> will produce “theory”, “method”, "epistemic elements", while <Subject> will produce “Theory”, “Method”, "Epistemic Element" all in singular form.
 +
To indicate that the plural form is required, an “s” should be added at the end of the variable before the closing “>”, e.g.:
 +
* <subjects> will produce “theories”, while <Subjects> will produce “Theories”.
 +
 
 +
 
 +
If the term is singular, it can be printed '''with''' or '''without an article''': If an indefinite article is to be added in front of the variable, this can be achieved by adding an “a ” after the opening “<” of the variable, e.g.:
 +
* <a subject> will produce “an epistemic element”, “a theory”, "a method" while <a Subject> will produce “an Epistemic Element”, “a Theory”, "a Method"
 +
Note that with <object> it should be <an object> or <an Object>.
 +
 
 +
'''IMPORTANT:''' This parameter is ignored if the plural form is requested. There is no <an objects> or <an Objects>.
 +
 
  
'''singular''' or '''plural''': The usual way of using the variable will tell the software that the singular form is required. To indicate that the plural form is required, an “s” should be added at the end of the variable after the closing “>”, e.g.:
 
* <epistemic element>s will produce “theories”, while <Epistemic Element>s will produce “Theories”.
 
  
If singular: with or without an article: If an indefinite article is to be added in front of the variable, this can be achieved by adding an “a” in front of the opening “<” of the variable, e.g.:
+
If the term is '''not registered''' in the encyclopedia, then the following will apply:
* a<epistemic element> will produce “an epistemic element”, “a theory”, etc.
+
* For '''lowercase''', a simple <code><nowiki>{{lc:</nowiki>''string''<nowiki>}}</nowiki></code> will be applied.
This parameter is ignored if the plural form is requested.
+
* For '''plural''', <code><nowiki>{{Plural|</nowiki>''string''<nowiki>}}</nowiki></code> is used to add an "s" to the end of the term.
 +
* For singulars '''with articles''', <code><nowiki>{{AnAWord|</nowiki>''string''<nowiki>}}</nowiki></code> is used to add an "a "/"an " to the word.
  
  
 
 
</noinclude><includeonly><!--
 
</noinclude><includeonly><!--
-->{{#if: {{{term|}}}<!--
+
-->{{#if: {{{formula|}}}<!--
  -->|<!--  
+
  -->|<!--
-->}}<!-- if  
+
  -->{{#vardefine: varText|{{{formula|}}}}}<!--
 +
  --><!--
 +
  -->{{#if: {{{subject|}}}<!-- replace all occurrences of the subject
 +
  -->|<!--
 +
    --><!-- replace all instances of Singular lowercase
 +
    -->{{#vardefine: varText|{{#replace: {{#var: varText}}|<subject>|{{PrintTermSingularLowercase|{{{subject|}}}|{{#if: {{{link|}}}|link|}}}} }} }}<!--
 +
    --><!-- replace all instances of Plural lowercase
 +
    -->{{#vardefine: varText|{{#replace: {{#var: varText}}|<subjects>|{{PrintTermPluralLowercase|{{{subject|}}}|{{#if: {{{link|}}}|link|}}}} }} }}<!--
 +
    --><!-- replace all instances of Singular lowercase preceded by an article
 +
    -->{{#vardefine: varText|{{#replace: {{#var: varText}}|<a subject>|{{PrintTermAnASingularLowercase|{{{subject|}}}|{{#if: {{{link|}}}|link|}}}} }} }}<!--
 +
    --><!-- replace all instances of Singular Capitalized
 +
    -->{{#vardefine: varText|{{#replace: {{#var: varText}}|<Subject>|{{PrintTermSingularCapitalized|{{{subject|}}}|{{#if: {{{link|}}}|link|}}}} }} }}<!--
 +
    --><!-- replace all instances of Plural Capitalized
 +
    -->{{#vardefine: varText|{{#replace: {{#var: varText}}|<Subjects>|{{PrintTermPluralCapitalized|{{{subject|}}}|{{#if: {{{link|}}}|link|}}}} }} }}<!--
 +
    --><!-- replace all instances of Singular Capitalized preceded by an article
 +
    -->{{#vardefine: varText|{{#replace: {{#var: varText}}|<a Subject>|{{PrintTermAnASingularCapitalized|{{{subject|}}}|{{#if: {{{link|}}}|link|}}}} }} }}<!--
 +
    --><!--
 +
  -->}}<!--
 +
  --><!--
 +
  -->{{#if: {{{object|}}}<!-- replace all occurrences of the object
 +
  -->|<!--
 +
    --><!-- replace all instances of Singular lowercase
 +
    -->{{#vardefine: varText|{{#replace: {{#var: varText}}|<object>|{{PrintTermSingularLowercase|{{{object|}}}|{{#if: {{{link|}}}|link|}}}} }} }}<!--
 +
    --><!-- replace all instances of Plural lowercase
 +
    -->{{#vardefine: varText|{{#replace: {{#var: varText}}|<objects>|{{PrintTermPluralLowercase|{{{object|}}}|{{#if: {{{link|}}}|link|}}}} }} }}<!--
 +
    --><!-- replace all instances of Singular lowercase preceded by an article
 +
    -->{{#vardefine: varText|{{#replace: {{#var: varText}}|<an object>|{{PrintTermAnASingularLowercase|{{{object|}}}|{{#if: {{{link|}}}|link|}}}} }} }}<!--
 +
    --><!-- replace all instances of Singular Capitalized
 +
    -->{{#vardefine: varText|{{#replace: {{#var: varText}}|<Object>|{{PrintTermSingularCapitalized|{{{object|}}}|{{#if: {{{link|}}}|link|}}}} }} }}<!--
 +
    --><!-- replace all instances of Plural Capitalized
 +
    -->{{#vardefine: varText|{{#replace: {{#var: varText}}|<Objects>|{{PrintTermPluralCapitalized|{{{object|}}}|{{#if: {{{link|}}}|link|}}}} }} }}<!--
 +
    --><!-- replace all instances of Singular Capitalized preceded by an article
 +
    -->{{#vardefine: varText|{{#replace: {{#var: varText}}|<an Object>|{{PrintTermAnASingularCapitalized|{{{object|}}}|{{#if: {{{link|}}}|link|}}}} }} }}<!--
 +
    --><!--
 +
  -->}}<!--
 +
  --><!--
 +
  --><!--
 +
  -->{{#if: {{{predicate|}}}<!-- replace all occurrences of the predicate
 +
  -->|<!--
 +
    --><!-- replace all instances of Singular lowercase
 +
    -->{{#vardefine: varText|{{#replace: {{#var: varText}}|<predicate>|{{PrintTermSingularLowercase|{{{predicate|}}}|{{#if: {{{link|}}}|link|}}}} }} }}<!--
 +
    --><!-- replace all instances of Plural lowercase
 +
    -->{{#vardefine: varText|{{#replace: {{#var: varText}}|<predicates>|{{PrintTermPluralLowercase|{{{predicate|}}}|{{#if: {{{link|}}}|link|}}}} }} }}<!--
 +
    --><!-- replace all instances of Singular lowercase preceded by an article
 +
    -->{{#vardefine: varText|{{#replace: {{#var: varText}}|<a predicate>|{{PrintTermAnASingularLowercase|{{{predicate|}}}|{{#if: {{{link|}}}|link|}}}} }} }}<!--
 +
    --><!-- replace all instances of Singular Capitalized
 +
    -->{{#vardefine: varText|{{#replace: {{#var: varText}}|<Predicate>|{{PrintTermSingularCapitalized|{{{predicate|}}}|{{#if: {{{link|}}}|link|}}}} }} }}<!--
 +
    --><!-- replace all instances of Plural Capitalized
 +
    -->{{#vardefine: varText|{{#replace: {{#var: varText}}|<Predicates>|{{PrintTermPluralCapitalized|{{{predicate|}}}|{{#if: {{{link|}}}|link|}}}} }} }}<!--
 +
    --><!-- replace all instances of Singular Capitalized preceded by an article
 +
    -->{{#vardefine: varText|{{#replace: {{#var: varText}}|<a Predicate>|{{PrintTermAnASingularCapitalized|{{{predicate|}}}|{{#if: {{{link|}}}|link|}}}} }} }}<!--
 +
    --><!--
 +
  -->}}<!--
 +
  --><!--
 +
  --><!-- return the text
 +
  -->{{#var: varText}}<!--
 +
  --><!--
 +
-->|<!--
 +
  --><!-- no formula is given: return the object
 +
  -->{{{object|}}}<!--
 +
  --><!--
 +
-->}}<!-- if  
 
--></includeonly>
 
--></includeonly>

Latest revision as of 16:33, 24 January 2023

Use this template to convert a text formula that includes a <subject>, <predicate>, and <object> (in the sense of RDF) and their variations into a proper text. This is useful when formulating page titles or formulation texts for questions or answers. If no formula is given, the object will be returned.

NOTE: As any "printing" template, it doesn't store any values anywhere, but merely returns a value.

Parameters:

  • |formula= - the term.
  • |subject= - the singular form of the subject of the formulation. Must be a term (definitional topic) registered in the encyclopedia.
  • |object= - the object of the formulation. Can be a term or any other value.
  • |predicate= - the predicate of the formulation. Optional. Can be a term or any other value.
  • |link= - if not empty, links will be added to values (if the respective pages exist).


Additional Formatting

If any of the three terms is a Definitional Topic page, then additional formatting is supported for that term:

lowercase or Capitalize Each Word: To tell the software that it should be lowercase, the variable name should be all lowercase, e.g.:

  • <subject> will produce “theory”, “method”, "epistemic elements", etc.

If the first letter is capitalized, then the software will go with the Capital Each Word option, e.g.:

  • <Subject> will produce “Theory”, “Method”, "Epistemic Element" etc.


singular or plural: The usual way of using the variable will tell the software that the singular form is required, e.g.:

  • <subject> will produce “theory”, “method”, "epistemic elements", while <Subject> will produce “Theory”, “Method”, "Epistemic Element" all in singular form.

To indicate that the plural form is required, an “s” should be added at the end of the variable before the closing “>”, e.g.:

  • <subjects> will produce “theories”, while <Subjects> will produce “Theories”.


If the term is singular, it can be printed with or without an article: If an indefinite article is to be added in front of the variable, this can be achieved by adding an “a ” after the opening “<” of the variable, e.g.:

  • <a subject> will produce “an epistemic element”, “a theory”, "a method" while <a Subject> will produce “an Epistemic Element”, “a Theory”, "a Method"

Note that with <object> it should be <an object> or <an Object>.

IMPORTANT: This parameter is ignored if the plural form is requested. There is no <an objects> or <an Objects>.


If the term is not registered in the encyclopedia, then the following will apply:

  • For lowercase, a simple {{lc:string}} will be applied.
  • For plural, {{Plural|string}} is used to add an "s" to the end of the term.
  • For singulars with articles, {{AnAWord|string}} is used to add an "a "/"an " to the word.