Added automating explanations to indicators
This commit is contained in:
		| @@ -18,6 +18,24 @@ function entryHasExamples() { | ||||
|     return props.entryData.examples.length > 0; | ||||
| } | ||||
|  | ||||
| function interpretXPathIndicators( elementType:string ):string { | ||||
|     const lastChar = elementType.charAt(elementType.length - 1); | ||||
|     var meaning = ""; | ||||
|     switch (lastChar) { | ||||
|         case "*": | ||||
|             meaning = "Zero or more"; | ||||
|         case "?": | ||||
|             meaning = "Zero or one"; | ||||
|         case "+": | ||||
|             meaning = "One or more"; | ||||
|  | ||||
|     } | ||||
|     if (meaning.length == 0) | ||||
|         return elementType; | ||||
|     else | ||||
|         return elementType + " (" + meaning + ")"; | ||||
| } | ||||
|  | ||||
| </script> | ||||
|  | ||||
| <template> | ||||
| @@ -38,12 +56,12 @@ function entryHasExamples() { | ||||
|                     <th>Description</th> | ||||
|                 </tr> | ||||
|                 <tr v-for="arg in props.entryData.arguments"> | ||||
|                     <td class="text-center">{{ arg.type }}</td> | ||||
|                     <td class="text-center">{{ interpretXPathIndicators( arg.type ) }}</td> | ||||
|                     <td class="text-center">{{ arg.description }}</td> | ||||
|                 </tr> | ||||
|             </table> | ||||
|             <div class="mt-2"> | ||||
|                 <strong>Output: </strong>{{ props.entryData.output }} | ||||
|                 <strong>Output: </strong>{{ interpretXPathIndicators(props.entryData.output) }} | ||||
|             </div> | ||||
|              | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user