To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 48cfb0a1 authored by vermeul's avatar vermeul
Browse files

Update README.md

parent f71075d6
......@@ -30,6 +30,7 @@ Annotations come in different flavors:
Annotations can be categorized, but don't have to be. The categories themselves are organized hierarchically.
If a category has no parent category, it is a top category. If a category has no child category, it is called a leaf.
If a category has both a parent and a child category, it is called a node.
Categories themselves don't have to be unique. In the example below, the category `examples` is not unique, one
belongs to its parent `written addition` and the other to `written sutraction`:
......@@ -48,6 +49,27 @@ So if we want to annotate a written subtraction example, we simply write:
```
Note: **the combination of parent_category/child_category must be unique**
### insert new category
To insert a new category into the categories table, we simply add one of the following anywhere in a Wiki Page:
```
{{#annotcat: add | new top category:description }}
{{#annotcat: add | new category:description | parent_category }} # add to an existing top category
{{#annotcat: add | new category:description | grandparent_category/parent_category}} # identify a node
{{#annotcat: del | kat_parent/kat_child }}
```
Before page gets saved, and after these categories are added/removed,
these parser functions are removed from the Wiki Page source.
### list existing categories
```
{{#annotcat: list }} # lists all categories
{{#annotcat: list | top_cat }} # start with top_cat (which must have no parent)
{{#annotcat: list | parent_cat/child_cat }} # start list with node parent_cat/child_cat
```
## Nested or overlapping annotations: Examples
The vertical bars are used to supply a number of different arguments. Because annotations can be even nested or overlapping,
......@@ -83,4 +105,42 @@ while annotation (b) will contain this part of the WikiText:
somewhere in your Wikicode, preferably at the beginning or end of your page.
The output will be a sortable Wikitable which contains comment, category and
the extracted text.
\ No newline at end of file
the extracted text.
# query annotations
Example: find all pages with category kat_parent1:kat_child1 but not !kat_parent2:kat_child2 which contain either comment1 OR comment2 and where wiki_text contains the word «bla»:
```
{{#annotask:
category=[kat_parent1/kat_child1, !kat_parent2/kat_child2],
comment={comment1, comment2},
wiki_text=[*bla*]
}}
```
Result:
```Page (link to page), comment, category, wiki_text```
**Problem**: how to provide a deep link, not just to the page but to the right paragraph which was annotated.
**Possible Solutions**:
- Maybe search for the text?
- Can we add a unique ID to the function hook? Difficult.
- We now start_char and end_char in the source. Maybe we can add a marker at the given spots?
- we should always include the next previous title to the annotation. We then could use this title to add an anchor to the URL and thus be redirected to the right paragraph.
```
[[category:kat_parent1/kat_child1]] # this and all categories below
[[category:kat_parent1/kat_child1 || kat_parent2/kat_child2]] # OR
[[category:kat_parent1/kat_child1 && kat_parent2/kat_child2]] # AND
[[category!:kat_parent1/kat_child1 ]] # category is NOT kat_parent1/kat_child1
[[wikitext~*anything*]] # wikitext LIKE %anything%
[[wikitext!~*anything*]] # wikitext NOT LIKE %anything%
> and <: "greater than" and "less than"
≥ and ≤: "greater than or equal" and "less than or equal"
!: "not" ("unequal")
~: «like» comparison for strings
!~: «not like» comparison for strings
?: match any single character
```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment