* [PATCH] Documentation: fix broken conversion
@ 2015-01-05 14:10 Peter Wu
2015-01-06 1:14 ` Qu Wenruo
2015-01-09 17:41 ` David Sterba
0 siblings, 2 replies; 3+ messages in thread
From: Peter Wu @ 2015-01-05 14:10 UTC (permalink / raw)
To: linux-btrfs
Fixes various formatting issues:
Fixes quoting issues in various manpages. Before/After excerpts for
mkfs.btrfs(8), btrfs-qgroup(8):
mkfs.btrfs [-A|--alloc-start '<alloc-start>']
mkfs.btrfs [-A|--alloc-start <alloc-start>]
id 0/<subvolume id>''
id 0/<subvolume id>
If multiple '<attr>'s is given, use comma to separate.
If multiple <attr>s is given, use comma to separate.
The one that is most apparent is the removal of text in
btrfs-subvolume(8) and others. Before/After:
list [options] [-G <value>] [-C <value>] [--sort=rootid,gen,ogen,path] <path>
list [options] [-G [+|-]<value>] [-C [+|-]<value>] [--sort=rootid,gen,ogen,path] <path>
create [-i <qgroupid>] <name>
create [-i <qgroupid>] [<dest>]<name>
This happens because `<foo>` was replaced by `'<foo>'` in the sed
expression, which is then treated as a constrained quote. As a result,
the `[...]` before the string gets interpreted as "quoted text
attributes".
In this patch, the sed expression is dropped and asciidoc is configured
to recognize `<...>` as a unconstrained quoted string (such that
`<attr>s` is correctly emphasized) and to avoid adding quotes in
contexts where it is not needed.
A remaining problem is that some texts (the one between brackets) do not
add the emphasis for `<...>`. While this could be solved by replacing
`[` and `]` with `[` and `]` using sed, it introduces formatting
problems in btrfs-zero-log(8) because the context is ignored.
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
---
Documentation/Makefile | 8 +++-----
Documentation/asciidoc.conf | 6 ++++++
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index ef4f1bd..72ab77b 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -113,10 +113,8 @@ clean:
$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
%.xml : %.txt asciidoc.conf
- $(QUIET_ASCIIDOC)$(RM) $@.tmp[12] $@ && \
- sed -e "s/\(<[^>]\+>\)/'\1'/g" < $< > $@.tmp1 && \
+ $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
$(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
$(ASCIIDOC_EXTRA) -abtrfs_version=$(BTRFS_VERSION) \
- -o $@.tmp2 $@.tmp1 && \
- mv $@.tmp2 $@ && \
- rm -f -- $@.tmp1
+ -o $@+ $< && \
+ mv $@+ $@
diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf
index 313f185..1ea7459 100644
--- a/Documentation/asciidoc.conf
+++ b/Documentation/asciidoc.conf
@@ -10,6 +10,12 @@
[macros]
(?su)[\\]?(?P<name>linkbtrfs):(?P<target>\S*?)\[(?P<attrlist>.*?)\]=
+[tags]
+bracket-emphasis={1?[{1}]}<emphasis><|></emphasis>
+
+[quotes]
+<|>=#bracket-emphasis
+
[attributes]
asterisk=*
plus=+
--
2.2.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] Documentation: fix broken conversion
2015-01-05 14:10 [PATCH] Documentation: fix broken conversion Peter Wu
@ 2015-01-06 1:14 ` Qu Wenruo
2015-01-09 17:41 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: Qu Wenruo @ 2015-01-06 1:14 UTC (permalink / raw)
To: Peter Wu, linux-btrfs
-------- Original Message --------
Subject: [PATCH] Documentation: fix broken conversion
From: Peter Wu <peter@lekensteyn.nl>
To: <linux-btrfs@vger.kernel.org>
Date: 2015年01月05日 22:10
> Fixes various formatting issues:
>
> Fixes quoting issues in various manpages. Before/After excerpts for
> mkfs.btrfs(8), btrfs-qgroup(8):
>
> mkfs.btrfs [-A|--alloc-start '<alloc-start>']
> mkfs.btrfs [-A|--alloc-start <alloc-start>]
> id 0/<subvolume id>''
> id 0/<subvolume id>
> If multiple '<attr>'s is given, use comma to separate.
> If multiple <attr>s is given, use comma to separate.
>
> The one that is most apparent is the removal of text in
> btrfs-subvolume(8) and others. Before/After:
>
> list [options] [-G <value>] [-C <value>] [--sort=rootid,gen,ogen,path] <path>
> list [options] [-G [+|-]<value>] [-C [+|-]<value>] [--sort=rootid,gen,ogen,path] <path>
> create [-i <qgroupid>] <name>
> create [-i <qgroupid>] [<dest>]<name>
Nice catch!
>
> This happens because `<foo>` was replaced by `'<foo>'` in the sed
> expression, which is then treated as a constrained quote. As a result,
> the `[...]` before the string gets interpreted as "quoted text
> attributes".
>
> In this patch, the sed expression is dropped and asciidoc is configured
> to recognize `<...>` as a unconstrained quoted string (such that
> `<attr>s` is correctly emphasized) and to avoid adding quotes in
> contexts where it is not needed.
>
> A remaining problem is that some texts (the one between brackets) do not
> add the emphasis for `<...>`.
IMHO, current implement in this patch is already good enough, although
it is still not perfect,
but much much better than previous one and such missing of emphasize is
acceptable.
> While this could be solved by replacing
> `[` and `]` with `[` and `]` using sed, it introduces formatting
> problems in btrfs-zero-log(8) because the context is ignored.
>
> Signed-off-by: Peter Wu <peter@lekensteyn.nl>
> ---
> Documentation/Makefile | 8 +++-----
> Documentation/asciidoc.conf | 6 ++++++
> 2 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/Makefile b/Documentation/Makefile
> index ef4f1bd..72ab77b 100644
> --- a/Documentation/Makefile
> +++ b/Documentation/Makefile
> @@ -113,10 +113,8 @@ clean:
> $(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
>
> %.xml : %.txt asciidoc.conf
> - $(QUIET_ASCIIDOC)$(RM) $@.tmp[12] $@ && \
> - sed -e "s/\(<[^>]\+>\)/'\1'/g" < $< > $@.tmp1 && \
> + $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
> $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
> $(ASCIIDOC_EXTRA) -abtrfs_version=$(BTRFS_VERSION) \
> - -o $@.tmp2 $@.tmp1 && \
> - mv $@.tmp2 $@ && \
> - rm -f -- $@.tmp1
> + -o $@+ $< && \
> + mv $@+ $@
> diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf
> index 313f185..1ea7459 100644
> --- a/Documentation/asciidoc.conf
> +++ b/Documentation/asciidoc.conf
> @@ -10,6 +10,12 @@
> [macros]
> (?su)[\\]?(?P<name>linkbtrfs):(?P<target>\S*?)\[(?P<attrlist>.*?)\]=
>
> +[tags]
> +bracket-emphasis={1?[{1}]}<emphasis><|></emphasis>
> +
> +[quotes]
> +<|>=#bracket-emphasis
> +
This method is more elegant than the original sed method.
Thanks a lot.
Qu
> [attributes]
> asterisk=*
> plus=+
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] Documentation: fix broken conversion
2015-01-05 14:10 [PATCH] Documentation: fix broken conversion Peter Wu
2015-01-06 1:14 ` Qu Wenruo
@ 2015-01-09 17:41 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2015-01-09 17:41 UTC (permalink / raw)
To: Peter Wu; +Cc: linux-btrfs
On Mon, Jan 05, 2015 at 03:10:09PM +0100, Peter Wu wrote:
> In this patch, the sed expression is dropped and asciidoc is configured
> to recognize `<...>` as a unconstrained quoted string (such that
> `<attr>s` is correctly emphasized) and to avoid adding quotes in
> contexts where it is not needed.
Thanks, I like that very much.
> A remaining problem is that some texts (the one between brackets) do not
> add the emphasis for `<...>`. While this could be solved by replacing
> `[` and `]` with `[` and `]` using sed, it introduces formatting
> problems in btrfs-zero-log(8) because the context is ignored.
A minor issue, if this can be fixed by manually adjusting the page
source, then it's fine.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-09 17:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-05 14:10 [PATCH] Documentation: fix broken conversion Peter Wu
2015-01-06 1:14 ` Qu Wenruo
2015-01-09 17:41 ` David Sterba
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 NNTP newsgroup(s).