-lang.text != NULL) {
+ RENDER_VERBATIM(r, " class=\"language-");
+ render_attribute(r, &det->lang, render_html_escaped);
+ RENDER_VERBATIM(r, "\"");
+ }
+
+ RENDER_VERBATIM(r, ">");
+}
+
+static void
+render_open_td_block(MD_HTML* r, const MD_CHAR* cell_type, const MD_BLOCK_TD_DETAIL* det)
+{
+ RENDER_VERBATIM(r, "<");
+ RENDER_VERBATIM(r, cell_type);
+
+ switch(det->align) {
+ case MD_ALIGN_LEFT: RENDER_VERBATIM(r, " align=\"left\">"); break;
+ case MD_ALIGN_CENTER: RENDER_VERBATIM(r, " align=\"center\">"); break;
+ case MD_ALIGN_RIGHT: RENDER_VERBATIM(r, " align=\"right\">"); break;
+ default: RENDER_VERBATIM(r, ">"); break;
+ }
+}
+
+static void
+render_open_a_span(MD_HTML* r, const MD_SPAN_A_DETAIL* det)
+{
+ RENDER_VERBATIM(r, "href, render_url_escaped);
+
+ if(det->title.text != NULL) {
+ RENDER_VERBATIM(r, "\" title=\"");
+ render_attribute(r, &det->title, render_html_escaped);
+ }
+
+ RENDER_VERBATIM(r, "\">");
+}
+
+static void
+render_open_img_span(MD_HTML* r, const MD_SPAN_IMG_DETAIL* det)
+{
+ RENDER_VERBATIM(r, "
src, render_url_escaped);
+
+ RENDER_VERBATIM(r, "\" alt=\"");
+}
+
+static void
+render_close_img_span(MD_HTML* r, const MD_SPAN_IMG_DETAIL* det)
+{
+ if(det->title.text != NULL) {
+ RENDER_VERBATIM(r, "\" title=\"");
+ render_attribute(r, &det->title, render_html_escaped);
+ }
+
+ RENDER_VERBATIM(r, (r->flags & MD_HTML_FLAG_XHTML) ? "\" />" : "\">");
+}
+
+static void
+render_open_wikilink_span(MD_HTML* r, const MD_SPAN_WIKILINK_DETAIL* det)
+{
+ RENDER_VERBATIM(r, "target, render_html_escaped);
+
+ RENDER_VERBATIM(r, "\">");
+}
+
+
+/**************************************
+ *** HTML renderer implementation ***
+ **************************************/
+
+static int
+enter_block_callback(MD_BLOCKTYPE type, void* detail, void* userdata)
+{
+ static const MD_CHAR* head[6] = { "", "", "", "", "", "" };
+ MD_HTML* r = (MD_HTML*) userdata;
+
+ switch(type) {
+ case MD_BLOCK_DOC: /* noop */ break;
+ case MD_BLOCK_QUOTE: RENDER_VERBATIM(r, "\n"); break;
+ case MD_BLOCK_UL: RENDER_VERBATIM(r, "\n"); break;
+ case MD_BLOCK_OL: render_open_ol_block(r, (const MD_BLOCK_OL_DETAIL*)detail); break;
+ case MD_BLOCK_LI: render_open_li_block(r, (const MD_BLOCK_LI_DETAIL*)detail); break;
+ case MD_BLOCK_HR: RENDER_VERBATIM(r, (r->flags & MD_HTML_FLAG_XHTML) ? "
\n" : "
\n"); break;
+ case MD_BLOCK_H: RENDER_VERBATIM(r, head[((MD_BLOCK_H_DETAIL*)detail)->level - 1]); break;
+ case MD_BLOCK_CODE: render_open_code_block(r, (const MD_BLOCK_CODE_DETAIL*) detail); break;
+ case MD_BLOCK_HTML: /* noop */ break;
+ case MD_BLOCK_P: RENDER_VERBATIM(r, ""); break;
+ case MD_BLOCK_TABLE: RENDER_VERBATIM(r, "
\n"); break;
+ case MD_BLOCK_THEAD: RENDER_VERBATIM(r, "\n"); break;
+ case MD_BLOCK_TBODY: RENDER_VERBATIM(r, "\n"); break;
+ case MD_BLOCK_TR: RENDER_VERBATIM(r, "\n"); break;
+ case MD_BLOCK_TH: render_open_td_block(r, "th", (MD_BLOCK_TD_DETAIL*)detail); break;
+ case MD_BLOCK_TD: render_open_td_block(r, "td", (MD_BLOCK_TD_DETAIL*)detail); break;
+ }
+
+ return 0;
+}
+
+static int
+leave_block_callback(MD_BLOCKTYPE type, void* detail, void* userdata)
+{
+ static const MD_CHAR* head[6] = { "\n", "\n", "\n", "\n", "\n", "\n" };
+ MD_HTML* r = (MD_HTML*) userdata;
+
+ switch(type) {
+ case MD_BLOCK_DOC: /*noop*/ break;
+ case MD_BLOCK_QUOTE: RENDER_VERBATIM(r, "\n"); break;
+ case MD_BLOCK_UL: RENDER_VERBATIM(r, "\n"); break;
+ case MD_BLOCK_OL: RENDER_VERBATIM(r, "\n"); break;
+ case MD_BLOCK_LI: RENDER_VERBATIM(r, "\n"); break;
+ case MD_BLOCK_HR: /*noop*/ break;
+ case MD_BLOCK_H: RENDER_VERBATIM(r, head[((MD_BLOCK_H_DETAIL*)detail)->level - 1]); break;
+ case MD_BLOCK_CODE: RENDER_VERBATIM(r, "\n"); break;
+ case MD_BLOCK_HTML: /* noop */ break;
+ case MD_BLOCK_P: RENDER_VERBATIM(r, "\n"); break;
+ case MD_BLOCK_TABLE: RENDER_VERBATIM(r, "
\n"); break;
+ case MD_BLOCK_THEAD: RENDER_VERBATIM(r, "\n"); break;
+ case MD_BLOCK_TBODY: RENDER_VERBATIM(r, "\n"); break;
+ case MD_BLOCK_TR: RENDER_VERBATIM(r, "\n"); break;
+ case MD_BLOCK_TH: RENDER_VERBATIM(r, "\n"); break;
+ case MD_BLOCK_TD: RENDER_VERBATIM(r, "\n"); break;
+ }
+
+ return 0;
+}
+
+static int
+enter_span_callback(MD_SPANTYPE type, void* detail, void* userdata)
+{
+ MD_HTML* r = (MD_HTML*) userdata;
+ int inside_img = (r->image_nesting_level > 0);
+
+ /* We are inside a Markdown image label. Markdown allows to use any emphasis
+ * and other rich contents in that context similarly as in any link label.
+ *
+ * However, unlike in the case of links (where that contents becomescontents
+ * of the ... tag), in the case of images the contents is supposed to
+ * fall into the attribute alt:
.
+ *
+ * In that context we naturally cannot output nested HTML tags. So lets
+ * suppress them and only output the plain text (i.e. what falls into text()
+ * callback).
+ *
+ * CommonMark specification declares this a recommended practice for HTML
+ * output.
+ */
+ if(type == MD_SPAN_IMG)
+ r->image_nesting_level++;
+ if(inside_img)
+ return 0;
+
+ switch(type) {
+ case MD_SPAN_EM: RENDER_VERBATIM(r, ""); break;
+ case MD_SPAN_STRONG: RENDER_VERBATIM(r, ""); break;
+ case MD_SPAN_U: RENDER_VERBATIM(r, ""); break;
+ case MD_SPAN_A: render_open_a_span(r, (MD_SPAN_A_DETAIL*) detail); break;
+ case MD_SPAN_IMG: render_open_img_span(r, (MD_SPAN_IMG_DETAIL*) detail); break;
+ case MD_SPAN_CODE: RENDER_VERBATIM(r, ""); break;
+ case MD_SPAN_DEL: RENDER_VERBATIM(r, ""); break;
+ case MD_SPAN_LATEXMATH: RENDER_VERBATIM(r, ""); break;
+ case MD_SPAN_LATEXMATH_DISPLAY: RENDER_VERBATIM(r, ""); break;
+ case MD_SPAN_WIKILINK: render_open_wikilink_span(r, (MD_SPAN_WIKILINK_DETAIL*) detail); break;
+ }
+
+ return 0;
+}
+
+static int
+leave_span_callback(MD_SPANTYPE type, void* detail, void* userdata)
+{
+ MD_HTML* r = (MD_HTML*) userdata;
+
+ if(type == MD_SPAN_IMG)
+ r->image_nesting_level--;
+ if(r->image_nesting_level > 0)
+ return 0;
+
+ switch(type) {
+ case MD_SPAN_EM: RENDER_VERBATIM(r, " "); break;
+ case MD_SPAN_STRONG: RENDER_VERBATIM(r, ""); break;
+ case MD_SPAN_U: RENDER_VERBATIM(r, ""); break;
+ case MD_SPAN_A: RENDER_VERBATIM(r, "
"); break;
+ case MD_SPAN_IMG: render_close_img_span(r, (MD_SPAN_IMG_DETAIL*) detail); break;
+ case MD_SPAN_CODE: RENDER_VERBATIM(r, ""); break;
+ case MD_SPAN_DEL: RENDER_VERBATIM(r, ""); break;
+ case MD_SPAN_LATEXMATH: /*fall through*/
+ case MD_SPAN_LATEXMATH_DISPLAY: RENDER_VERBATIM(r, "...
. */ + ctx->containers[ctx->n_containers].is_loose = TRUE; + ctx->n_containers++; + } + } + } else { + MD_CHECK(md_process_leaf_block(ctx, block)); + + if(block->type == MD_BLOCK_CODE || block->type == MD_BLOCK_HTML) + byte_off += block->n_lines * sizeof(MD_VERBATIMLINE); + else + byte_off += block->n_lines * sizeof(MD_LINE); + } + + byte_off += sizeof(MD_BLOCK); + } + + ctx->n_block_bytes = 0; + +abort: + return ret; +} + + +/************************************ + *** Grouping Lines into Blocks *** + ************************************/ + +static void* +md_push_block_bytes(MD_CTX* ctx, int n_bytes) +{ + void* ptr; + + if(ctx->n_block_bytes + n_bytes > ctx->alloc_block_bytes) { + void* new_block_bytes; + + ctx->alloc_block_bytes = (ctx->alloc_block_bytes > 0 + ? ctx->alloc_block_bytes + ctx->alloc_block_bytes / 2 + : 512); + new_block_bytes = realloc(ctx->block_bytes, ctx->alloc_block_bytes); + if(new_block_bytes == NULL) { + MD_LOG("realloc() failed."); + return NULL; + } + + /* Fix the ->current_block after the reallocation. */ + if(ctx->current_block != NULL) { + OFF off_current_block = (OFF) ((char*) ctx->current_block - (char*) ctx->block_bytes); + ctx->current_block = (MD_BLOCK*) ((char*) new_block_bytes + off_current_block); + } + + ctx->block_bytes = new_block_bytes; + } + + ptr = (char*)ctx->block_bytes + ctx->n_block_bytes; + ctx->n_block_bytes += n_bytes; + return ptr; +} + +static int +md_start_new_block(MD_CTX* ctx, const MD_LINE_ANALYSIS* line) +{ + MD_BLOCK* block; + + MD_ASSERT(ctx->current_block == NULL); + + block = (MD_BLOCK*) md_push_block_bytes(ctx, sizeof(MD_BLOCK)); + if(block == NULL) + return -1; + + switch(line->type) { + case MD_LINE_HR: + block->type = MD_BLOCK_HR; + break; + + case MD_LINE_ATXHEADER: + case MD_LINE_SETEXTHEADER: + block->type = MD_BLOCK_H; + break; + + case MD_LINE_FENCEDCODE: + case MD_LINE_INDENTEDCODE: + block->type = MD_BLOCK_CODE; + break; + + case MD_LINE_TEXT: + block->type = MD_BLOCK_P; + break; + + case MD_LINE_HTML: + block->type = MD_BLOCK_HTML; + break; + + case MD_LINE_BLANK: + case MD_LINE_SETEXTUNDERLINE: + case MD_LINE_TABLEUNDERLINE: + default: + MD_UNREACHABLE(); + break; + } + + block->flags = 0; + block->data = line->data; + block->n_lines = 0; + + ctx->current_block = block; + return 0; +} + +/* Eat from start of current (textual) block any reference definitions and + * remember them so we can resolve any links referring to them. + * + * (Reference definitions can only be at start of it as they cannot break + * a paragraph.) + */ +static int +md_consume_link_reference_definitions(MD_CTX* ctx) +{ + MD_LINE* lines = (MD_LINE*) (ctx->current_block + 1); + MD_SIZE n_lines = ctx->current_block->n_lines; + MD_SIZE n = 0; + + /* Compute how many lines at the start of the block form one or more + * reference definitions. */ + while(n < n_lines) { + int n_link_ref_lines; + + n_link_ref_lines = md_is_link_reference_definition(ctx, + lines + n, n_lines - n); + /* Not a reference definition? */ + if(n_link_ref_lines == 0) + break; + + /* We fail if it is the ref. def. but it could not be stored due + * a memory allocation error. */ + if(n_link_ref_lines < 0) + return -1; + + n += n_link_ref_lines; + } + + /* If there was at least one reference definition, we need to remove + * its lines from the block, or perhaps even the whole block. */ + if(n > 0) { + if(n == n_lines) { + /* Remove complete block. */ + ctx->n_block_bytes -= n * sizeof(MD_LINE); + ctx->n_block_bytes -= sizeof(MD_BLOCK); + ctx->current_block = NULL; + } else { + /* Remove just some initial lines from the block. */ + memmove(lines, lines + n, (n_lines - n) * sizeof(MD_LINE)); + ctx->current_block->n_lines -= n; + ctx->n_block_bytes -= n * sizeof(MD_LINE); + } + } + + return 0; +} + +static int +md_end_current_block(MD_CTX* ctx) +{ + int ret = 0; + + if(ctx->current_block == NULL) + return ret; + + /* Check whether there is a reference definition. (We do this here instead + * of in md_analyze_line() because reference definition can take multiple + * lines.) */ + if(ctx->current_block->type == MD_BLOCK_P || + (ctx->current_block->type == MD_BLOCK_H && (ctx->current_block->flags & MD_BLOCK_SETEXT_HEADER))) + { + MD_LINE* lines = (MD_LINE*) (ctx->current_block + 1); + if(lines[0].beg < ctx->size && CH(lines[0].beg) == _T('[')) { + MD_CHECK(md_consume_link_reference_definitions(ctx)); + if(ctx->current_block == NULL) + return ret; + } + } + + if(ctx->current_block->type == MD_BLOCK_H && (ctx->current_block->flags & MD_BLOCK_SETEXT_HEADER)) { + MD_SIZE n_lines = ctx->current_block->n_lines; + + if(n_lines > 1) { + /* Get rid of the underline. */ + ctx->current_block->n_lines--; + ctx->n_block_bytes -= sizeof(MD_LINE); + } else { + /* Only the underline has left after eating the ref. defs. + * Keep the line as beginning of a new ordinary paragraph. */ + ctx->current_block->type = MD_BLOCK_P; + return 0; + } + } + + /* Mark we are not building any block anymore. */ + ctx->current_block = NULL; + +abort: + return ret; +} + +static int +md_add_line_into_current_block(MD_CTX* ctx, const MD_LINE_ANALYSIS* analysis) +{ + MD_ASSERT(ctx->current_block != NULL); + + if(ctx->current_block->type == MD_BLOCK_CODE || ctx->current_block->type == MD_BLOCK_HTML) { + MD_VERBATIMLINE* line; + + line = (MD_VERBATIMLINE*) md_push_block_bytes(ctx, sizeof(MD_VERBATIMLINE)); + if(line == NULL) + return -1; + + line->indent = analysis->indent; + line->beg = analysis->beg; + line->end = analysis->end; + } else { + MD_LINE* line; + + line = (MD_LINE*) md_push_block_bytes(ctx, sizeof(MD_LINE)); + if(line == NULL) + return -1; + + line->beg = analysis->beg; + line->end = analysis->end; + } + ctx->current_block->n_lines++; + + return 0; +} + +static int +md_push_container_bytes(MD_CTX* ctx, MD_BLOCKTYPE type, unsigned start, + unsigned data, unsigned flags) +{ + MD_BLOCK* block; + int ret = 0; + + MD_CHECK(md_end_current_block(ctx)); + + block = (MD_BLOCK*) md_push_block_bytes(ctx, sizeof(MD_BLOCK)); + if(block == NULL) + return -1; + + block->type = type; + block->flags = flags; + block->data = data; + block->n_lines = start; + +abort: + return ret; +} + + + +/*********************** + *** Line Analysis *** + ***********************/ + +static int +md_is_hr_line(MD_CTX* ctx, OFF beg, OFF* p_end, OFF* p_killer) +{ + OFF off = beg + 1; + int n = 1; + + while(off < ctx->size && (CH(off) == CH(beg) || CH(off) == _T(' ') || CH(off) == _T('\t'))) { + if(CH(off) == CH(beg)) + n++; + off++; + } + + if(n < 3) { + *p_killer = off; + return FALSE; + } + + /* Nothing else can be present on the line. */ + if(off < ctx->size && !ISNEWLINE(off)) { + *p_killer = off; + return FALSE; + } + + *p_end = off; + return TRUE; +} + +static int +md_is_atxheader_line(MD_CTX* ctx, OFF beg, OFF* p_beg, OFF* p_end, unsigned* p_level) +{ + int n; + OFF off = beg + 1; + + while(off < ctx->size && CH(off) == _T('#') && off - beg < 7) + off++; + n = off - beg; + + if(n > 6) + return FALSE; + *p_level = n; + + if(!(ctx->parser.flags & MD_FLAG_PERMISSIVEATXHEADERS) && off < ctx->size && + !ISBLANK(off) && !ISNEWLINE(off)) + return FALSE; + + while(off < ctx->size && ISBLANK(off)) + off++; + *p_beg = off; + *p_end = off; + return TRUE; +} + +static int +md_is_setext_underline(MD_CTX* ctx, OFF beg, OFF* p_end, unsigned* p_level) +{ + OFF off = beg + 1; + + while(off < ctx->size && CH(off) == CH(beg)) + off++; + + /* Optionally, space(s) or tabs can follow. */ + while(off < ctx->size && ISBLANK(off)) + off++; + + /* But nothing more is allowed on the line. */ + if(off < ctx->size && !ISNEWLINE(off)) + return FALSE; + + *p_level = (CH(beg) == _T('=') ? 1 : 2); + *p_end = off; + return TRUE; +} + +static int +md_is_table_underline(MD_CTX* ctx, OFF beg, OFF* p_end, unsigned* p_col_count) +{ + OFF off = beg; + int found_pipe = FALSE; + unsigned col_count = 0; + + if(off < ctx->size && CH(off) == _T('|')) { + found_pipe = TRUE; + off++; + while(off < ctx->size && ISWHITESPACE(off)) + off++; + } + + while(1) { + int delimited = FALSE; + + /* Cell underline ("-----", ":----", "----:" or ":----:") */ + if(off < ctx->size && CH(off) == _T(':')) + off++; + if(off >= ctx->size || CH(off) != _T('-')) + return FALSE; + while(off < ctx->size && CH(off) == _T('-')) + off++; + if(off < ctx->size && CH(off) == _T(':')) + off++; + + col_count++; + if(col_count > TABLE_MAXCOLCOUNT) { + MD_LOG("Suppressing table (column_count >" STRINGIZE(TABLE_MAXCOLCOUNT) ")"); + return FALSE; + } + + /* Pipe delimiter (optional at the end of line). */ + while(off < ctx->size && ISWHITESPACE(off)) + off++; + if(off < ctx->size && CH(off) == _T('|')) { + delimited = TRUE; + found_pipe = TRUE; + off++; + while(off < ctx->size && ISWHITESPACE(off)) + off++; + } + + /* Success, if we reach end of line. */ + if(off >= ctx->size || ISNEWLINE(off)) + break; + + if(!delimited) + return FALSE; + } + + if(!found_pipe) + return FALSE; + + *p_end = off; + *p_col_count = col_count; + return TRUE; +} + +static int +md_is_opening_code_fence(MD_CTX* ctx, OFF beg, OFF* p_end) +{ + OFF off = beg; + + while(off < ctx->size && CH(off) == CH(beg)) + off++; + + /* Fence must have at least three characters. */ + if(off - beg < 3) + return FALSE; + + ctx->code_fence_length = off - beg; + + /* Optionally, space(s) can follow. */ + while(off < ctx->size && CH(off) == _T(' ')) + off++; + + /* Optionally, an info string can follow. */ + while(off < ctx->size && !ISNEWLINE(off)) { + /* Backtick-based fence must not contain '`' in the info string. */ + if(CH(beg) == _T('`') && CH(off) == _T('`')) + return FALSE; + off++; + } + + *p_end = off; + return TRUE; +} + +static int +md_is_closing_code_fence(MD_CTX* ctx, CHAR ch, OFF beg, OFF* p_end) +{ + OFF off = beg; + int ret = FALSE; + + /* Closing fence must have at least the same length and use same char as + * opening one. */ + while(off < ctx->size && CH(off) == ch) + off++; + if(off - beg < ctx->code_fence_length) + goto out; + + /* Optionally, space(s) can follow */ + while(off < ctx->size && CH(off) == _T(' ')) + off++; + + /* But nothing more is allowed on the line. */ + if(off < ctx->size && !ISNEWLINE(off)) + goto out; + + ret = TRUE; + +out: + /* Note we set *p_end even on failure: If we are not closing fence, caller + * would eat the line anyway without any parsing. */ + *p_end = off; + return ret; +} + + +/* Helper data for md_is_html_block_start_condition() and + * md_is_html_block_end_condition() */ +typedef struct TAG_tag TAG; +struct TAG_tag { + const CHAR* name; + unsigned len : 8; +}; + +#ifdef X + #undef X +#endif +#define X(name) { _T(name), (sizeof(name)-1) / sizeof(CHAR) } +#define Xend { NULL, 0 } + +static const TAG t1[] = { X("pre"), X("script"), X("style"), X("textarea"), Xend }; + +static const TAG a6[] = { X("address"), X("article"), X("aside"), Xend }; +static const TAG b6[] = { X("base"), X("basefont"), X("blockquote"), X("body"), Xend }; +static const TAG c6[] = { X("caption"), X("center"), X("col"), X("colgroup"), Xend }; +static const TAG d6[] = { X("dd"), X("details"), X("dialog"), X("dir"), + X("div"), X("dl"), X("dt"), Xend }; +static const TAG f6[] = { X("fieldset"), X("figcaption"), X("figure"), X("footer"), + X("form"), X("frame"), X("frameset"), Xend }; +static const TAG h6[] = { X("h1"), X("h2"), X("h3"), X("h4"), X("h5"), X("h6"), + X("head"), X("header"), X("hr"), X("html"), Xend }; +static const TAG i6[] = { X("iframe"), Xend }; +static const TAG l6[] = { X("legend"), X("li"), X("link"), Xend }; +static const TAG m6[] = { X("main"), X("menu"), X("menuitem"), Xend }; +static const TAG n6[] = { X("nav"), X("noframes"), Xend }; +static const TAG o6[] = { X("ol"), X("optgroup"), X("option"), Xend }; +static const TAG p6[] = { X("p"), X("param"), Xend }; +static const TAG s6[] = { X("search"), X("section"), X("summary"), Xend }; +static const TAG t6[] = { X("table"), X("tbody"), X("td"), X("tfoot"), X("th"), + X("thead"), X("title"), X("tr"), X("track"), Xend }; +static const TAG u6[] = { X("ul"), Xend }; +static const TAG xx[] = { Xend }; + +#undef X +#undef Xend + +/* Returns type of the raw HTML block, or FALSE if it is not HTML block. + * (Refer to CommonMark specification for details about the types.) + */ +static int +md_is_html_block_start_condition(MD_CTX* ctx, OFF beg) +{ + /* Type 6 is started by a long list of allowed tags. We use two-level + * tree to speed-up the search. */ + static const TAG* map6[26] = { + a6, b6, c6, d6, xx, f6, xx, h6, i6, xx, xx, l6, m6, + n6, o6, p6, xx, xx, s6, t6, u6, xx, xx, xx, xx, xx + }; + OFF off = beg + 1; + int i; + + /* Check for type 1: diff --git a/resources/web/guide/23/23.css b/resources/web/guide/23/23.css index 57a376e458..596ffe10dc 100644 --- a/resources/web/guide/23/23.css +++ b/resources/web/guide/23/23.css @@ -15,50 +15,29 @@ flex-shrink: 0; } -.CValues -{ - display:flex; - justify-content: flex-start; - align-content: flex-start; - flex-wrap: wrap; -} - -input -{ - margin-left: 20px; - margin-right: 6px; - vertical-align: middle; -} - -#ItemSelectArea -{ - flex: 0 0 40px; - height:40px; - border-top: 1px solid #009688; - display: flex; - align-items: center; -} - #ItemBlockArea { display:flex; - overflow-x:auto; + overflow-y:scroll; flex-wrap:wrap; - flex-direction: column; - justify-content:flex-start; - align-items: flex-start; - align-content:flex-start; - line-height: 32px; - height: 100%; - flex:1 0 236px; + flex-direction: row; + padding: 0 0 0 8px; } .MItem { - min-width: 180px; /* ORCA Filtered items > slightly reduce min width to fit more items*/ - height: 32px; + width:33%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + margin-right: 4px !important; + top: -100px; /* ORCA this will be activated when item filtered with position:absolute */ } +.MItem label +{ + margin-right: 0px !important; +} #NoticeMask { @@ -88,7 +67,7 @@ input #NoticeBar { - background-color:#00f0d8; + background-color: var(--main-color); height: 40px; line-height: 40px; color: #fff; @@ -112,6 +91,7 @@ input { display: none; flex-direction: column; + height: 100%; } #CFilament_Btn_Area @@ -124,7 +104,7 @@ input #Title { margin: 0px 40px; - border-bottom: 1px solid #000; + border-bottom: 1px solid var(--border-color); display: flex; flex-direction: row; justify-content: center; @@ -142,7 +122,7 @@ input height: calc(100% - 6px); display: flex; align-items: center; - border-bottom: 6px solid #009688; + border-bottom: 6px solid var(--main-color); } #Title div.TitleUnselected @@ -163,14 +143,12 @@ input #CFilament_List { display:flex; - overflow-x:auto; + overflow-y:auto; flex-wrap:wrap; - flex-direction: column; justify-content:flex-start; align-items: flex-start; align-content:flex-start; line-height: 32px; - height: 100%; } @@ -178,12 +156,17 @@ input { display: flex; align-items: center; - margin-right: 30px; + margin-right: 10%; + width: 44%; +} + +.CFilament_Item:nth-of-type(2n) { + margin-right: 2%; } .CFilament_Name { - width: 220px; + width: 100%; overflow: hidden; white-space: nowrap; /* ?????? */ text-overflow: ellipsis; /* ????????? */ @@ -200,3 +183,181 @@ input { } + +/* ORCA column browser */ + +#Content { + height: 100%; +} + +body:has(#SystemFilamentBtn.TitleSelected) #Content { /* :has selector browser support 2023+ */ + padding: 15px 15px 5px; +} + +.cbr-browser-container { + display: grid; + grid-template-columns: repeat(3, 1fr); + grid-template-rows: 210px auto; + width: 100%; + height: 100%; + border: 1px solid var(--border-color); + box-sizing: border-box; +} + +.cbr-column:last-child { + grid-column: 1 / -1; + border-top: 1px solid var(--border-color); +} + +.cbr-column { + display: flex; + flex-direction: column; + overflow: hidden; +} + +.cbr-column:nth-child(-n+2) { + border-right: 1px solid var(--border-color); +} + +.cbr-column .CValues { + display: grid; +} + +.CValues label { + margin-right: 0 !important; +} + +.cbr-column-title-container { + position: sticky; + background: var(--bg-color-secondary); + display: flex; + align-items: center; + border-bottom: 1px solid var(--border-color); +} + +.cbr-search-bar, +.cbr-filter-bar { + font-size: 16px; + background: var(--bg-color-secondary); + border: 1px solid transparent; + padding: 2px 27px 2px 27px; + line-height: 24px; +} + +.cbr-search-bar { + width: calc(100% - 18px); +} + +.cbr-filter-bar { + border-color: var(--border-color); + width: 160px; + height:24px; +} + +.cbr-column-title-container .ComboBox > select { + margin: 3px 0; + height: 30px; +} + +.cbr-column-title-container input:is(:hover,:focus) { + border-color: var(--main-color); + outline: none; +} + +.cbr-column-title-container input:is(:focus) { + background: var(--focus-bg-box); +} + +.cbr-filter-box { + position: relative; + margin: 3px; +} + +.list-item-count { + color:var(--fg-color-label); + margin-left:10px +} + +.cbr-filter-btns { + display: flex; + margin: 5px 5px 5px auto; +} + +.cbr-filter-btns div:first-of-type { + margin-left: 10px; +} + +.cbr-filter-mode-filter { + display: none; +} + +.clear-icon, +.search-icon, +.filter-icon { + position: absolute; + top: 50%; + transform: translateY(-50%); + -webkit-mask-image: var(--url); + mask-image: var(--url); + width: 16px; + height: 16px; + background-color: var(--icon-color); + pointer-events:none; +} + +.filter-icon {--url: var(--icon-filter)} +.search-icon {--url: var(--icon-search)} +.clear-icon {--url: var(--icon-input-clear)} + +.search-icon, +.filter-icon { + left: 6px; +} + +.clear-icon { + right: 6px; + display: none; +} + +.cbr-search-bar:not(:placeholder-shown) ~ .clear-icon, +.cbr-filter-bar:not(:placeholder-shown) ~ .clear-icon { + display: block; +} + +input[onclear="1"]{ + cursor:default +} + +.cbr-search-placeholder, +.cbr-filter-placeholder { + position: absolute; + top: 50%; + transform: translateY(-50%); + font-size: 16px; + color: var(--fg-color-label); + pointer-events: none; + line-height: 24px; + left: 27px; +} + +.cbr-search-bar:not(:placeholder-shown) + .cbr-search-placeholder, +.cbr-filter-bar:not(:placeholder-shown) + .cbr-filter-placeholder { + opacity: 0; +} + +.cbr-content { + overflow-y: auto; +} + +.cbr-content div { + padding-left: 8px; +} + +.cbr-content label { + margin-right: 0 !important; + padding: 1px 0 !important; +} + +.cbr-content div.cbr-no-items { + display: none; +} \ No newline at end of file diff --git a/resources/web/guide/23/23.js b/resources/web/guide/23/23.js index a0071f503e..8649f7cd41 100644 --- a/resources/web/guide/23/23.js +++ b/resources/web/guide/23/23.js @@ -74,10 +74,10 @@ function SortUI() $('#MachineList .CValues').append(HtmlMode); $('#MachineList .CValues input').prop("checked",true); - if(nMode<=1) - { - $('#MachineList').hide(); - } + //if(nMode<=1) + //{ + // $('#MachineList').hide(); + //} //Filament - Create sorted array with generic vendor first let FilamentArray=new Array(); @@ -171,7 +171,7 @@ function SortUI() if(pFila.length==0) { /* ORCA use label tag to allow checkbox to toggle when user ckicked to text */ - let HtmlFila=''; + let HtmlFila=''; $("#ItemBlockArea").append(HtmlFila); } @@ -238,6 +238,8 @@ function SortUI() //------ if(SelectNumber==0) ChooseDefaultFilament(); + + UpdateStats(); } @@ -403,9 +405,29 @@ function SortFilament() else $(OneNode).hide(); } - else + else{ $(OneNode).hide(); + //alert(fName) //debug non common filament type + } + } + + UpdateStats(); +} + +function UpdateStats() +{ + let $i = $("#ItemBlockArea"); + let $allItems = $i.find(".MItem"); + let $visibleItems = $i.find(".MItem:visible"); + let $filteredItems = $visibleItems.filter(function() { return $(this).css('position') !== 'absolute'}); + let visibleCount = Math.min($filteredItems.length, $visibleItems.length); + + $(".list-item-count").text( + $i.find("input:checked").length + " / " + + $allItems.length + + ($allItems.length > visibleCount ? (" [" + visibleCount + "]") : "") // filtered items + ); } function ChooseDefaultFilament() @@ -452,14 +474,17 @@ function ChooseDefaultFilament() function SelectAllFilament( nShow ) { - if( nShow==0 ) - { - $('#ItemBlockArea .MItem:visible input').prop("checked",false); + // ORCA add ability to only select / unselect filted items + if (document.querySelector('.cbr-filter-bar').value) { + $('#ItemBlockArea .MItem:visible input') + .filter(function() {return $(this).closest('.MItem').css('position') !== 'absolute'}) + .prop("checked", nShow != 0); } - else - { - $('#ItemBlockArea .MItem:visible input').prop("checked",true); + else { + $('#ItemBlockArea .MItem:visible input').prop("checked",nShow!=0); } + + UpdateStats(); } function ShowNotice( nShow ) diff --git a/resources/web/guide/23/index.html b/resources/web/guide/23/index.html index 34d69fd8c2..3ef35acd95 100644 --- a/resources/web/guide/23/index.html +++ b/resources/web/guide/23/index.html @@ -23,42 +23,92 @@