Skip to content

Commit

Permalink
Merge pull request #1593 from UlrichB22/help-en
Browse files Browse the repository at this point in the history
Rename dir and parm en to help-en, common to help-common
  • Loading branch information
RogerHaase authored Feb 6, 2024
2 parents 17a1290 + 864e961 commit 7792aa9
Show file tree
Hide file tree
Showing 80 changed files with 26 additions and 27 deletions.
8 changes: 4 additions & 4 deletions docs/admin/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ If you want to load English help for editors (replace en with your wiki's prefer

::

moin load-help -n en
moin load-help -n common
moin load-help -n help-en
moin load-help -n help-common

Run your wiki instance
======================
Expand Down Expand Up @@ -223,8 +223,8 @@ If you want to load English help for editors (replace en with your wiki's prefer

::

moin load-help -n en
moin load-help -n common
moin load-help -n help-en
moin load-help -n help-common

Next, run the built-in wiki server:

Expand Down
10 changes: 5 additions & 5 deletions docs/devel/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,8 @@ Wiki admins can change permissions via the ACL rules.

To load the help docs::

moin load-help --namespace common # images common to all languages
moin load-help --namespace en # English text
moin load-help --namespace help-common # images common to all languages
moin load-help --namespace help-en # English text

Multiple languages may be loaded. Current languages include::

Expand All @@ -517,7 +517,7 @@ When editing is complete run one or more of::

Dump all the English help files to the version controlled directory::

moin dump-help -n en
moin dump-help -n help-en

The above command may may be useful after updating one or more files. All of the files
will be rewritten but only the changed files will be highlighted in version control.
Expand Down Expand Up @@ -574,7 +574,7 @@ Create a new venv, install moin, create instance, start server, create item, mod
moin run # empty wiki
moin load-sample # data but no index
moin index-build # data with index
moin load-help -n en # load English help
moin load-help -n common # load help images
moin load-help -n help-en # load English help
moin load-help -n help-common # load help images

Announce update on #moin, [email protected].
6 changes: 3 additions & 3 deletions src/moin/cli/_tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright: 2023 MoinMoin project
# Copyright: 2023-2024 MoinMoin project
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.

"""
Expand Down Expand Up @@ -78,8 +78,8 @@ def index_create(create_instance):

@pytest.fixture(scope="package")
def load_help(index_create):
load_help_common = run(['moin', 'load-help', '-n', 'common'])
load_help_en = run(['moin', 'load-help', '-n', 'en'])
load_help_common = run(['moin', 'load-help', '-n', 'help-common'])
load_help_en = run(['moin', 'load-help', '-n', 'help-en'])
return load_help_common, load_help_en


Expand Down
12 changes: 6 additions & 6 deletions src/moin/cli/_tests/test_modify_item.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright: 2023 MoinMoin project
# Copyright: 2023-2024 MoinMoin project
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.

"""
Expand Down Expand Up @@ -40,9 +40,9 @@ def test_dump_help(load_help):
moin_dir, artifact_dir = get_dirs('cli')
help_dir = Path('my_help')
source_help_dir = moin_dir / 'src' / 'moin' / 'help'
with open(source_help_dir / 'en' / 'Home.data', newline='') as f:
with open(source_help_dir / 'help-en' / 'Home.data', newline='') as f:
crlf_option = '--crlf' if '\r\n' in f.read() else '--no-crlf'
for help_subdir in ['common', 'en']:
for help_subdir in ['help-common', 'help-en']:
help_subdir_path = help_dir / help_subdir
if not help_subdir_path.exists():
help_subdir_path.mkdir(parents=True)
Expand Down Expand Up @@ -75,12 +75,12 @@ def test_item_get(load_help):
moin_dir, _ = get_dirs('cli')
with open('cat.meta') as f:
meta_cat = json.load(f)
with open(moin_dir / 'src' / 'moin' / 'help' / 'common' / 'cat.jpg.meta') as f:
with open(moin_dir / 'src' / 'moin' / 'help' / 'help-common' / 'cat.jpg.meta') as f:
meta_cat_expected = json.load(f)
validate_meta(meta_cat_expected, meta_cat, f"{moin_dir / 'src' / 'moin' / 'help' / 'common' / 'cat.jpg.meta'} != cat.meta")
validate_meta(meta_cat_expected, meta_cat, f"{moin_dir / 'src' / 'moin' / 'help' / 'help-common' / 'cat.jpg.meta'} != cat.meta")
with open('cat.data', 'rb') as f:
cat_bytes = f.read()
with open(moin_dir / 'src' / 'moin' / 'help' / 'common' / 'cat.jpg.data', 'rb') as f:
with open(moin_dir / 'src' / 'moin' / 'help' / 'help-common' / 'cat.jpg.data', 'rb') as f:
cat_bytes_expected = f.read()
assert cat_bytes_expected == cat_bytes

Expand Down
6 changes: 3 additions & 3 deletions src/moin/cli/maint/create_instance.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright: 2020 MoinMoin:RogerHaase
# Copyright: 2023 MoinMoin project
# Copyright: 2023-2024 MoinMoin project
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.

"""
Expand Down Expand Up @@ -100,8 +100,8 @@ def cli_BuildInstance():
logging.info('Build Instance started.')
logging.debug('CWD: %s', os.getcwd())
index.IndexCreate()
modify_item.LoadHelp(namespace='en', path_to_help=None)
modify_item.LoadHelp(namespace='common', path_to_help=None)
modify_item.LoadHelp(namespace='help-en', path_to_help=None)
modify_item.LoadHelp(namespace='help-common', path_to_help=None)
modify_item.LoadWelcome()
index.IndexOptimize(tmp=False)
logging.info('Full instance setup finished.')
Expand Down
11 changes: 5 additions & 6 deletions src/moin/cli/maint/modify_item.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright: 2011 MoinMoin:ThomasWaldmann
# Copyright: 2022 MoinMoin:RogerHaase
# Copyright: 2023 MoinMoin project
# Copyright: 2023-2024 MoinMoin project
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.

"""
Expand Down Expand Up @@ -152,7 +152,7 @@ def PutItem(meta_file, data_file, overwrite):

@cli.command('load-help', help='Load a directory of help .data and .meta file pairs into a wiki namespace')
@click.option('--namespace', '-n', type=str, required=True,
help='Namespace to be loaded: common, en, etc.')
help='Namespace to be loaded: help-common, help-en, etc.')
@click.option('--path_to_help', '--path', '-p', type=str,
help='Override source directory, default is src/moin/help')
def cli_LoadHelp(namespace, path_to_help):
Expand Down Expand Up @@ -190,7 +190,7 @@ def LoadHelp(namespace, path_to_help):

@cli.command('dump-help', help='Dump a namespace of user help items to .data and .meta file pairs')
@click.option('--namespace', '-n', type=str, required=True,
help='Namespace to be dumped: common, en, etc.')
help='Namespace to be dumped: help-common, help-en, etc.')
@click.option('--path_to_help', '--path', '-p', type=str,
help='Override output directory, default is src/moin/help')
@click.option('--crlf/--no-crlf', help='use windows line endings in output files')
Expand All @@ -203,9 +203,8 @@ def DumpHelp(namespace, path_to_help, crlf):
before_wiki()
if path_to_help is None:
path_to_help = _get_path_to_help()
item_name = 'help-' + namespace
# item_name is a namespace, we create a dummy item so we can get a list of files
item = Item.create(item_name)
# Item name is the name of the namespace, create a dummy item to get the list of files
item = Item.create(namespace)
# get_index is fast, but returns alias names as if they are unique items
_, files = item.get_index()
count = 0
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7792aa9

Please sign in to comment.