Using Atlassian Python API, is it possible to update a page title without changing the links pointing to it from other pages? - atlassian-python-api

This may seem a silly question, as who would want to mess up all the links to a page?
What I want to do is change the page titles to get them into the right order, move one page around in each folder manually, then change the titles back to what they were before. This takes forever because Confluence changes all the links pointing to each page, twice.
I'm doing this because it's not possible to instruct Confluence to list pages in the order of creation: Confluence only knows the alphabetical order, or it respects the order given by the user. So I have a method that changes the titles to add prefixes like QQQ_1, QQQ_2, QQQ_3... in the order of creation. This helps me manually reorder the pages by moving a page in each folder back and forth. Once Confluence has noted that each folder is manually reordered, the pages stay in the same order after I remove the prefixes.
I'm using the update_page command:
Confluence.update_page(page_id=page_id, title=new_page_title)

Related

Adding an in-page search and display within a Mediawiki page

I have been requested to add some functionality to a Mediawiki page. I am learning MW as fast as I can. We have a MW page with a very large wikitable of bibliographic data. The data is also kept in an external Excel file. It has been requested to add an input field and button so that visitors can search that bibliography and redisplay just the rows that contain a match for the search. I've looked at a lot of extensions and have tried to work out how I could patch together this functionality (Maybe External Data and URLGetParameters but how to do the input field?) I've thought about using an Iframe for the whole thing, and simply do it in PHP using the external spreadsheet but then the information in the IFrame is not visible to the MediaWiki search, yes? Perhaps Javascript/JQuery but I haven't worked out how to execute that on a MW page yet. Does anyone know a proven path for doing this type of thing so I can possibly cut out some of the dead ends I am investigating?

Mediawiki - Automatic two-way links between page sections

I want my MediaWiki install to have two classes of pages. (In the users' eyes - the wiki won't have to know the difference.)
I want some pages to be on topics, and others on sources (name of book, video, etc.)
I want to have a topic page "FAA Licenses" like:
==Medical Certificates==
===3rd Class===
Required for student license, and before student solo flights. {{{link/reference/whatever generally around here to Jeppesen Book#pg27-28}}}
And a source page "Jeppesen Book" like:
==pg27-28==
{{{link to FAA Licenses#3rd Class}}}
These source pages will track the source's (book or video) content. I imagine a source page for a book to have page numbers, and for a video to have start and stop times, or section numbers. (The book or video itself won't be on the source pages.)
So, the source pages will really serve two purposes. First, it will be fairly easy to see which parts of the sources have had notes taken and put into the topic pages. (So non-linear note-taking of sources will be easy -- skipping from source to source on topics, rather than digesting an entire source at once.) Second, it will be easy from a topic page to see where to go back to for a more in-depth review.
There's two issues I'm writing about.
(1) I want the workflow to be the user edits the topic page, putting in links to source pages and sections. I want this one user-addition to automatically make the source page link back to this spot. I want the system to handle the two-way-linking, assuming the user won't be perfect.
(2) I want the user to be able to put links in the topic page to source pages and sections that might not exist yet. I'd need those links to show up as red, to indicate they need to be created. But, still, once created, I want the system to handle the two-way-linking, even if there were multiple red links to the same area. (I could see building up quite a few red links, then having an unorganized "purge" of them by creating the missing pages and sections, and don't want to have to search for all the links to the new areas.) Ideally, I'd love for these source pages to be auto-generated -- so pages and sections were made as links were made to them, and automatically deleted (or at least the backlinks removed) as links were removed to them.
I don't think the MediaWiki what links here functionality does the job. I want this to work on a per-section rather than per-page basis. And, I don't want the user to have to add to each section a "what links here tag" -- I want it to be automatic.
The extension Semantic MediaWiki will allow you to get bidirectional linking in a semi-automatic fassion.
https://www.semantic-mediawiki.org/wiki/Help:Link_Template
shows a high level example.
If you dig deeper into SMW and SemanticForms you'll find how with e.g. SemanticForms you can get a user experience that is close to what you are asking for.
See e.g. http://smw.referata.com/wiki/Discourse_DB and http://www.discoursedb.org/wiki/Main_Page for an application of these principles.
I don't think there is an easy way to do that. You could write an extension that provides a parser function that your users can enter, save the source page + source section + target page + target section in a database at links update, then use the ParserSectionCreate hook to show links based on that. Or you can create two types of templates and write a bot that keeps them in sync.

Linking Menu Panel in Dreameaver for easy updating

I'm fairly new to Dreamweaver, I've been working on a website that contains a bunch of pages that need to be edited. Mainly, the menu/drop down menu tabs need to be updated with new links and or names/etc. Is there a way to link the menu bar with the rest of the pages so I don't have to manually edit each and every piece of code on every other page?
There are a couple of Dreamweaver specific ways (Templates and Library items), and a better way (server include).
Dreamweaver Templates:
This requires that you have all of your pages based on Dreamweaver templates and you have you menu in a non-editable region. Once you edit the menu in the template and save your template, Dreamweaver will ask if you want to update all the pages in the site. If you do so, then Dreamweaver will go through your site and update all pages based on the template and update the menu code in those pages. This method will require that you upload all of the changed files in order to see the new menu on all of your pages. For more on templates:
http://help.adobe.com/en_US/dreamweaver/cs/using/WScbb6b82af5544594822510a94ae8d65-7acda.html
Dreamweaver Library Items:
Library items are similar to templates in that there is a code block that you can update and when saved the update gets cascaded into every instance in the site. Library items are unique in that they are focused on smaller blocks of code that get added to your page. Again, as with Dreamweaver templates, if you make a change, you'll have to upload all of the changed files in order to see the changes on your site. For more on Dreamweaver library items:
http://help.adobe.com/en_US/dreamweaver/cs/using/WSc78c5058ca073340dcda9110b1f693f21-7e49a.html
Server Include:
This option is "better" in that if you make a change to the include file, once you upload only that file, then all pages that reference the include file will automatically display the updated menu. How to implement this option will depend on the specific server language(s) you have available on your remote site. For example, PHP has at least 4 ways to include an external file (such as your menu): include, include_once, require and require_once.
If you search google or the search engine of your choice for the language name you have available plus include, you'll get a number of results of how to implement an include for your page.
With this option, you'll need to update all pages that have the menu to reference the include file and upload the changed files, but going forward, changes to the menu will only require uploading the include file in order to update your site.
One word of caution with includes is that you need to be careful with the paths in your include files, specifically if you have pages with the menu on it that are in multiple folders throughout your site. Search for relative and absolute paths for more info.

Mediawiki: configuring the entry page, adding a new page

Have a wiki installed in our organization, and want to start using it.
Failed to find the answers for the next 2 basic questions:
How do I configure the entry page to show a list of all existing pages
How do I create a new page (!). Only succeeded doing it by typing a url of an non existing page. Guess there are nicer methods for this
Thanks
Gidi
For how to show a list of all pages, look at DynamicPageList, which is part of MediaWiki. (There's a more advanced third-party version, but it's not needed for such a simple task.)
Creating a new page really is exactly as you said: Type a URL and save some edits. Most beginning editors will edit a link into a page, and then use that link to browse to the page, so that they don't accidentally forget the spelling and lose the page to the Ether. (Of course it would show up in the recently edited and other special pages.)
This is more of a webapps.stackexchange.com question though.

How should I handle autolinking in wiki page content?

What I mean by autolinking is the process by which wiki links inlined in page content are generated into either a hyperlink to the page (if it does exist) or a create link (if the page doesn't exist).
With the parser I am using, this is a two step process - first, the page content is parsed and all of the links to wiki pages from the source markup are extracted. Then, I feed an array of the existing pages back to the parser, before the final HTML markup is generated.
What is the best way to handle this process? It seems as if I need to keep a cached list of every single page on the site, rather than having to extract the index of page titles each time. Or is it better to check each link separately to see if it exists? This might result in a lot of database lookups if the list wasn't cached. Would this still be viable for a larger wiki site with thousands of pages?
In my own wiki I check all the links (without caching), but my wiki is only used by a few people internally. You should benchmark stuff like this.
In my own wiki system my caching system is pretty simple - when the page is updated it checks links to make sure they are valid and applies the correct formatting/location for those that aren't. The cached page is saved as a HTML page in my cache root.
Pages that are marked as 'not created' during the page update are inserted into the a table of the database that holds the page and then a csv of pages that link to it.
When someone creates that page it initiates a scan to look through each linking page and re-caches the linking page with the correct link and formatting.
If you weren't interested in highlighting non-created pages however you could just have a checker to see if the page is created when you attempt to access it - and if not redirect to the creation page. Then just link to pages as normal in other articles.
I tried to do this once and it was a nightmare! My solution was a nasty loop in a SQL procedure, and I don't recommend it.
One thing that gave me trouble was deciding what link to use on a multi-word phrase. Say you had some text saying "I am using Stack Overflow" and your wiki had 3 pages called "stack", "overflow" and "stack overflow"....which part of your phrase gets linked to where? It will happen!
My idea would be to query the titles like SELECT title FROM articles and simply check if each wikilink is in that array of strings. If it is you link to the page, if not, you link to the create page.
In a personal project I made with Sinatra (link text) after I run the content through Markdown, I do a gsub to replace wiki words and other things (like [[Here is my link]] and whatnot) with proper links, on each checking if the page exists and linking to create or view depending.
It's not the best, but I didn't build this app with caching/speed in mind. It's a low resource simple wiki.
If speed was more important, you could wrap the app in something to cache it. For example, sinatra can be wrapped with the Rack caching.
Based on my experience developing Juli, which is an offline personal wiki with autolink, generating static HTML approach may fix your issue.
As you think, it takes long time to generate autolinked Wiki page. However, in generating static HTML situation, regenerating autolinked Wiki page happens only when a wikipage is newly added or deleted (in other words, it doesn't happen when updating wikipage) and the 'regenerating' can be done in background so that usually I don't matter how it take long time. User will see only the generated static HTML.