Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/pandocPublic

Change treatment ofnumber-lines directives.#5207

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jgm merged 1 commit intojgm:masterfromleungbk:rst-whitespace
Jan 10, 2019

Conversation

leungbk
Copy link
Contributor

Directives of this type without numeric inputs should not have a
startFrom attribute; with a blank value, the writers can produce
extra whitespace.

Also, the stuff around line 1000 is modified because previously, it failed to catch newlines.

Closes#5182.

@leungbkleungbkforce-pushed therst-whitespace branch 3 times, most recently fromc36dd4e todf873ceCompareJanuary 9, 2019 04:13
@leungbk
Copy link
ContributorAuthor

Hmm, I'm not sure why the CI can't load my file. I'm following the example of3880.md.

@jgm
Copy link
Owner

jgm commentedJan 9, 2019

Hmm, I'm not sure why the CI can't load my file. I'm following the example of 3880.md.

You probably need to add it expliclitly to extra-source-files in pandoc.cabal.

@@ -505,7 +505,11 @@ includeDirective top fields body = do
let numberLines = lookup "number-lines" fields
let classes = trimr lang : ["numberLines" | isJust numberLines] ++
maybe [] words (lookup "class" fields)
let kvs = maybe [] (\n -> [("startFrom", trimr n)]) numberLines
let kvs = maybe [] (\n -> let tn = trimr n
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

null tn would be better thantn == "". But as a matter of style, I think this is cleaner:

case trimr nof[]->[]    xs-> [("startFrom", xs)]

Indeed, you could use a list comprehension:

let kvs= [("startFrom", xs)| x<- maybeToList (trimr<$> tn)]

but this probably isn't as clear to the reader.

Nothing -> []
Just n -> [("startFrom",trim n)]
Just n
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Similar remarks to the above.

Directives of this type without numeric inputs should not have a`startFrom` attribute; with a blank value, the writers can produceextra whitespace.
@leungbk
Copy link
ContributorAuthor

Done. I also tried to dedupe the code a bit.

@jgm
Copy link
Owner

jgm commentedJan 10, 2019

Looks good, thanks!

@jgmjgm merged commit3597149 intojgm:masterJan 10, 2019
@leungbkleungbk deleted the rst-whitespace branchJanuary 10, 2019 06:43
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jgmjgmjgm left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@leungbk@jgm

[8]ページ先頭

©2009-2025 Movatter.jp