unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Editing MediaWiki pages
@ 2017-10-26  2:13 N. Raghavendra
  2017-10-30  9:26 ` Sharon Kimble
  0 siblings, 1 reply; 10+ messages in thread
From: N. Raghavendra @ 2017-10-26  2:13 UTC (permalink / raw)
  To: help-gnu-emacs

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.

Thanks and regards,
Raghu.

-- 
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Editing MediaWiki pages
  2017-10-26  2:13 Editing MediaWiki pages N. Raghavendra
@ 2017-10-30  9:26 ` Sharon Kimble
  2017-10-31 14:17   ` Raghavendra Nyshadham
  2017-11-14 19:08   ` Narendra Joshi
  0 siblings, 2 replies; 10+ messages in thread
From: Sharon Kimble @ 2017-10-30  9:26 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: N. Raghavendra

[-- Attachment #1: Type: text/plain, Size: 3713 bytes --]

"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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Editing MediaWiki pages
  2017-10-30  9:26 ` Sharon Kimble
@ 2017-10-31 14:17   ` Raghavendra Nyshadham
  2017-11-14 19:08   ` Narendra Joshi
  1 sibling, 0 replies; 10+ messages in thread
From: Raghavendra Nyshadham @ 2017-10-31 14:17 UTC (permalink / raw)
  To: Sharon Kimble; +Cc: help-gnu-emacs

Dear Sharon,

Thanks for the message. I am sorry for the delay in replying; I am traveling.

The Wiki I am writing in is a  multiuser one, where users edit pages with tools of their choice.  Therefore, maintaining local versions of the pages in Org mode, and exporting from them, is not feasible. 

Regards,
Raghu.

-- 
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/

> On 30-Oct-2017, at 14:56, Sharon Kimble <boudiccas@skimble.plus.com> wrote:
> 
> "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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Editing MediaWiki pages
  2017-10-30  9:26 ` Sharon Kimble
  2017-10-31 14:17   ` Raghavendra Nyshadham
@ 2017-11-14 19:08   ` Narendra Joshi
  2017-11-15 15:58     ` Sharon Kimble
  2017-11-15 16:33     ` N. Raghavendra
  1 sibling, 2 replies; 10+ messages in thread
From: Narendra Joshi @ 2017-11-14 19:08 UTC (permalink / raw)
  To: Sharon Kimble; +Cc: help-gnu-emacs, N. Raghavendra

Sharon Kimble <boudiccas@skimble.plus.com> writes:

> #+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]
How do you insert these code blocks that get syntax highlighted in Emacs/Gnus?

Best,
-- 
Narendra Joshi



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Editing MediaWiki pages
  2017-11-14 19:08   ` Narendra Joshi
@ 2017-11-15 15:58     ` Sharon Kimble
  2017-11-15 16:09       ` Emanuel Berg
  2017-11-15 16:33     ` N. Raghavendra
  1 sibling, 1 reply; 10+ messages in thread
From: Sharon Kimble @ 2017-11-15 15:58 UTC (permalink / raw)
  To: Narendra Joshi; +Cc: help-gnu-emacs, N. Raghavendra

[-- Attachment #1: Type: text/plain, Size: 1166 bytes --]

Narendra Joshi <narendraj9@gmail.com> writes:

> Sharon Kimble <boudiccas@skimble.plus.com> writes:
>
>> #+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]
> How do you insert these code blocks that get syntax highlighted in Emacs/Gnus?

Both of these blocks came from my emacs init file, in my case an
org-file, and they then are able to be used as required.

Does this help?

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Editing MediaWiki pages
  2017-11-15 15:58     ` Sharon Kimble
@ 2017-11-15 16:09       ` Emanuel Berg
  2017-11-15 16:47         ` tomas
  0 siblings, 1 reply; 10+ messages in thread
From: Emanuel Berg @ 2017-11-15 16:09 UTC (permalink / raw)
  To: help-gnu-emacs

Sharon Kimble wrote:

>> How do you insert these code blocks that get
>> syntax highlighted in Emacs/Gnus?
>
> Both of these blocks came from my emacs init
> file, in my case an org-file, and they then
> are able to be used as required.
>
> Does this help?

I'm pretty sure he meant the begin/end block
around the source so that Gnus shows the code
with font lock as would a regular .el file only
still in article mode...

-- 
underground experts united
http://user.it.uu.se/~embe8573




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Editing MediaWiki pages
  2017-11-14 19:08   ` Narendra Joshi
  2017-11-15 15:58     ` Sharon Kimble
@ 2017-11-15 16:33     ` N. Raghavendra
  1 sibling, 0 replies; 10+ messages in thread
From: N. Raghavendra @ 2017-11-15 16:33 UTC (permalink / raw)
  To: help-gnu-emacs

At 2017-11-15T00:38:30+05:30, Narendra Joshi wrote:

> Sharon Kimble <boudiccas@skimble.plus.com> writes:
>
>> #+BEGIN_SRC emacs-lisp
>> ...
> How do you insert these code blocks that get syntax highlighted in
> Emacs/Gnus?

In Message mode, hence while composing a message in Gnus, you can use
`message-mark-inserted-region', bound, by default, to `C-c M-m'.  See
the Info node (message) > Commands > Insertion.

Raghu.

-- 
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Editing MediaWiki pages
  2017-11-15 16:09       ` Emanuel Berg
@ 2017-11-15 16:47         ` tomas
  2017-11-15 17:40           ` Emanuel Berg
  2017-11-15 18:33           ` N. Raghavendra
  0 siblings, 2 replies; 10+ messages in thread
From: tomas @ 2017-11-15 16:47 UTC (permalink / raw)
  To: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Nov 15, 2017 at 05:09:34PM +0100, Emanuel Berg wrote:
> Sharon Kimble wrote:
> 
> >> How do you insert these code blocks that get
> >> syntax highlighted in Emacs/Gnus?
> >
> > Both of these blocks came from my emacs init
> > file, in my case an org-file, and they then
> > are able to be used as required.
> >
> > Does this help?
> 
> I'm pretty sure he meant the begin/end block
> around the source so that Gnus shows the code
> with font lock as would a regular .el file only
> still in article mode...

Those BEGIN_SRC/END_SRC are standard org-mode markup for
source code blocks.

Cheers
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAloMb5AACgkQBcgs9XrR2kYdBQCfQijPIFAT+kBORU7f3AbXBgET
B6gAn0DiRMutPjFGY1Ci2gRuHoZ1a8wO
=sx0P
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Editing MediaWiki pages
  2017-11-15 16:47         ` tomas
@ 2017-11-15 17:40           ` Emanuel Berg
  2017-11-15 18:33           ` N. Raghavendra
  1 sibling, 0 replies; 10+ messages in thread
From: Emanuel Berg @ 2017-11-15 17:40 UTC (permalink / raw)
  To: help-gnu-emacs

t wrote:

> Those BEGIN_SRC/END_SRC are standard org-mode
> markup for source code blocks.

org-mode! That explains why I never used them.

Actually I think it is overkill to have font
lock in mails/posts. Only single functions or
short pieces of code should be posted anyway,
and then it isn't really necessary.

If it is longer than that just use an URL so
the audience can get the file and assess it
with their own tools in good order...

-- 
underground experts united
http://user.it.uu.se/~embe8573




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Editing MediaWiki pages
  2017-11-15 16:47         ` tomas
  2017-11-15 17:40           ` Emanuel Berg
@ 2017-11-15 18:33           ` N. Raghavendra
  1 sibling, 0 replies; 10+ messages in thread
From: N. Raghavendra @ 2017-11-15 18:33 UTC (permalink / raw)
  To: help-gnu-emacs

At 2017-11-15T17:47:12+01:00, tomas@tuxteam.de wrote:

> On Wed, Nov 15, 2017 at 05:09:34PM +0100, Emanuel Berg wrote:
>> Sharon Kimble wrote:
>> 
>> >> How do you insert these code blocks that get
>> >> syntax highlighted in Emacs/Gnus?
>> >
>> > Both of these blocks came from my emacs init
>> > file, in my case an org-file, and they then
>> > are able to be used as required.
>> >
>> > Does this help?
>> 
>> I'm pretty sure he meant the begin/end block
>> around the source so that Gnus shows the code
>> with font lock as would a regular .el file only
>> still in article mode...
>
> Those BEGIN_SRC/END_SRC are standard org-mode markup for
> source code blocks.

Yes, but I don't know if that's relevant to the highlighting of these
blocks in Gnus, which was what Narendra asked about.

The source code blocks in Sharon's message are enclosed between the
strings

"--8<---------------cut here---------------start------------->8---\n"

and

"--8<---------------cut here---------------end--------------->8---\n",

which are the default values of `message-mark-insert-begin' and
`message-mark-insert-end'.  The function `message-mark-inserted-region',
whose default binding in Message mode is `C-c M-m', encloses the active
region between these two strings.

If the sender of a message marks a part of the message like this, and if
the recipient views the message as a Gnus article, then the marked text
appears in the face `mm-uu-extract'; on my dark background for Emacs,
the face has a dark green background, and a light yellow foreground.
This is the only highlighting that I see when I view Sharon's message.
I wonder if this is what Narendra meant by "syntax highlighted", or if
he meant something else.

Regards,
Raghu.

-- 
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-11-15 18:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-26  2:13 Editing MediaWiki pages N. Raghavendra
2017-10-30  9:26 ` Sharon Kimble
2017-10-31 14:17   ` Raghavendra Nyshadham
2017-11-14 19:08   ` Narendra Joshi
2017-11-15 15:58     ` Sharon Kimble
2017-11-15 16:09       ` Emanuel Berg
2017-11-15 16:47         ` tomas
2017-11-15 17:40           ` Emanuel Berg
2017-11-15 18:33           ` N. Raghavendra
2017-11-15 16:33     ` N. Raghavendra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).