예제 #1
0
 public function format_of($text, $check_simple = false)
 {
     return Conf::check_format($this->paperFormat, $check_simple ? $text : null);
 }
예제 #2
0
 private function _check_heading($thenval, $rstate, $srows, $lastheading, &$body)
 {
     if ($this->count != 1 && $thenval != $lastheading) {
         $rstate->headingstart[] = count($body);
     }
     while ($lastheading != $thenval) {
         ++$lastheading;
         $ginfo = get($this->search->groupmap, $lastheading);
         if ($ginfo === null || !isset($ginfo->heading) || strcasecmp($ginfo->heading, "none") == 0) {
             if ($this->count != 1) {
                 $body[] = "  <tr class=\"plheading_blank\"><td class=\"plheading_blank\" colspan=\"{$rstate->ncol}\"></td></tr>\n";
             }
         } else {
             $x = "  <tr class=\"plheading\"";
             if (isset($ginfo->tag)) {
                 $x .= " data-anno-tag=\"{$ginfo->tag}\"";
             }
             if (isset($ginfo->annoId)) {
                 $x .= " data-anno-id=\"{$ginfo->annoId}\" data-tags=\"{$ginfo->tag}#{$ginfo->tagIndex}\"";
             }
             $x .= ">";
             if ($rstate->titlecol) {
                 $x .= "<td class=\"plheading_spacer\" colspan=\"{$rstate->titlecol}\"></td>";
             }
             $x .= "<td class=\"plheading\" colspan=\"" . ($rstate->ncol - $rstate->titlecol) . "\">";
             for ($i = $this->count - 1; $i < count($srows) && $this->_row_thenval($srows[$i]) == $lastheading; ++$i) {
                 /* do nothing */
             }
             $count = plural($i - $this->count + 1, "paper");
             $x .= "<span class=\"plheading_group";
             if ($ginfo->heading !== "" && ($format = Conf::check_format($ginfo->annoFormat, $ginfo->heading))) {
                 $x .= " need-format\" data-format=\"{$format}";
                 $this->need_render = true;
             }
             $x .= "\" data-title=\"" . htmlspecialchars($ginfo->heading) . "\">" . htmlspecialchars($ginfo->heading) . ($ginfo->heading !== "" ? " " : "") . "</span><span class=\"plheading_count\">{$count}</span></td></tr>";
             $body[] = $x;
             $rstate->colorindex = 0;
         }
     }
     return $thenval;
 }
예제 #3
0
 public static function unparse_anno_json($anno)
 {
     $j = (object) ["annoid" => $anno->annoId === null ? null : +$anno->annoId];
     if ($anno->tagIndex !== null) {
         $j->tagval = (double) $anno->tagIndex;
     }
     $j->heading = $anno->heading;
     if ($format = Conf::check_format($anno->annoFormat, (string) $anno->heading)) {
         $j->format = +$format;
     }
     return $j;
 }