Confluence create page with custom image - confluence

I want to create a page in confluence with custom information.
API - (POST) confluence/rest/api/content
I am able to upload text and image successfully. If I use src for image that is uploaded somewhere,
e.g. www.example.com/myimage.png
then this image is successfully visible on my newly created page on confluence.
But, if I use src as data uri,
e.g. data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
then it does not display the image.
Please note that API does not throw any error but does not display the image as well.
Working:
{
"type":"page",
"title":"Document",
"space":{"key":"DEMO"},
"body":{
"storage":{
"value":"<img src='http://www.gravatar.com/avatar/64e1b8d34f425d19e1ee2ea7236d3028'/>",
"representation":"storage"
}
}
}
Not working:
{
"type":"page",
"title":"Document",
"space":{"key":"DEMO"},
"body":{
"storage":{
"value":"<p>Hello</p><img height='284' width='750' src='data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'/><p>Hi</p>",
"representation":"storage"
}
}
}
Any help would be appreciated.
Thanks

You can get around this if you use an HTML Macro. See the "Storage format example" on this page: HTML Macro.
You would just surround your html like this:
< ac:structured-macro ac:name = "html" >
< ac:plain-text-body >
<![CDATA[<div>HTML HERE</div>]]>
</ ac:plain-text-body >
</ ac:structured-macro >
But you have to have the HTML Macro enabled.

Related

Replace HTML in response using Fiddler

I want to do something as simple as changing a color code in the response of an HTTP request, but I can't seem to figure it out. Basically, when a certain website loads, The background is set with the color code "#db4437" and I'd like to have it always be changed to "#09C3FF" when the website loads.
I found this code for Fiddlerscript in the Fiddler guides, but it doesn't seem to really do anything at all
if (oSession.HostnameIs("www.bayden.com") &&
oSession.oResponse.headers.ExistsAndContains("Content-Type","text/html")){
oSession.utilDecodeResponse();
oSession.utilReplaceInResponse('<b>','<u>');
}
This example from Telerik documentation works for me:
Remove all DIV tags (and content inside the DIV tag)
// If content-type is HTML, then remove all DIV tags
if (oSession.oResponse.headers.ExistsAndContains("Content-Type", "html")){
// Remove any compression or chunking
oSession.utilDecodeResponse();
var oBody = System.Text.Encoding.UTF8.GetString(oSession.responseBodyBytes);
// Replace all instances of the DIV tag with an empty string
var oRegEx = /<div[^>]*>(.*?)<\/div>/gi;
oBody = oBody.replace(oRegEx, "");
// Set the response body to the div-less string
oSession.utilSetResponseBody(oBody);
}

Create a new link stye in Typo3?

Is there a way to add a new style to the Insert Link dialog in Typo3?
Currently they are "internal-link", "internal-link-new-window", or no style.
I have tried putting various things in the Page tsconfig with no results at all...
I found this on another site which looks like it does what I want but I can't get it to do anything:
RTE.classesAnchor {
tollerLink1 {
class = button
type = page
titleText = Button
}
}
RTE.default {
classesAnchor:=addToList(button)
}
In your TsConfig (Home Page Properties - Resources - Page TSConfig)
RTE.default.buttons {
link.properties.class.allowedClasses := addToList(internal-link-new-window)
}

Change button image in web.py

I have the following code in my python script. How do I change the image of my button instead of the default ugly looking button?
import web
from web import form
render = web.template.render('templates/')
urls = ('/','index')
register_form = form.Form(
form.Textbox("name",size=40, description="Please enter name: "),
form.Button("Query", type="submit", description="Query")
)
I was hoping to have an effect similar to this:
< button>< img src="index.png">< /img>< /button>
The html option allows you to enter any html tags. :)
form.Button("Query", type="submit", description="Query" html="<img src="hello.png"/)

Pagebreak in UIWebview in iphone sdk

I am creating Rich Text editor using UIWebView in iOs sdk.I am using java script & HTML code to implement all functionality & using webview as editable content. Now my problem is that I want to insert page break in UIWebView using java-script/Html but page break option is not working in UIWebView.How I can insert page break option in UIWebview?
I have done this after too much search with JS
function makePageBreak(){
insertHtmlAtCursor('<div id="MyInsertPageBreak" class="pagebreak" ></div>');
}
function insertHtmlAtCursor(html) {
var range, node;
if (window.getSelection && window.getSelection().getRangeAt) {
range = window.getSelection().getRangeAt(0);
node = range.createContextualFragment(html);
range.insertNode(node);
} else if (document.selection && document.selection.createRange) {
document.selection.createRange().pasteHTML(html);
}
}
This worked for me. Hope will help you.

Select a single 'featured' post in Tumblr?

I would like my Tumblr homepage to show a single Question/Answer post that is selected by a 'featured' tag, or rather by being the most recent Question/Answer post tagged 'featured'. I don't see any built in Tumblr tags that will do this.
I am using jQuery to get the featured post (n number of them) from a category 'featured' by default. I have implemented this solution to my theme - Purely
Here is a screen-shot (displaying three featured posts)
Add this line 's meta section
<meta name='text:Featured Tag' content='featured' />
Add jQuery library in
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
Add these lines in where you want to display the featured post
{block:IndexPage}
{block:IfFeaturedTag}
<h1 class="featured-subhead">
Featured Posts +
</h1>
{/block:IfFeaturedTag}
{/block:IndexPage}
Add these lines just before the closing tag
{block:IndexPage}{block:IfFeaturedTag}
<script>
var rssurl = '/tagged/{text:Featured Tag}/rss';
$.get(rssurl, function(data) {
$('.featured-subhead').append('<div class="featured-posts">');
var $xml = $(data);
var vari = 0;
$xml.find("item").each(function() {
var $this = $(this),
item = {
title: $this.find("title").text(),
link: $this.find("link").text(),
description: $this.find("description").text(),
pubDate: $this.find("pubDate").text(),
author: $this.find("author").text()
}
vari = vari +1;
if(vari <4){
$('.featured-subhead').append('<div class="featured-post" style="overflow:hidden;"><h2 class="featured-title">' + item.title + '</h2><div class="featured-post-description' + vari + '">' + item.description + '</div><div class="featured-post-link">Read More</div></div>');
//Do something with item here...
}
});
$('.featured-subhead').append('</div>');
});
{/block:IndexPage}{/block:IfFeaturedTag}
You can change if(vari <4){ line according to the numbers of posts you want to display as featured. For example, to display a single post, it would be if(vari <2){ .
I have also added few CSS classes to design the output. This can be declared in segment in
h1.featured-subhead
{
/* Heading of featured post */
}
.featured-posts
{
/* Outer box of all featured posts */
}
.featured-post
{
/* Inner box of each featured post */
}
h2.featured-title
{
/* Heading of each featured post */
}
.featured-post-description
{
/* Description or body of each featured post */
}
.featured-post-link
{
/* Link to Permalink page of each featured post */
}
Here only featured-subhead class is necessary. This must be added to the heading of featured post. jQuery will add the featured posts after that.
How does it work?
No surprises here. Tumblr generates a tag RSS page for each page. By using javascript, I am fetching that specific tag page and displaying 'n' number of elements from the XML elements. Sometimes, Tumblr takes a little more time (I don't know why) to generate the RSS page of newly added tags. Be patient and try to browse your-blog.tumblr.com/tagged/featured/rss page to check it is generated or not.
What you're asking is not a native setting to tumblr, in other words there's no preference setting you can simply check.
In order to do what you describes above, you will either need to edit your current theme code, or code a new theme from scratch.
In order to only show 1 question post, at the top, with a tag of featured, you will need to work with the jQuery/Javascript and the Tumblr API.
It's pretty complex coding, but if you're up for it, head on over to the Tumblr API Codex.
This is a little late, but in case it's of any help: Our free Single A theme has the sticky post feature built in. It's the first (and only) tumblr theme to have it. You can get it here: http://www.tumblr.com/theme/28638 or learn more about it here: http://singleatheme.tumblr.com/. Hope this helps!