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

Fix example code is displayed correctly in readme.md #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

beatfreaker
Copy link

No description provided.

@SlimerDude
Copy link
Member

Hi Beatfreaker,

Thanks for the Pull Request but, erm, how do I say this nicely!? You appear to be Americanising my British English!

I'll keep the s's for now (us Brits aren't too fond of those nasty zs!) but you do bring up a good issue with the pre text code example in the ordered list.

The markdown is actually auto-generated from the pod.fandoc so that will actually be a bug with the MarkdownDocWriter.

I have no time now, but I'll make a note to investigate later.

Thanks for the interest in afJson!

Steve.

@beatfreaker
Copy link
Author

Hi @SlimerDude

I'll revert the changes in readme.doc and regarding pre text code I think the issue is that the code block in pod.fandoc is not wrapped with pre tag

afJson/doc/pod.fandoc

Lines 22 to 76 in 55fd133

syntax: fantom
using afJson
class Example {
Void main() {
// write some JSON...
json := """{
"name" : "Emma",
"sex" : "female",
"likes" : ["Cakes","Adventure"],
"car" : {
"name" : "Golf",
"brand" : "VW"
},
"score" : 9
}"""
// ...and WHAM! A fully inflated domain object!
friend := (Friend) Json().fromJson(json, Friend#)
echo(friend.name) // --> Emma
echo(friend.car.name) // --> Golf
friend.score = 11
friend.car = null
// we can even convert the other way!
moarJson := Json().toJson(friend)
echo(moarJson)
// --> {"name":"Emma","sex":"female","score":11,"likes":["Cakes","Adventure"]}
}
}
class Friend {
@JsonProperty Str name
@JsonProperty Sex sex
@JsonProperty Int score
@JsonProperty Str[] likes
@JsonProperty Car? car // embedded objects!
new make(|This| f) { f(this) }
}
class Car {
@JsonProperty Str name
@JsonProperty Str brand
new make(|This| f) { f(this) }
}
enum class Sex {
male, female;
}

should I add that in this PR ?

@SlimerDude
Copy link
Member

The pod.fandoc is actually fine, as a double (x2) space indent in fandoc also signifies pre text - in much the same way 4x spaces are used in markdown. (At the time, I think I had trouble with pre> tags in lists...?)

The triple backtick ` notation in the pull request is actually GitHub notation, not official Markdown syntax - which is why (I think) they don't appear in the generated .md document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants