can I add an ad with markdown in django? - django

I am using django-markdown-deux and I would like to add ads by doing something like [ad_x] and then finding it via regexso I don't have to add a bunch of html to all my pages manually.
In markdown deux, they have a link_patterns setting which does the same thing, but it is pre-made to only turn the matched expression into a link and not whatever I want to put in it.
Is there an easy way to do this?

Related

Sitecore 9 - Add an Image to a Link in the Footer

A client is using Sitecore 9 - we are not Sitecore developers.
We've been asked a simple thing: add social media links to the Footer of their Sitecore site.
Its proving more difficult than expected.
I've added the links on other pages by editing the HTML directly via the WYSWIG editor.
But the Footer appears more restricted, only accepting the addition of templates like 'Link'.
The 'Link' template has an option to add an external URL but doesn't have an option to add an image.
The CMS looks like this:
Is there any way to add a link, with an image, via the CMS (without the need to write Sitecore code), so the page chnages from this:
to this:
If you dont want to write Sitecore code, maybe you should think about using frontend.
Find the views that holds the footer (probably Foundation/Footer.cshtml) or something like that.
-To easily find where it is, follow these steps
Go to a content page Presentation Details that has footer (probably any)
Go to Controls
Find the footer rendering in there
Click on it
Grab the Datasource's value
Go to the Datasource's path
There should be a field holding the value of the view.
Add some css class on the div that holds those items, and do your frontend stuff in there...
It is not a scalable solution, so I would highly recommend updating the Footer rendering by adding new fields and adapting the model/view. So that way a content editor could easily add a new value for each socials.

How to implement sitecore site search

I need to implement content site search based on sitecore API.
I know how to set up crawler for Lucene.Net, but this would be some kind of search by predefined template, I need to implement search by result content (final html), it should works like close to google search. Is is possible to do in sitecore ?
Thanks.
If you want the search to be based on the rendered HTML (are you really sure about that), some custom magic is required.
Crawling the content is needed in such case, thus if the publised item is visitable (has an URL), you can use the HTMLAgility framework to get the HTML, strip the tags and add the content to the index in any (new) field you like...

C++ HTML viewer for scanning?

I just need some help in pointing me in the right direction. I have no issue with research but I don't know where to start!!! I want to make a program that uses a websites search function, but doesn't display the page. It will save the page and scan the HTML for a specific string and display it.
Would it work better to display the page in the background and search it, this way I don't have to save anything??
Where do I start??
A web page is mostly simple text. You can download a page with cURL and search it pretty much like you would any other text. If you don't want to search the contents of the tags, you'd want to search after parsing.

Organizing django-tagging tags or assigning properties to tags?

I'd like to categorize my tags. Here's an example of the tags I have now:
css, internet-explorer, firefox, floats
Each of those are separate tags ( 4 in total obviously ). I would like to mark the internet-explorer and firefox tags as browsers. Does django-tagging offer some sort of way for doing this or do I have to manually edit the schema?
I really don't care if I have to either tag tags or add a new column to the tags table, whichever is the easiest way in accordance with the plugin.
Interesting, I came across this problem as well and solved it like this.
I don't want to mess with the django-tagging code because it will be a pain if I wish to upgrade afterwards, so I made a new module called taggingtools. Taggingtools is for grouping tags and autocompletion in the admin interface. For the grouping I made a new model named TagGroup, this model just has a name. (for Example browsers). I also added some functions to return the tags for that group. I then added the tags for Browsers to the Browsers TagGroup. This way I can say I want all the browser tags for a certain database object. It's easy to make this, but if you can wait I can check if I can opensource it so you and others don't have to build it yourself.

Importing HTML into TinyMCE using ColdFusion

Hey everyone, I would appreciate a pointing in the right direction with the problem I'm having. In short, I'm working on an application that will create PDFs using TinyMCE and ColdFusion 8. I have the ability to create a PDF by just entering in text, pictures, etc. However, I want to be able to import an html template and insert it into the TinyMCE .
Basically, I have a file directory code snippet that lets me browse through my 'HTMLTemplates' folder, and am able to select an HTML document. Now, I want to be able to take all the code from that selected HTML document and insert it into my TinyMCE box. Any tips on how I might do this, maybe?
Thanks!
If I understood you correctly, you already have a TinyMCE plugin which pops up a window and allows you to browse the certain directory using existing cfm page which you render within the popup window. Right?
If not, you should start with this. Not sure how easy it is done in current version, but in the older TinyMCE I've created the custom upload plugin (needed to track the site security permissions for current user) pretty quickly.
Next, I can see two quick ways to pass the server file contents to the client-side:
Make it available via HTTP so you can make the GET request and read contents into the variable.
Output it on the page using CF (say, on form submit when file selected) and grab using JavaScript.
I'd personally tried the second option. After you grab the text into the variable you can put it into the TinyMCE using it's API.
It can be as simple as output escaped text into the hidden div with known ID and read it using DOM operations (assuming that there is cfoutput around):
<div id="myTemplate">#HTMLEditFormat(myFileContents)#</div>
Also you can output the text directly into the JavaScript variable (of cource, with accurate escaping), maybe like this.
<script type="text/javascript">
var text = '#HTMLEditFormat(myFileContents)#';
</script>
Most advanced and possibly better for performance (and definitely "cooler") way is to use the concept of script tags as data containers, like this:
<script type="text/plain">
#HTMLEditFormat(myFileContents)#
</script>
Last time I've seen this in Nadel's blog, I think. Read it, pretty interesting.
Hope this helps.