Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/cmd/present2md: conversion strips comments and .caption commands #41883

Open
kortschak opened this issue Oct 9, 2020 · 4 comments
Open
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@kortschak
Copy link
Contributor

What version of Go are you using (go version)?

$ go version
go version go1.15.2 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN="/home/user/bin"
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/user/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/user"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/user/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/user/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/user/go/src/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build264055988=/tmp/go-build -gno-record-gcc-switches"

present2md from golang/tools@96877f2

What did you do?

Invoke present2md on a file like so:

topic

Presenter McPresenterface

* Introduction

# Comment about this slide for internal use.

Content

.image https://blog.golang.org/lib/godoc/images/footer-gopher.jpg

.caption The gopher

What did you expect to see?

All the comments and .captions remaining.

# topic

Presenter McPresenterface

## Introduction

// Comment about this slide for internal use.

Content

.image https://blog.golang.org/lib/godoc/images/footer-gopher.jpg

.caption The gopher

What did you see instead?

Stripped like so:

# topic

Presenter McPresenterface

## Introduction

Content

.image https://blog.golang.org/lib/godoc/images/footer-gopher.jpg
The gopher
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Oct 9, 2020
@gopherbot gopherbot added this to the Unreleased milestone Oct 9, 2020
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/260897 mentions this issue: present: retain complete caption command when parsing captions

@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 9, 2020
@kortschak
Copy link
Contributor Author

kortschak commented Oct 9, 2020

The fix sent in CL260897 fixes the .caption command issue by correcting the parse behaviour, but I don't think that the loss of comment issue is trivially fixable; comments are discarded without consideration when parsed by x/tools/present. Keeping them would require an additional mode to retain them and is probably not worth doing. A possible work around is to preprocess the comments to // with something like sed (or internally in present2md).

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/260898 mentions this issue: cmd/present2md: allow comments to be retained in translated document

@dmitshur
Copy link
Contributor

CC @rsc per owners.

gopherbot pushed a commit to golang/tools that referenced this issue Mar 19, 2021
Updates golang/go#41883

Change-Id: I332aa821a6e414a77ff8d8cc384ba23b5955b05b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/260897
Run-TryBot: Ian Lance Taylor <iant@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Cherry Zhang <cherryyz@google.com>
gopherbot pushed a commit to golang/tools that referenced this issue Mar 19, 2021
Updates golang/go#41883

Change-Id: I94621f8583ee9fab492f64ae4df442ea856da400
Reviewed-on: https://go-review.googlesource.com/c/tools/+/260898
Run-TryBot: Ian Lance Taylor <iant@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Cherry Zhang <cherryyz@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants