v1.0.43: превью текста + первые строки таблиц в модалке
This commit is contained in:
+15
-2
@@ -309,16 +309,29 @@
|
||||
<cfset paraCount = 0>
|
||||
<cfset tblCount = 0>
|
||||
<cfset tblRows = 0>
|
||||
<cfset textPreview = "">
|
||||
<cfset tblHeaders = []>
|
||||
<cfloop array="#elements#" index="el">
|
||||
<cfif el.type EQ "paragraph"><cfset paraCount++>
|
||||
<cfelseif el.type EQ "table"><cfset tblCount++><cfset tblRows += arrayLen(el.rows)>
|
||||
<cfif el.type EQ "paragraph">
|
||||
<cfset paraCount++>
|
||||
<cfif len(textPreview) LT 200>
|
||||
<cfset textPreview &= el.text & chr(10)>
|
||||
</cfif>
|
||||
<cfelseif el.type EQ "table">
|
||||
<cfset tblCount++>
|
||||
<cfset tblRows += arrayLen(el.rows)>
|
||||
<cfif arrayLen(el.rows) GT 0>
|
||||
<cfset arrayAppend(tblHeaders, el.rows[1])>
|
||||
</cfif>
|
||||
</cfif>
|
||||
</cfloop>
|
||||
<cfset textPreview = left(textPreview, 200)>
|
||||
|
||||
<cfset result = {ok: true, doc_id: url.doc_id, filename: doc.filename,
|
||||
mime_type: doc.mime_type, status: newStatus,
|
||||
element_count: arrayLen(elements), error_count: arrayLen(errors),
|
||||
paragraphs: paraCount, tables: tblCount, table_rows: tblRows,
|
||||
text_preview: textPreview, table_headers: tblHeaders,
|
||||
errors: errors, files: files}>
|
||||
</cfif>
|
||||
</cfif>
|
||||
|
||||
Reference in New Issue
Block a user