File: markup.stp

package info (click to toggle)
eclipse-linuxtools 8.1.0%2Bdfsg.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 42,888 kB
  • sloc: java: 149,148; xml: 22,186; ansic: 15,426; cpp: 326; makefile: 42; javascript: 29; sh: 19; python: 10
file content (81 lines) | stat: -rw-r--r-- 1,152 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
global var
global tagmap
global taglimit = 100
global stillopen = 0


function opentag:long(s:string) {
	if (var == taglimit) return -1
	var++
	tagmap[var] = tokenize(s," ")
	if (stillopen == 1)
		printf(">") 
	indentless()	
	printf("<%s", s)
	stillopen = 1
	return 1
}

function openclosetag(s:string) {
	opentag(s)
	printf("/>")
	var--
}

function addlong:long(s:string, l:long) {
	if (var < 1)
		return -1
	indent()
	printf("%s=%d", s,l);
	
}

function addstr:long(s:string, s1:string) {
	if (var < 1)
		return -1
	indent()
	printf("%s=%s", s, s1)
}

function addtext:long(s:string) {
	if (stillopen == 1) {
		printf(">")
	}
	stillopen = 0
	if (var < 1)
		return -1
	indent()
	printf("%s", s)	
}

function indent() {
	printf("\n")
	for (i = 0; i < var; i++) printf("\t")
}

function indentless() {
	printf("\n")
	for (i = 1; i < var; i++) printf("\t")
}

function closetag(s:string) {
	if (stillopen == 1) {
		printf(">")
	}
	stillopen = 0
	indentless()
	printf("</%s>", s)
	var--
}

function closecurrent() {
	closetag(tagmap[var])
}

function setLimit(v:long) {
	taglimit = v
}

function closeall() {
	for (i = 0; i <= var; i ++) closecurrent()
}