help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Editing MediaWiki pages


From: Sharon Kimble
Subject: Re: Editing MediaWiki pages
Date: Mon, 30 Oct 2017 09:26:48 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

"N. Raghavendra" <nyraghu27132@gmail.com> writes:

> I have recently started contributing to a Wiki that runs on MediaWiki.
> I have been writing on the Web interface of the Wiki, which is
> convenient for previewing, but is otherwise inconvenient.  I would like
> to edit the Wiki pages from Emacs.  I found two packages for this:
>
> 1. wikipedia-mode,
>    https://en.wikipedia.org/wiki/Wikipedia:Wikipedia-mode.el
>
> 2. mediawiki-el, https://github.com/hexmode/mediawiki-el
>
> I would appreciate any advice or recommendations about these or other
> packages for editing MediaWiki pages with Emacs.

Hi Raghu, sorry for not replying sooner but I've had the builders in and
am only now getting sorted out.

I regularly write 'articles' for my 'DrugFacts' mediawiki, using
org-mode exported as mediawiki. Every article and menu on that site is
written in org-mode, except for the top drop-down menu, and the articles
are also stored in mediawiki format in my ~/.emacs.d/wiki' directory.
Because my main file for DrugFacts is 3.4mb, I highlight the section
that I want to export and then export it as mediawiki, so that in the
mediawiki buffer I'm only left with the correct section and nothing
else. But it does require rereading and then various things like
citations being sorted out, for which I use several yasnippets further
down this email.

--8<---------------cut here---------------start------------->8---
#+BEGIN_SRC emacs-lisp
(require 'mediawiki)
;;(require 'ox-mediawiki)
(eval-after-load "org" '(require 'ox-mediawiki nil t))
(global-set-key (kbd "M-s-a") 'org-mw-export-to-mediawiki) ;; ("mw" file)
(global-set-key (kbd "M-s-e") 'org-mw-export-as-mediawiki) ;; (temporary buffer)
#+END_SRC
[2017-03-16 Thu 10:30]

#+BEGIN_SRC emacs-lisp
(defun mediawiki-test-suite ()
  (toggle-truncate-lines 0)
  (abbrev-mode 1)
  (set-fill-column 65000)
  (auto-fill-mode 0))

(add-hook 'mediawiki-mode-hook #'mediawiki-test-suite)
#+END_SRC
[2017-03-17 Fri 21:04]

#+BEGIN_SRC emacs-lisp
  ;; do this in a hook because mediawiki-mode resets its keybindings on
  ;; evey mode change.
  (add-hook 'mediawiki-mode-hook
            (lambda ()
              (define-key mediawiki-mode-map (kbd "C-x C-s") 'save-buffer)))
#+END_SRC
[2017-04-12 Wed 15:19]
--8<---------------cut here---------------end--------------->8---

I've also set up several yasnippets which I find very useful when I'm
writing org-mode2mediawiki test, and they are -

--8<---------------cut here---------------start------------->8---
# -*- mode: snippet -*-
# name: category
# key: medcas
# --
[[Category:

# -*- mode: snippet -*-
# name: citation
# key: cref
# --
<ref name="$0"> </ref>

# -*- mode: snippet -*-
# name: citation repeat
# binding: M-s-8
# --
<ref name="$0"/>

# -*- mode: snippet -*-
# name: mediawiki-end
# key: medend
# --
----

== References ==

<references />

<span id="BackToTop"></span>
<div class="noprint" style="background-color:#fc3; color:#d33; position:fixed; 
bottom:2%; left:0.25%; padding:0; margin:0;">
[[#top| '''Back to the Top''' ]]
</div>
<span id="BackToTop"></span>
<div class="noprint" style="background-color:#fc3; color:#d33; position:fixed; 
bottom:2%; right:0.25%; padding:0; margin:0;">
[[#top| '''Back to the Top''' ]]
</div>
--8<---------------cut here---------------end--------------->8---

I hope that these have been helpful, and if I can help you further,
please, get in contact.

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = https://www.drugfacts.org.uk  
Debian 9.2, fluxbox 1.3.5-2, emacs 25.3.2, org-mode 9.1.1

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]