Uni-directional wiki page mirroring
From WhyNotWiki
Uni-directional wiki page mirroring edit (Category edit)
This could be uni-directional or bi-directional.
Contents |
[edit] Why? What for?
A couple possible reasons:
- You're [duplicating (category)] some information on your site from another site and you want your copy of the information to be always up-to-date, rather than a snapshot-in-time.
- You're duplicating the contents (or a section therefrom) of a file on your web server. (For example, a Ruby script that's available for download via your Subversion server.) You would often do this to make comments about the script or provide some kind of additional annotations to the original file (which couldn't just be embedded in the source file itself). This is an intentional duplication between your file and your wiki, but it is intentional (because you want the contents/excerpt to also appear on your wiki) and can be managed sanely via a one-way synchronization (using the file as the master of course).
- You don't want to simply wipe out your annotated copy if you have annotated it (with comments, underlining, etc.) for display on the wiki. So a simple auto-pull and replace may not be good enough. Unless... May have to do the annotation as some kind of script/meta-markup that wraps the original markup/file contents but leaves it unchanged (so that it can be updated without breaking your annotations)...
- You have a (non-confidential) page on your wiki at work (which can only be viewed from within the company's network) that needs to be managed there for some reason but you want a mirror (read-only) copy of it available on your personal wiki (would require pushing instead of pulling)
- Slight variation on this: loose two-way synchronization between an at-work wiki page and a personal-site wiki page on the same topic.
- ...
[edit] Mirroring from Wikipedia
As long as the source wiki's license permits it, you can copy material from it and re-publish it on your wiki. This is useful for pulling things from various sources together onto one page. However, if the original/source page ever changes, your copy will be out-of-sync/out-of-date. That is undesirable. That's what this page is about (well, a solution to that problem).
[edit] Documentation
Say I want to include the contents of the section http://corelib.rubyonrails.org/classes/Kernel.html#M002058 (set_trace_func) inline on a page that talks about set_trace_func.
Well, that's fine ... except that it's duplication ... which is not good!
To make it less "not good", we should make that a regularly-updated link/data-source rather than just a point-in-time snapshot. Any time the source documentation changes, we want our cached copy of the documentation to change as well.
[edit] How to do it manually
Transclude this template in your destination page: Template:Mirror of. (Also mentioned on WhyNotWiki:Conventions.)
[edit] [User interface (category)]: How to initiate automation
Any time you quote/cite from some Web source, the user interface should ask you whether you want to make that a point-in-time snapshot (the default, but not by much) or a synced data source.
Since you would be citing this quite frequently, that seems like a perfect time for the user to be given the chance to set up syncing. It would be a very quick and easy process.
I'm not sure which one would be used more often...
[edit] How to automate
[edit] If source is a MediaWiki wiki:
It would be especially easy if source is a MediaWiki wiki. Just pull source ("view source" or use the Special:Data page or whatever)...
If we need to do pushing rather than pulling, could make a button on the page that (after filling the destination URL to post in) would export the current page and then post it to/import it into your destination wiki...
[edit] If source is not a MediaWiki wiki:
We would have to
- Strip off the header/footer and just extract out the actual content
- Normalize that data: strip out any useless tags; convert <b> to <strong>, etc.
- Convert to MediaWiki markup (if that's our destination)...
[edit] Examples (input and output)
In this example [1], one might want to preserve the italics () and the indent (:), but not the links, because they refer to parts of the page that you are not copying/mirroring (or they may refer to pages which are present in the source wiki but are not and will not be present in your wiki).
An example of a backronym from the word ''acronym'' is as follows. :Acronyms Condense Representations Of Neologisms You Memorize In this example, because the word ''acronym'' itself is not an acronym, the phrase above is a [[#Pure|pure]] backronym, not a [[#Replacement|replacement]] backronym. Since the phrase indirectly refers to the word itself, it is also [[#Apronym|apronym]]ic. Also, because the word ''acronym'' itself appears in its backronym, the phrase is also a [[#Recursive|recursive]]-backronym. If this backronym helps you remember the word ''acronym'' or ''backronym'', then it is also a [[#Mnemonic|mnemonic]].
[edit] ↓ Low
[edit] Breaking mirroring
It should be smart enough to detect if we've diverged, in which case don't overwrite the destination with source's data
[edit] Detecting changes
But how can it know if we've diverged, in relation to what we pulled from them?
Probably the easiest would be to just disable the mirroring via an after-save hook...
if we use a trivial check to see if their page is different than what we have cached, then it will be "diverged" even if they've changed their page so we'd never update so it'd defeat the whole purpose of it
Aliases: Synchronizing from a wiki page on one site to another, Synchronization of a wiki page from one site to another, Automatically importing an external wiki page
