interplane-forge
INTERPLANE Forge
Brought by drakestapleton
interplane-forge / collab / native / helpers.om
| 1 | note HTML and JSON helpers shared by the imported issue views. |
| 2 | global gcrq uchar 16 |
| 3 | global gcrql ulong 1 |
| 4 | text tcid "id" |
| 5 | text tcdraft "draft" |
| 6 | text tcarch "archived" |
| 7 | text tcclosed "closed" |
| 8 | global gcm ulong 16 |
| 9 | text tcah "<a href=\"" |
| 10 | text tcqg "\">" |
| 11 | text tcae "</a>" |
| 12 | text tcissp "/issues/" |
| 13 | text tcpats "/patches" |
| 14 | text tcisss "/issues" |
| 15 | text tcnot "(no title)" |
| 16 | text tcmidd " · " |
| 17 | text tcstq "?state=" |
| 18 | text tcstn "state" |
| 19 | text tcopen "open" |
| 20 | text tcmerged "merged" |
| 21 | text tcall "all" |
| 22 | text tcsopen "Open" |
| 23 | text tcsdraft "Draft" |
| 24 | text tcsclos "Closed" |
| 25 | text tcsmerg "Merged" |
| 26 | text tcsarch "Archived" |
| 27 | text tcsall "All" |
| 28 | text tciss "Issues" |
| 29 | text tcbon "<b>" |
| 30 | text tcboff "</b>" |
| 31 | text tcopar " (" |
| 32 | text tccpar ")" |
| 33 | global gcsn ulong 1 |
| 34 | global gccnt ulong 8 |
| 35 | text tcbok "<b class=\"ok\">" |
| 36 | text tcbbad "<b class=\"bad\">" |
| 37 | text tcbmut "<b class=\"muted\">" |
| 38 | text tclh1 "<h2>" |
| 39 | text tclh2 "</h2>\n<p class=\"bar\">" |
| 40 | text tclh3 "</p>\n" |
| 41 | text tclul "<ul class=\"repos\">\n" |
| 42 | text tcluln "</ul>\n" |
| 43 | text tclnone "<p class=\"muted\">Nothing here in this state.</p>\n" |
| 44 | text tcli1 "<li><a class=\"rname\" href=\"" |
| 45 | text tcli2 "</a> " |
| 46 | text tcli7 "</p>" |
| 47 | text tcli10 "</li>\n" |
| 48 | text tcnwr "new" |
| 49 | text tcjsis "forge/issues/1" |
| 50 | text tcjsi "forge/issue/1" |
| 51 | text tcjsts "states" |
| 52 | text tcjcnt "count" |
| 53 | text tcjpath "path" |
| 54 | text tcjtr "truncated" |
| 55 | text tcjisss "issues" |
| 56 | text tcjtitl "title" |
| 57 | text tcjauth "author" |
| 58 | text tcjupd "updated" |
| 59 | text tcjcoms "comments" |
| 60 | text tcjverd "verdict" |
| 61 | text tcjopen "opened" |
| 62 | text tcjlabs "labels" |
| 63 | text tcjasg "assignees" |
| 64 | text tcjnum "number" |
| 65 | text tcjred "redacted" |
| 66 | text tcjtime "time" |
| 67 | text tcjbody "body" |
| 68 | text tcjreas "reason" |
| 69 | text tcjtrvw "review" |
| 70 | text tcjtcom "comment" |
| 71 | fn cosp to void |
| 72 | fputc 32 |
| 73 | end |
| 74 | fn coqeq n long t view uchar * to bool |
| 75 | if ne ulong n len t |
| 76 | ret false |
| 77 | end |
| 78 | for i ulong len t |
| 79 | if ne get fval i get t i |
| 80 | ret false |
| 81 | end |
| 82 | end |
| 83 | ret true |
| 84 | end |
| 85 | fn coqstate kd ulong to ulong |
| 86 | n = fqget tcstn |
| 87 | if lt n 0 |
| 88 | ret ulong 0 |
| 89 | end |
| 90 | if coqeq n tcdraft |
| 91 | ret ulong 1 |
| 92 | end |
| 93 | if or coqeq n tcclosed coqeq n tcarch |
| 94 | ret ulong 2 |
| 95 | end |
| 96 | if coqeq n tcmerged |
| 97 | ret ulong 3 |
| 98 | end |
| 99 | if coqeq n tcall |
| 100 | ret ulong 9 |
| 101 | end |
| 102 | ret ulong 0 |
| 103 | end |
| 104 | fn costname kd ulong s ulong to void |
| 105 | if eq s 9 |
| 106 | fput tcsall |
| 107 | ret |
| 108 | end |
| 109 | if eq s 0 |
| 110 | fput tcsopen |
| 111 | ret |
| 112 | end |
| 113 | if eq s 1 |
| 114 | fput tcsdraft |
| 115 | ret |
| 116 | end |
| 117 | if eq s 3 |
| 118 | fput tcsmerg |
| 119 | ret |
| 120 | end |
| 121 | if eq kd 1 |
| 122 | fput tcsarch |
| 123 | ret |
| 124 | end |
| 125 | fput tcsclos |
| 126 | end |
| 127 | fn costbadge kd ulong s ulong to void |
| 128 | if or eq s 0 eq s 3 |
| 129 | fput tcbok |
| 130 | else |
| 131 | if eq s 1 |
| 132 | fput tcbmut |
| 133 | else |
| 134 | fput tcbbad |
| 135 | end |
| 136 | end |
| 137 | costname kd s |
| 138 | fput tcboff |
| 139 | end |
| 140 | fn cotab f ulong s ulong nm view uchar * v view uchar * to void |
| 141 | kd = get gcm 9 |
| 142 | fput tcah |
| 143 | fputrl |
| 144 | if eq kd 1 |
| 145 | fput tcpats |
| 146 | else |
| 147 | fput tcisss |
| 148 | end |
| 149 | fput tcstq |
| 150 | fput v |
| 151 | fput tcqg |
| 152 | if eq f s |
| 153 | fput tcbon |
| 154 | end |
| 155 | fput nm |
| 156 | fput tcopar |
| 157 | cotabn kd s |
| 158 | fput tccpar |
| 159 | if eq f s |
| 160 | fput tcboff |
| 161 | end |
| 162 | fput tcae |
| 163 | cosp |
| 164 | end |
| 165 | fn cotabn kd ulong s ulong to void |
| 166 | if eq s 9 |
| 167 | fnum get gcsn 0 |
| 168 | ret |
| 169 | end |
| 170 | fnum get gccnt s |
| 171 | end |
| 172 | fn cotabs kd ulong f ulong to void |
| 173 | cotab f 0 tcsopen tcopen |
| 174 | if eq kd 1 |
| 175 | cotab f 1 tcsdraft tcdraft |
| 176 | cotab f 3 tcsmerg tcmerged |
| 177 | cotab f 2 tcsarch tcarch |
| 178 | else |
| 179 | cotab f 2 tcsclos tcclosed |
| 180 | end |
| 181 | cotab f 9 tcsall tcall |
| 182 | end |
| 183 | fn codrefb to void |
| 184 | i = get fridx 0 |
| 185 | o = get fabo i |
| 186 | n = get fabl i |
| 187 | for k ulong n bound 64 |
| 188 | put gbref k get fabr add o k |
| 189 | end |
| 190 | put gbrefl 0 n |
| 191 | end |
| 192 | fn cojq to void |
| 193 | fputc 34 |
| 194 | end |
| 195 | fn cojsn kd ulong s ulong to void |
| 196 | cojq |
| 197 | cojsv kd s |
| 198 | cojq |
| 199 | end |
| 200 | fn cojsv kd ulong s ulong to void |
| 201 | if eq s 9 |
| 202 | fput tcall |
| 203 | end |
| 204 | if eq s 0 |
| 205 | fput tcopen |
| 206 | end |
| 207 | if eq s 1 |
| 208 | fput tcdraft |
| 209 | end |
| 210 | if eq s 3 |
| 211 | fput tcmerged |
| 212 | end |
| 213 | if eq s 2 |
| 214 | if eq kd 1 |
| 215 | fput tcarch |
| 216 | else |
| 217 | fput tcclosed |
| 218 | end |
| 219 | end |
| 220 | ret |
| 221 | end |
| 222 | fn cojtabs kd ulong to void |
| 223 | fputc 91 |
| 224 | cojtab kd 0 false |
| 225 | if eq kd 1 |
| 226 | cojtab kd 1 true |
| 227 | cojtab kd 3 true |
| 228 | cojtab kd 2 true |
| 229 | else |
| 230 | cojtab kd 2 true |
| 231 | end |
| 232 | cojtab kd 9 true |
| 233 | fputc 93 |
| 234 | end |
| 235 | fn cojtab kd ulong s ulong c bool to void |
| 236 | if c |
| 237 | fputc 44 |
| 238 | end |
| 239 | fputc 123 |
| 240 | fyk0 tcstn |
| 241 | cojsn kd s |
| 242 | fyk tcjcnt |
| 243 | cotabn kd s |
| 244 | fyk tcjpath |
| 245 | cojq |
| 246 | fputrl |
| 247 | if eq kd 1 |
| 248 | fput tcpats |
| 249 | else |
| 250 | fput tcisss |
| 251 | end |
| 252 | fput tcstq |
| 253 | cojsv kd s |
| 254 | cojq |
| 255 | fputc 125 |
| 256 | end |