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

convert to markdown for web/api/abortcontroller zh-CN #7001

Merged
merged 3 commits into from
Jul 20, 2022
Merged

convert to markdown for web/api/abortcontroller zh-CN #7001

merged 3 commits into from
Jul 20, 2022

Conversation

fwqaaq
Copy link
Contributor

@fwqaaq fwqaaq commented Jul 19, 2022

No description provided.

@fwqaaq fwqaaq requested a review from a team as a code owner July 19, 2022 20:58
@fwqaaq fwqaaq requested review from irvin and removed request for a team July 19, 2022 20:58
@github-actions github-actions bot added the l10n-zh Issues related to Chinese content. label Jul 19, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jul 19, 2022

Preview URLs

Flaws

URL: /zh-CN/docs/Web/API/AbortController
Title: AbortController
on GitHub
Flaw count: 3

  • macros:
    • /zh-CN/docs/Web/API/AbortController/signal does not exist but fell back to /en-US/docs/Web/API/AbortController/signal
    • /zh-CN/docs/Web/API/AbortController/signal does not exist but fell back to /en-US/docs/Web/API/AbortController/signal
  • translation_differences:
    • Differences in the important macros (3 in common of 4 possible)

URL: /zh-CN/docs/Web/API/AbortController/abort
Title: AbortController.abort()
on GitHub
Flaw count: 3

  • macros:
    • /zh-CN/docs/Web/API/Body does not exist
    • /zh-CN/docs/Web/API/AbortController/signal does not exist but fell back to /en-US/docs/Web/API/AbortController/signal
  • translation_differences:
    • Differences in the important macros (2 in common of 5 possible)

URL: /zh-CN/docs/Web/API/AbortController/AbortController
Title: AbortController.AbortController()
on GitHub
Flaw count: 2

  • macros:
    • /zh-CN/docs/Web/API/AbortController/signal does not exist but fell back to /en-US/docs/Web/API/AbortController/signal
  • translation_differences:
    • Differences in the important macros (3 in common of 4 possible)

External URLs

URL: /zh-CN/docs/Web/API/AbortController
Title: AbortController
on GitHub


URL: /zh-CN/docs/Web/API/AbortController/abort
Title: AbortController.abort()
on GitHub


URL: /zh-CN/docs/Web/API/AbortController/AbortController
Title: AbortController.AbortController()
on GitHub

(this comment was updated 2022-07-20 06:07:42.134099)

@yin1999
Copy link
Member

yin1999 commented Jul 19, 2022

duplicate #6988

@yin1999 yin1999 closed this Jul 19, 2022
@yin1999
Copy link
Member

yin1999 commented Jul 19, 2022

@fwqaaq
Copy link
Contributor Author

fwqaaq commented Jul 19, 2022

@yin1999 Commits copy yours, but translation content is Abortcontroller. Beacuse I am testing this yari

@yin1999
Copy link
Member

yin1999 commented Jul 19, 2022

@yin1999 Commits copy yours, but translation content is Abortcontroller. Beacuse I am testing this yari

Thank you, would you mind merging this commit to my pr with a Co-authored-by magic.

Or you can create a pr after meging that one

@fwqaaq
Copy link
Contributor Author

fwqaaq commented Jul 19, 2022

would you mind merging this commit to my pr with a Co-authored-by magic.

  • Your mind is that you go doing everything?

@yin1999
Copy link
Member

yin1999 commented Jul 20, 2022

  • Your mind is that you go doing everything?

I mean merge this:

but translation content is Abortcontroller

If you want, you can take part in markdown convertion, see #6173 (but, please follow the guide)

@fwqaaq
Copy link
Contributor Author

fwqaaq commented Jul 20, 2022

  • I understand what you mean now. So have you done all the pre-transformation work?
  • Co-authored-by Do you need my email?

@yin1999
Copy link
Member

yin1999 commented Jul 20, 2022

  • I understand what you mean now. So have you done all the pre-transformation work?

Still with to tasks:

  • replace all unicode space to ascii space
  • remove all title in <a> tags

No, I can use github no-reply email, I can got that.

So may I go ahead for merging commit?

@fwqaaq
Copy link
Contributor Author

fwqaaq commented Jul 20, 2022

Yeah

@fwqaaq
Copy link
Contributor Author

fwqaaq commented Jul 20, 2022

  • replace all unicode space to ascii space
  • how to distinguish unicode space and ascii space?
  • how should I find them?

@fwqaaq
Copy link
Contributor Author

fwqaaq commented Jul 20, 2022

unicode space-->U+00a0, replace them?

@yin1999
Copy link
Member

yin1999 commented Jul 20, 2022

I'm using go script to do those tasks:

remove unicode space:

replace all \u00A0 and \u3000 with space. If you are not using go, you can just create a python script to do this.

package main

import (
	"bytes"
	"errors"
	"flag"
	"fmt"
	"io/fs"
	"os"
	"path/filepath"
	"strings"
)

var limit = flag.Int("l", -1, "set limit, -1 means no limit")

var exclude = []string{"conflicting", "orphaned"}

func main() {
	dir := flag.String("d", ".", "set walk dir") // example `-d mdn/translated-content/files/zh-cn` to run jobs on `zh-CN`
	flag.Parse()
	os.Chdir(*dir)
	err := filepath.WalkDir(".", visit)
	if err != nil && err != errLimitReached {
		fmt.Printf("occur an error: %s\n", err.Error())
	}
}

var errLimitReached = errors.New("limit reached")

func visit(path string, d fs.DirEntry, err error) error {
	if d.IsDir() {
		for i := range exclude {
			if strings.HasPrefix(d.Name(), exclude[i]) {
				return filepath.SkipDir
			}
		}
		return nil
	}

	switch filepath.Ext(path) {
	case ".html":
		resolve(path)
	}
	if *limit == 0 {
		return errLimitReached
	}
	return err
}

var (
	space1 = []byte(string([]rune{'\u00A0'}))
	space2 = []byte(string([]rune{'\u3000'}))
)

func resolve(path string) error {
	data, err := os.ReadFile(path)
	if err != nil {
		fmt.Printf("[warn] cannot open file, err: %s\n", err.Error())
		return err
	}
	newData := bytes.ReplaceAll(data, space1, []byte{' '})
	newData = bytes.ReplaceAll(newData, space2, []byte{' '})
	if bytes.Equal(data, newData) {
		return nil
	}
	return os.WriteFile(path, newData, 0644)
}

@fwqaaq
Copy link
Contributor Author

fwqaaq commented Jul 20, 2022

I see

@yin1999 yin1999 changed the title convert to markdown for web/{xpath, xslt} zh-CN convert to markdown for web/api/abortcontroller zh-CN Jul 20, 2022
@yin1999
Copy link
Member

yin1999 commented Jul 20, 2022

Seems the title is not correct, reopen this one. Please follow the convertion guide.

@yin1999 yin1999 reopened this Jul 20, 2022
@yin1999 yin1999 requested review from yin1999 and removed request for irvin July 20, 2022 03:31
@fwqaaq
Copy link
Contributor Author

fwqaaq commented Jul 20, 2022

I write node to fix unicode space errors, repair so many at a time, I don't know if there is any problem

@fwqaaq
Copy link
Contributor Author

fwqaaq commented Jul 20, 2022

Seems the title is not correct, reopen this one. Please follow the convertion guide.

---
title: AbortController
---
  • is it this one? I can't understand what your mind

@fwqaaq
Copy link
Contributor Author

fwqaaq commented Jul 20, 2022

Or you can close this pr, I just to test yari

@yin1999 yin1999 assigned yin1999 and unassigned fwqaaq Jul 20, 2022
@yin1999
Copy link
Member

yin1999 commented Jul 20, 2022

Or you can close this pr, I just to test yari

I've force push to clear commits

@yin1999 yin1999 merged commit e7d49dc into mdn:main Jul 20, 2022
@fwqaaq fwqaaq deleted the Abortcontroller branch July 21, 2022 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
l10n-zh Issues related to Chinese content.
Projects
Development

Successfully merging this pull request may close these issues.

2 participants