File tree 1 file changed +0
-20
lines changed
app/src/main/java/fr/free/nrw/commons/utils 1 file changed +0
-20
lines changed Original file line number Diff line number Diff line change 8
8
import java .util .regex .Pattern ;
9
9
10
10
public class MediaDataExtractorUtil {
11
-
12
- /**
13
- * We could fetch all category links from API, but we actually only want the ones
14
- * directly in the page source so they're editable. In the future this may change.
15
- *
16
- * @param source wikitext source code
17
- */
18
- public static ArrayList <String > extractCategories (String source ) {
19
- ArrayList <String > categories = new ArrayList <>();
20
- Pattern regex = Pattern .compile ("\\ [\\ [\\ s*Category\\ s*:([^]]*)\\ s*\\ ]\\ ]" , Pattern .CASE_INSENSITIVE );
21
- Matcher matcher = regex .matcher (source );
22
- while (matcher .find ()) {
23
- String cat = matcher .group (1 ).trim ();
24
- categories .add (cat );
25
- }
26
-
27
- return categories ;
28
- }
29
-
30
-
31
11
/**
32
12
* Extracts a list of categories from | separated category string
33
13
*
You can’t perform that action at this time.
0 commit comments