news::markdown_image::drafts (private)
news::markdown_image::drafts content format
Defined in packages/news/tcl/markdown-image-procs.tcl
Collect this editor's staged images referenced by the article HTML.
- Parameters:
- content (required)
- format (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set prefix [ad_conn package_url]markdown-image?image_id= if {$format ne "text/html" || [string first $prefix $content] == -1} { return {} } set drafts {} foreach tag [ns_parsehtml -onlytags -- $content] { lassign $tag element attributes if {![string equal -nocase $element img] || ![dict exists $attributes src]} continue set src [dict get $attributes src] if {[string first $prefix $src] != 0} continue # Responsive delivery adds query parameters after the stable image identity. set image_id [lindex [split [string range $src [string length $prefix] end] &] 0] if {![regexp {^[1-9][0-9]*$} $image_id] || [dict exists $drafts $image_id]} continue if {[acs_object_type $image_id] ne ""} continue set path [draft_path $image_id] set mime [mime_type $path] if {$mime eq "" || [ad_conn user_id] == 0 || ![enabled_p]} { return -code error -errorcode {NEWS IMAGE UNAVAILABLE} "A pasted image is unavailable. Remove it or paste it again." } dict set drafts $image_id [list $path $mime] } return $draftsXQL Not present: Generic, PostgreSQL, Oracle