comparison doc/libervia-cli/pubsub.rst @ 3505:4705f80b6e23

doc: more renaming
author Goffi <goffi@goffi.org>
date Thu, 22 Apr 2021 18:16:19 +0200
parents c80a0f864b5d
children 267e4987b58b
comparison
equal deleted inserted replaced
3504:9f7a867d9722 3505:4705f80b6e23
307 .. _RSM: https://xmpp.org/extensions/xep-0059.html 307 .. _RSM: https://xmpp.org/extensions/xep-0059.html
308 308
309 example 309 example
310 ------- 310 -------
311 311
312 Imagine that you want to replace all occurrences of "sàt" by "Salut à Toi" in your personal blog. You first create a Python script like this: 312 Imagine that you want to replace all occurrences of "sàt" by "Libervia" in your personal blog. You first create a Python script like this:
313 313
314 .. sourcecode:: python 314 .. sourcecode:: python
315 315
316 #!/usr/bin/env python3 316 #!/usr/bin/env python3
317 317
318 import sys 318 import sys
319 item_raw = sys.stdin.read() 319 item_raw = sys.stdin.read()
320 if not "sàt" in item_raw: 320 if not "sàt" in item_raw:
321 print("SKIP") 321 print("SKIP")
322 else: 322 else:
323 print(item_raw.replace("sàt", "Salut à Toi")) 323 print(item_raw.replace("sàt", "Libervia"))
324 324
325 And save it a some location, e.g. ``~/expand_sat.py`` (don't forget to make is executable 325 And save it a some location, e.g. ``~/expand_sat.py`` (don't forget to make is executable
326 with ``chmod +x ~/expand_sat.py``). 326 with ``chmod +x ~/expand_sat.py``).
327 327
328 To be sure it's safe, you can first do a dry-run and check the result:: 328 To be sure it's safe, you can first do a dry-run and check the result::